//document.getElementById('content_table').style.visibility = 'hidden';
// Liste der Bilder 
var preload_images = 
[ 
"img/layout/link1.png", 
"img/layout/link1h.png", 
"img/layout/banner_0h.jpg",
"img/layout/content_text1right_bgr.jpg",
"img/layout/content_text2right_bgr.jpg",
"img/layout/content_titleleft_bgr.jpg",
"img/layout/content_title2left_bgr.jpg",
] 
//alert(preload_images);

var load_next = 500 // Zeit in ms zwischen zwei Ladevorgaengen 
var pos_array = 0 
// Ladefunktion 
function preload() { 
// Naechstes Bild laden 
var new_image = new Image() 
new_image.src = preload_images[pos_array] 
// Noch Bilder zu laden? 
pos_array++ 
if(pos_array < preload_images.length) 
setTimeout('preload()', load_next) 
} 

function preload_start() { 
// Bilder vorhanden? 
if(preload_images.length == 0) 
return 
// Pruefroutine starten 
setTimeout('preload()', load_next) 
}

function content_start() { 
//document.getElementById('content_table').style.visibility = 'hidden';
setTimeout('content_start2()', 1000) 
}
function content_start2() {
document.getElementById('content_bgr_table').style.visibility = 'visible';
//document.getElementById('content_bgr_table').style.width = '100%';
}




function openWindow(URL, winName, features)
    {
        window.open(URL, winName, features); 
    }







//Bilder einblenden
var fadeTargetId = 'dia'; /* change this to the ID of the fadeable object */
var	fadeTarget;
var preInitTimer;
if (document.getElementById(fadeTargetId)) {preInit();}

/* functions */

function preInit() {
	/* an inspired kludge that - in most cases - manages to initially hide the image
	   before even onload is triggered (at which point it's normally too late, and a nasty flash
	   occurs with non-cached images) */
	if ((document.getElementById)&&(fadeTarget=document.getElementById(fadeTargetId))) {
		fadeTarget.style.visibility = "hidden";
		if (typeof preInitTimer != 'undefined') clearTimeout(preInitTimer); /* thanks to Steve Clay http://mrclay.org/ for this small Opera fix */
	} else {
		preInitTimer = setTimeout("preInit()",2);
	}
}

function fadeInit() {
	if (document.getElementById) {
		/* get a handle on the fadeable object, to make code later more manageable */
		preInit(); /* shouldn't be necessary, but IE can sometimes get ahead of itself and trigger fadeInit first */
		/* set the initial opacity in a (hopefully) cross browser way
		   notice that because of the way the image is in front, and not obfuscated
		   by another object we need to "fade out", i don't need a fallback mechanism
		   to show/hide the covering object...the image is just there, full stop */
		if (fadeTarget.style.MozOpacity!=null) {  
			/* Mozilla's pre-CSS3 proprietary rule */
			fadeTarget.style.MozOpacity = 0;
		} else if (fadeTarget.style.opacity!=null) {
			/* CSS3 compatible */
			fadeTarget.style.opacity = 0;
		} else if (fadeTarget.style.filter!=null) {
			/* IE's proprietary filter */
			fadeTarget.style.filter = "alpha(opacity=0)";
		}
		/* make the object visible again */
		fadeTarget.style.visibility = 'visible';
		window.setTimeout("fadeIn(0)", 500);
	}
}

function fadeIn(opacity) {
	if (fadeTarget) {
		if (opacity <= 100) {
			if (fadeTarget.style.MozOpacity!=null) {
				/* Mozilla's pre-CSS3 proprietary rule */
				fadeTarget.style.MozOpacity = (opacity/100)-.001;
				/* the .001 fixes a glitch in the opacity calculation which normally results in a flash when reaching 1 */
			} else if (fadeTarget.style.opacity!=null) {
				/* CSS3 compatible */
				fadeTarget.style.opacity = (opacity/100)-.001;
			} else if (fadeTarget.style.filter!=null) {
				/* IE's proprietary filter */
				fadeTarget.style.filter = "alpha(opacity="+opacity+")";
				/* worth noting: IE's opacity needs values in a range of 0-100, not 0.0 - 1.0 */ 
			}
			opacity += 10;
			window.setTimeout("fadeIn("+opacity+")", 30);
		}
	}
}

