// JavaScript Document
	DatArray = new Array("So","Mo","Di","Mi","Do","Fr","Sa","??" )

	function Search(){
	with (window.document.mainForm){
		Ra = parseInt(ERW.options[ERW.selectedIndex].value)
		if (KA1.selectedIndex != 0) Ra++
		if (KA2.selectedIndex != 0) Ra++
		if (Ra >4)
		{
			alert("Es sind nur max4 Reisende möglich!")
			return
		} 
		
		var vLMIN= 3;
		var vLMAX= 25;
		if (xL.value !='') {
			vLMIN= eval(xL.value.substr(0,2));
			vLMAX= eval(xL.value.substr(2,2));
		}
		LMIN.value=vLMIN;
		LMAX.value=vLMAX;
		
		vVON = VON.selectedIndex+1;
		vBIS = BIS.selectedIndex+4; //bis starts with 4
		
		if ((vBIS - vVON) < vLMIN){
			vBIS = vVON + vLMIN;
			BIS.selectedIndex = vBIS - 4;
		}
		
		if (vVON>40)
			usealt.value=1;
		else
			usealt.value=0;
			
		RA.value=Ra
		
		submit()
	}
}

	function SELECT_VON_PACK(von_sel){
		document.write("<select name='VON' onChange=TCHECK(0) class='VON'>")
		for (var i=1; i<=200;i++){
			if (i == von_sel) {
				document.write('<option value='+i+' selected>'+GetDatum(i)+'')
			} else {
				document.write('<option value='+i+'>'+GetDatum(i)+'')
			}
		}
		document.write("</select>")
	}

	function SELECT_BIS_PACK(bis_sel){
		document.write("<select name='BIS' class='BIS'>")
		for (var i=2; i<=230;i++){
			if (i==bis_sel) 
				document.write('<option selected ');  
			else 
				document.write('<option ');
			document.write('value='+i+'>'+GetDatum(i)+'')
		}
		document.write("</select>")
	}			
			
	function genReisedauer(){
		with (window.document.GO){
			// var testlmin = xL.options[xL.selectedIndex].value
			// testlmin2 = "hallo";
			LMIN.value = xL.options[xL.selectedIndex].value.substr(0,2)
			LMAX.value = xL.options[xL.selectedIndex].value.substr(2,2)
			// alert ("hallo " +testlmin);
		}			
	}

	function GetDatum(offset){
		var time = new Date();
		time.setTime(time.getTime()+offset*86400000)
		var tag = time.getDate();
				if (tag < 10) {
						tag= "0" + tag;
							}
		var monat = 1+time.getMonth()
				if (monat < 10) {
						monat= "0" + monat;
							}
		//return DatArray[time.getDay()]+' '+tag+'.'+monat+'.'+(2000+(time.getYear()%100))
		return ' '+tag+'.'+monat+'.'+(2000+(time.getYear()%100))+' - '+DatArray[time.getDay()]
	}

	function MM_reloadPage(init) {  //reloads the window if Nav4 resized
		if (init==true) with (navigator) {if ((appName=='Netscape')&&(parseInt(appVersion)==4)) {
		document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
		else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
	}
	
	Von=0;
	function TCHECK(VonBis)
		{
			with (document.mainForm)
				{
					Von1 = VON.selectedIndex
					Bis = Math.max(Math.min( BIS.selectedIndex + Von1-Von ,BIS.length-1),0);
					Von=Von1
					BIS.selectedIndex = Bis;
				}
	
		}
		
	MM_reloadPage(true);

	var zufallszahl = 1 + 9999999*(Math.random());
	var zahl = Math.round(zufallszahl);


	function selectOption(selectObj, val){
		for (var i = 0; i < selectObj.options.length; i++) {
			if (selectObj.options[i].value==val){
				selectObj.options[i].selected = true;
			}
		}
	}

