/**
 * @author fred
 */
 
 function closeWin() {
 	$("#gewinnspiel").css("visibility",'hidden');
 	$("#gewinnspiel").css("display",'none');
 
 }
 
function popup (url,w,h) {
	fenster = window.open(url, "", "width="+w+",height="+h+",status=0,scrollbars=0,resizable=0");
	fenster.focus();
}  
 

function Go (select) {
  var wert = select.options[select.options.selectedIndex].value;
  if (wert == "leer") {
    select.form.reset();
    return;
    } 
  else 
         {
       location.href = "http://s275806276.online.de/"+wert;
       }
}

function submitForm(id) {
	
	 document.forms[id].submit();
	
	 }


function openSbox1(content, gallery, current){
    Shadowbox.open({
        content:    content,
        player:     'img',
        title:      'test',
        gallery:    gallery,
        current:    parseInt(current)
    });
}
 

  

function getRandom( min, max ) {
        if( min > max ) {
                return( -1 );
        }
        if( min == max ) {
                return( min );
        }
        return( min + parseInt( Math.random() * ( max-min+1 ) ) );

} 
 
 
$(document).ready(function () {
				resize();
				resizeImage();
			});

function resize() {
 	if($(window).width() > 1180 )
		$("#bgRight").css("width",$(window).width());


	 if($(window).width() < 1279 ) {
		
		
		offset = 20;
		// 
		$("#bgRight").css("background",'transparent url(fileadmin/assets/img/ie/bg.jpg) no-repeat scroll '+(-160+offset)+'px top');
		$("#container").css("margin-left",(-25+offset)+'px');
		$("#bgBot").css("background",'transparent url(fileadmin/assets/img/ie/bottom1.jpg) repeat-y scroll '+(-160+offset)+'px top');
		
		$("#superbanner").css("left",(105+offset)+'px');
		$("#skyscraper").css("left",(990+offset)+'px');
		
		
		//$("#container").css("margin-left",margin);
		//$("#container").css("width","1020px");
		//$("#containerCon").css("padding-right","0px");
	
	} else {
		//$("#bgRight").css("background",'transparent url(fileadmin/assets/img/ie/bg.jpg) no-repeat scroll left top');
		
		$("#bgRight").css("background",'transparent url(fileadmin/assets/img/ie/bg.jpg) no-repeat scroll left top');
		
		$("#bgBot").css("background",'transparent url(fileadmin/assets/img/ie/bottom1.jpg) repeat-y scroll left top');
		
		$("#container").css("margin-left",'135px');
		$("#superbanner").css("left",'265px');
		$("#skyscraper").css("left",'1150px');
		
		
		//$("#container").css("margin","0 auto");
		//$("#container").css("width","1060px"); 
		//$("#containerCon").css("padding-right","40px");
	}
};




var resizeTimer = null;
$(window).bind('resize', function() {
   if (resizeTimer) clearTimeout(resizeTimer);
   		resizeTimer = setTimeout('resize()', 400);
}); 




 





function popupFlashPaper(ausgabe) {
 ausgabe = '2009/1';
 fenster1 = window.open('fileadmin/content/Onlineausgeben/'+ausgabe+'/index.html', '', 'width=880,height=650,status=0,scrollbars=0,resizable=0');
 fenster1.focus();
} 



function runde(x, n) {
  if (n < 1 || n > 14) return false;
  var e = Math.pow(10, n);
  var k = (Math.round(x * e) / e).toString();
  if (k.indexOf('.') == -1) k += '.';
  k += e.toString().substring(1);
  return k.substring(0, k.indexOf('.') + n+1);
}


function berechnePrivateKleinanzeige(laenge) {
	if(laenge > 100) {
		var tmplg = laenge - 100;
		
		return (tmplg/25);
		
	
	}
	else 
		return '10.00';

}

function berechneAnzeige(zeichen) {
	var laenge = document.getElementById("anzeigenText").value.length;
	//$("anzeigenText").val("value");
	
	document.getElementById("zeichenAnz").value = laenge;
	//$("zeichenAnz").value("value");
	var typ = 1;
	var preis = 0;
	switch(typ) {
		case 1:
			preis = berechnePrivateKleinanzeige(laenge);
			break;
	
	}	

}





 function ajaxLoad(url,div) {
 $("#"+div).fadeTo("slow", 0.01);

 $("#"+div+"Out").addClass('ajaxLoader');

 $.ajax({
 url: url,
 cache: true,
 success: function(html){
 $("#"+div+"Out").removeClass('ajaxLoader');
 $("#"+div).html(html);
$("#"+div).fadeTo("slow", 1.0);
resizeImage();

 }
 });


}
 
 
 function resizeImage()
 {
	var imgWidth =  $(".news-latest-small-1 .latestImage img").width();
	var imgHeight = $(".news-latest-small-1 .latestImage img").height()
	 
	teiler = (imgWidth / 114.0);
	newHeight = (imgHeight/teiler);
	//alert(teiler);
	//	alert(newHeight);
	
	$(".news-latest-small-1 .latestImage img").width(114);
	$(".news-latest-small-1 .latestImage img").height(newHeight);
	
 } 
 


 function getAnzeigenKat(uid,div) {
 $("#"+div).fadeTo("slow", 0.01);

 $("#"+div+"Out").addClass('ajaxLoader');

 $.ajax({
 url: 'http://local.hoch2.org/moinmoin/fileadmin/php/getCat.php?uid='+uid,
 cache: true,
 success: function(html){
 $("#"+div+"Out").removeClass('ajaxLoader');
 $("#"+div).html(html);
$("#"+div).fadeTo("slow", 1.0);

 }
 });


}

function switchAjaxImg(img, pic) {
						
						img.src = pic;					
					}




function pageload(hash) {
		// hash doesn't contain the first # character.
		if(hash) {
			// restore ajax loaded state
			$("#load").load(hash + ".html");
		} else {
			// start page
			$("#load").empty();
		}
	}
	
	







 

 