function iFrameHeight() {
if(document.getElementById && !(document.all)) {
h = document.getElementById('iframename').contentDocument.body.scrollHeight;
document.getElementById('iframename').style.height = h;
}
else if(document.all) {
h = document.frames('iframename').document.body.scrollHeight;
document.all.iframename.style.height = h;
}
}

function PopUp_upload(datei,hoehe,breite,win_name) {
 // Position errechnen 
 	xpos=(screen.width-breite)/2; 
	ypos=(screen.height-hoehe)/2; 
 // Fenster öffnen
 window.open(datei,win_name,'height='+hoehe+',width='+breite+',top='+ypos+',left='+xpos+',resizeable=1,status=1,scrollbars=1');
 
 // Fenster in Fokus
 ///PopUp.focus();
}
	
function popup(datei,hoehe,breite,win_name) {
 // Position errechnen
 new_left = (screen.width-breite)/2;
 new_top  = (screen.height-hoehe)/2;
 // Fenster öffnen
 var PopUp = window.open(datei,win_name,"height=" + hoehe +",width=" + breite + ",top=" + new_top + ",left=" + new_left +
 ",resizeable=no,status=yes,scrollbars=yes");
 // Fenster in Fokus
 PopUp.focus();
}
	
function boxheight(boxnr,titel_no,titel_no_akt) {
	window.setTimeout("box_height("+boxnr+","+titel_no+","+titel_no_akt+")", 1000);
	//alert(boxnr + ' ' + titel_no);	
}

function box_height(boxnr,titel_no,titel_no_akt) {
	var boxnr1 = boxnr;
	var boxnr2 = boxnr-1;
	
	if(document.getElementById('boxnr_' + boxnr1).offsetHeight < document.getElementById('boxnr_' + boxnr2).offsetHeight) {
		if(titel_no_akt==titel_no) {
			if(document.all) {
				document.getElementById('boxnr_' + boxnr1).style.height = document.getElementById('boxnr_' + boxnr2).offsetHeight;
			}
			else {
				document.getElementById('boxnr_' + boxnr1).style.height = document.getElementById('boxnr_' + boxnr2).offsetHeight;
			}
		}
		else{
			if(titel_no=="1") {
				if(document.all) {
					document.getElementById('boxnr_' + boxnr1).style.height = document.getElementById('boxnr_' + boxnr2).offsetHeight;
				}
				else {
					document.getElementById('boxnr_' + boxnr1).style.height = document.getElementById('boxnr_' + boxnr2).offsetHeight;
				}
			}
		
			else {
				if(document.all) {
					document.getElementById('boxnr_' + boxnr1).style.height = (document.getElementById('boxnr_' + boxnr2).offsetHeight-32);
				}
				else {
					document.getElementById('boxnr_' + boxnr1).style.height = (document.getElementById('boxnr_' + boxnr2).offsetHeight-33);	
				}
			}
		}
	}
	
	else {
		if(titel_no_akt==titel_no) {
			if(document.all) {
				document.getElementById('boxnr_' + boxnr2).style.height = document.getElementById('boxnr_' + boxnr1).offsetHeight;
			}
			else {
				document.getElementById('boxnr_' + boxnr2).style.height = document.getElementById('boxnr_' + boxnr1).offsetHeight;
			}
		}
		else {
			if(titel_no=="1") {
				if(document.all) {
					document.getElementById('boxnr_' + boxnr2).style.height = document.getElementById('boxnr_' + boxnr1).offsetHeight;
				}
				else {
					document.getElementById('boxnr_' + boxnr2).style.height = document.getElementById('boxnr_' + boxnr1).offsetHeight;
				}
			}
		
			else {
				if(document.all) {
					document.getElementById('boxnr_' + boxnr2).style.height = (document.getElementById('boxnr_' + boxnr1).offsetHeight-32);
				}
				else {
					document.getElementById('boxnr_' + boxnr2).style.height = (document.getElementById('boxnr_' + boxnr1).offsetHeight-33);
		
				}
			}
		}
	}
	
}

function kat1_change(){
   	  $spr = document.schnellsuche.sprache2.value;
   	  $art = document.schnellsuche.art.value;
   	  $modell = document.schnellsuche.modell.value;
      new Ajax.Request('inc/return.inc.php?lang=' + $spr + '&art=' + $art + '&modell=' + $modell + '&kat1=' + (document.getElementById('kat1').value), {method: 'get', onComplete: GetKat2});   
   }
   
function kat1b_change(){
   	  $spr = document.schnellsuche.sprache2.value;
   	  $art = document.schnellsuche.art.value;
   	  $modell = document.schnellsuche.modell2.value;
      new Ajax.Request('inc/return2.inc.php?lang=' + $spr + '&art=' + $art + '&modell=' + $modell + '&kat1b=' + (document.getElementById('kat1b').value), {method: 'get', onComplete: GetKat2b});   
   }
   
function kat_inserat1_change(){
   	  $spr = document.schnellsuche.sprache2.value;
   	  $art = document.schnellsuche.art.value;
   	  $modell = document.schnellsuche.modell.value;
      new Ajax.Request('inc/return_inserat.inc.php?lang=' + $spr + '&art=' + $art + '&modell=' + $modell + '&kat1=' + (document.getElementById('kat1').value), {method: 'get', onComplete: GetKat_inserat2});   
   }
   
function kat_inserat1suche_change(){
   	  $spr_suche = document.schnellsuche.sprache2_suche.value;
   	  $art_suche = document.schnellsuche.art_suche.value;
   	  $modell_suche = document.schnellsuche.modell_suche.value;
   	  //alert($spr_suche + ' ' + $art_suche + ' ' + $modell_suche);
      new Ajax.Request('inc/return_inserat_suche.inc.php?lang=' + $spr_suche + '&art_suche=' + $art_suche + '&modell_suche=' + $modell_suche + '&kat1_suche=' + (document.getElementById('kat1_suche').value), {method: 'get', onComplete: GetKat_inserat2_suche});   
   }
   
function kat_inserat2_change(){
   	  $spr = document.schnellsuche.sprache2.value;
   	  $art = document.schnellsuche.art.value;
   	  $modell = document.schnellsuche.modell.value;
   	  $hersteller = document.schnellsuche.hersteller.value;
      new Ajax.Request('inc/return_inserat.inc.php?lang=' + $spr + '&art=' + $art + '&modell=' + $modell + '&kat1=' + $hersteller, {method: 'get', onComplete: GetKat_inserat2});   
   }
   
function kat_inserat2suche_change(){
   	  $spr_suche = document.schnellsuche.sprache2_suche.value;
   	  $art_suche = document.schnellsuche.art_suche.value;
   	  $modell_suche = document.schnellsuche.modell_suche.value;
   	  $hersteller_suche = document.schnellsuche.hersteller_suche.value;
   	  //alert($spr_suche + ' ' + $art_suche + ' ' + $modell_suche + ' ' + $hersteller_suche);
      new Ajax.Request('inc/return_inserat_suche.inc.php?lang=' + $spr_suche + '&art_suche=' + $art_suche + '&modell_suche=' + $modell_suche + '&kat1_suche=' + $hersteller_suche, {method: 'get', onComplete: GetKat_inserat2_suche});   
   }
   


function GetKat2(originalRequest){   
//alert(originalRequest.responseText);
      document.getElementById("pkat2").innerHTML = originalRequest.responseText
   } 
   
function GetKat_inserat2(originalRequest){   
//alert(originalRequest.responseText);
      document.getElementById("pkat2").innerHTML = originalRequest.responseText
   } 
   
function GetKat_inserat2_suche(originalRequest){   
//alert(originalRequest.responseText);
      document.getElementById("pkat2_suche").innerHTML = originalRequest.responseText
   } 
   
function GetKat2b(originalRequest){   
//alert(originalRequest.responseText);
      document.getElementById("pkat2b").innerHTML = originalRequest.responseText
   } 
   
function max_zeichen(feld,counter,counter_hidden,max){
	var z = document.getElementById(feld).value.length;
	var m = max-z;
	
	if(m<1){
		m=0;
		document.getElementById(feld).value=document.getElementById(feld).value.substring(0,max);
		//document.getElementById(counter).innerHTML = "0";
	}
	//else {
	document.getElementById(counter).innerHTML = m;
	document.getElementById(counter_hidden).value=m;
	//}
}

function Bild(bild) {
//var im = new Array("ftp/spielplan_details/" + bild + ".jpg","ftp/spielplan_details/" + bild + "a.jpg","ftp/spielplan_details/" + bild + "b.jpg","ftp/spielplan_details/" + bild + "c.jpg","ftp/spielplan_details/" + bild + "d.jpg");
  var bildlink = 'img/inserat_pics/' + bild;
  document.images.dia.src = bildlink;
 fadeInit()
 }
 
//Bilder einblenden
var fadeTargetId = 'dia'; /* change this to the ID of the fadeable object */
var	fadeTarget;
var preInitTimer;
if (document.getElementById(fadeTargetId)) {preInit();}

/* functions */

function preInit() {
	/* an inspired kludge that - in most cases - manages to initially hide the image
	   before even onload is triggered (at which point it's normally too late, and a nasty flash
	   occurs with non-cached images) */
	if ((document.getElementById)&&(fadeTarget=document.getElementById(fadeTargetId))) {
		fadeTarget.style.visibility = "hidden";
		if (typeof preInitTimer != 'undefined') clearTimeout(preInitTimer); /* thanks to Steve Clay http://mrclay.org/ for this small Opera fix */
	} else {
		preInitTimer = setTimeout("preInit()",2);
	}
}

function fadeInit() {
	if (document.getElementById) {
		/* get a handle on the fadeable object, to make code later more manageable */
		preInit(); /* shouldn't be necessary, but IE can sometimes get ahead of itself and trigger fadeInit first */
		/* set the initial opacity in a (hopefully) cross browser way
		   notice that because of the way the image is in front, and not obfuscated
		   by another object we need to "fade out", i don't need a fallback mechanism
		   to show/hide the covering object...the image is just there, full stop */
		if (fadeTarget.style.MozOpacity!=null) {  
			/* Mozilla's pre-CSS3 proprietary rule */
			fadeTarget.style.MozOpacity = 0;
		} else if (fadeTarget.style.opacity!=null) {
			/* CSS3 compatible */
			fadeTarget.style.opacity = 0;
		} else if (fadeTarget.style.filter!=null) {
			/* IE's proprietary filter */
			fadeTarget.style.filter = "alpha(opacity=0)";
		}
		/* make the object visible again */
		fadeTarget.style.visibility = 'visible';
		window.setTimeout("fadeIn(0)", 500);
	}
}

function fadeIn(opacity) {
	if (fadeTarget) {
		if (opacity <= 100) {
			if (fadeTarget.style.MozOpacity!=null) {
				/* Mozilla's pre-CSS3 proprietary rule */
				fadeTarget.style.MozOpacity = (opacity/100)-.001;
				/* the .001 fixes a glitch in the opacity calculation which normally results in a flash when reaching 1 */
			} else if (fadeTarget.style.opacity!=null) {
				/* CSS3 compatible */
				fadeTarget.style.opacity = (opacity/100)-.001;
			} else if (fadeTarget.style.filter!=null) {
				/* IE's proprietary filter */
				fadeTarget.style.filter = "alpha(opacity="+opacity+")";
				/* worth noting: IE's opacity needs values in a range of 0-100, not 0.0 - 1.0 */ 
			}
			opacity += 10;
			window.setTimeout("fadeIn("+opacity+")", 30);
		}
	}
}


/* initialise fader by hiding image object first */
if (document.getElementById(fadeTargetId)) {addEvent (window,'load',fadeInit);}

function change_step(https,get_lang,step){
	document.ins1.action = https + '?' + get_lang + '&id=13&my=1&step=' + step;
}
