DatArray = new Array("So","Mo","Di","Mi","Do","Fr","Sa","??" )
function Open_Window(Url,WindowName,Options,ww,wh)
{
WindowParam = Options
WindowParam += ',left='+(screen.width-ww)/2 + ',top='+(screen.height-wh)/2+',width='+ww+',height='+wh 
NewWindow=window.open(Url, WindowName, WindowParam);	
return NewWindow
}
function Search()
{
with (window.document.GO)
{
	if(SF[0].checked) {
		Url='http://flweb5.ypsilon.net/index.phtml/ssr12920a_700378?';
		Url+='AorK=K&firstrun=1&flydrive=\n&flystay=&login=1&pyb=1&profi_mode=';
		from = LRW.options[LRW.selectedIndex].value;
		to = FZIEL.value;
		
		Von = VON.options[VON.selectedIndex].text;
		Bis = BIS.options[BIS.selectedIndex].text;
		Day = Von.substr(3, 100).substr(0,2).replace(/\./, "");
		RetDay = Bis.substr(3, 100).substr(0,2).replace(/\./, "");
		len = Von.lastIndexOf(".") - 2;
		if(Von.substr(len,1) == ".") { len+=1; }
		month_1 = Von.substr(len,100).replace(/\./, "-");
		len = Bis.lastIndexOf(".") - 2;
		if(Bis.substr(len,1) == ".") { len+=1; }
		month_2 = Bis.substr(len,100).replace(/\./, "-");
		
		pax = parseInt(LERW.options[LERW.selectedIndex].value);
		pax_chd = parseInt(LKA1.options[LKA1.selectedIndex].value);
		pax_inf = parseInt(LKA2.options[LKA2.selectedIndex].value);
		tarif_klasse_value = tarif_klasse.options[tarif_klasse.selectedIndex].value
		if(onewayswitch[0].checked) {
			onewayswitch_value=0;
		}
		else {
			onewayswitch_value=1;
		}
		Url+='&from='+from+'&to='+to+'&Day='+Day+'&RetDay='+RetDay+'&month_1='+month_1+'\n&month_2='+month_2+'&pax='+pax+'&pax_chd='+pax_chd+'&pax_inf='+pax_inf+'&tarif_klasse='+tarif_klasse_value+'&onewayswitch='+onewayswitch_value;
		NewWindow =  Open_Window(Url,'', 'scrollbars=yes,toolbar=no,location=no,status=no,menubar=no,resizable=yes', 840 , 480);
	}
	else {
		Ra = parseInt(ERW.options[ERW.selectedIndex].value)
		if (KA1.selectedIndex != 0) Ra++
		if (KA2.selectedIndex != 0) Ra++
		RA.value=Ra
		
		Url='http://www.lmweb.net/scripts/lmplusi.dll?CFG=909k&AGENT=700378'
		Ab  = RW.options[RW.selectedIndex].value
		Von = VON.options[VON.selectedIndex].value
		Bis = BIS.options[BIS.selectedIndex].value
		Ka1 = KA1.options[KA1.selectedIndex].value
		Ka2 = KA2.options[KA2.selectedIndex].value
		Reisedauer = REISED.options[REISED.selectedIndex].value
		St = STERN.value
		if(Reisedauer == "1") {
			Url+='&LMIN=1&LMAX=3';
		}
		if(Reisedauer == "2") {
			Url+='&LMIN=4&LMAX=5';
		}
		if(Reisedauer == "3") {
			Url+='&LMIN=6&LMAX=8';
		}
		if(Reisedauer == "4") {
			Url+='&LMIN=9&LMAX=11';
		}
		if(Reisedauer == "5") {
			Url+='&LMIN=12&LMAX=15';
		}
		if(Reisedauer == "6") {
			Url+='&LMIN=16&LMAX=30';
		}
		if(PMIN.value) {
			Url+='&PMIN='+PMIN.value
		}
		if(PMAX.value) {
			Url+='&PMAX='+PMAX.value
		}
		if(SF[0].checked) {
			Url+='&SF=3'
		}
		else 
		
		if(SF[2].checked) {
			Url+='&SF=2'
		}
		else {
			Url+='&SF=1'
		}
		
		Url+='&RA='+ERW.options[ERW.selectedIndex].value
		Url+='&ZIEL='+ZIEL.options[ZIEL.selectedIndex].value
		Url+='&VON='+VON.options[VON.selectedIndex].value
		Url+='&BIS='+BIS.options[BIS.selectedIndex].value
		Url+='&VA='+VERF.options[VERF.selectedIndex].value
		Url+='&ZA='+ZIM.options[ZIM.selectedIndex].value
		if(St != "0") {
			Url+='&ST='+St;
		}
		if (Ka1 !=17) 	Url+='&KA1='+Ka1
		if (Ka2 !=17) 	Url+='&KA2='+Ka2
		if (Ab!= '-')     Url+='&RW='+Ab
		  
		 // alert(Url)   
		NewWindow =  Open_Window(Url,'hallo', 'scrollbars=yes,toolbar=no,location=no,status=no,menubar=no,resizable=yes', 640 , 480);
	}		
}
}
function Search1()
{
with (window.document.GO)
{


submit()
}
}
function SELECT_VON()
{
document.write("<select name='VON' id='VON' size=1  style=\"width: 110px; font-family: Arial,Helvetica,Geneva,Sans-serif,sans-serif; font-size: 9pt;\">")
for (var i=1; i<=100;i++)
{
	if(i == 3) { document.write('<option value='+i+' selected>'+GetDatum(i)+'') }
	else { document.write('<option value='+i+'>'+GetDatum(i)+'') }
}
document.write("</select>")
}
function SELECT_BIS()
{
document.write("<select name='BIS' id='BIS' size=1 style=\"width: 110px; font-family: Arial,Helvetica,Geneva,Sans-serif,sans-serif; font-size: 9pt;\">")
for (var i=4; i<=120;i++)
{
if (i==17) document.write('<option selected ');  else document.write('<option ');
document.write('value='+i+'>'+GetDatum(i)+'')
}
document.write('</select>')
}
function GetDatum(offset)
{
var time = new Date()
time.setTime( time.getTime()+offset*86400000)
return DatArray[time.getDay()]+' '+time.getDate()+'.'+(1+time.getMonth())+'.'+(2000+(time.getYear()%100))
}
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();
}
MM_reloadPage(true);


/* ##### kalender ##### */
function selected(cal, date) {
	for(var i=0; i<cal.sel.length; i++) {
		if( cal.sel.options[i].text == date) {
			cal.sel.options[i].selected = true;
		}
	}
	
	if (cal.dateClicked) {
    	cal.callCloseHandler();
	}
}

function closeHandler(cal) {
	cal.hide();
	cal.destroy();
	_dynarch_popupCalendar = null;
}

function showCalendar(id, format, showsTime, showsOtherMonths) {
  var el = document.getElementById(id);
  if (_dynarch_popupCalendar != null) {
    _dynarch_popupCalendar.hide();
  } else {
    var cal = new Calendar(1, null, selected, closeHandler);
    if (typeof showsTime == "string") {
      cal.showsTime = false;
      cal.time24 = (showsTime == "24");
    }
    if (showsOtherMonths) {
      cal.showsOtherMonths = true;
    }
    _dynarch_popupCalendar = cal;
    cal.setRange(2006, 2009);
    cal.create();
  }
  _dynarch_popupCalendar.setDateFormat(format);
  _dynarch_popupCalendar.parseDate(el.value);
  _dynarch_popupCalendar.sel = el;
  _dynarch_popupCalendar.showAtElement(el); 
  return false;
}

function changefly() {
	if(window.document.GO.SF[0].checked == true) {
		window.document.GO.RW.style.display = "none";
		window.document.GO.ZIEL.style.display = "none";
		window.document.GO.VERF.style.display = "none";
		document.getElementById('T_VERF').style.display = "none";
		document.getElementById('MINMAX').style.display = "none";
		document.getElementById('PERSONEN2').style.display ="none";
		document.getElementById('KIND1').style.display ="none";
		document.getElementById('KIND2').style.display ="none";
		
		window.document.GO.LRW.style.display = "";
		window.document.GO.FZIEL.style.display = "";
		window.document.GO.tarif_klasse.style.display = "";
		document.getElementById('T_KLASSE').style.display = "";
		document.getElementById('LMINMAX').style.display = "";
		document.getElementById('PERSONEN1').style.display ="";
		document.getElementById('KIND3').style.display ="";
		document.getElementById('KIND4').style.display ="";
		
		window.document.GO.REISED.disabled = true;
		window.document.GO.STERN.disabled = true;
		window.document.GO.ZIM.disabled = true;
		
	}
	else {
		window.document.GO.RW.style.display = "";
		window.document.GO.ZIEL.style.display = "";
		window.document.GO.VERF.style.display = "";
		document.getElementById('T_VERF').style.display = "";
		document.getElementById('MINMAX').style.display = "";
		document.getElementById('PERSONEN2').style.display ="";
		document.getElementById('KIND1').style.display ="";
		document.getElementById('KIND2').style.display ="";
		
		window.document.GO.LRW.style.display = "none";
		window.document.GO.FZIEL.style.display = "none";
		window.document.GO.tarif_klasse.style.display = "none";
		document.getElementById('T_KLASSE').style.display = "none";
		document.getElementById('LMINMAX').style.display = "none";
		document.getElementById('PERSONEN1').style.display ="none";
		document.getElementById('KIND3').style.display ="none";
		document.getElementById('KIND4').style.display ="none";
		
		window.document.GO.REISED.disabled = false;
		window.document.GO.STERN.disabled = false;
		window.document.GO.ZIM.disabled = false;
	}
}

function ChildChange(id) {
	LKA1VALUE = window.document.GO.LKA1.options[window.document.GO.LKA1.selectedIndex].value
	LKA2VALUE = window.document.GO.LKA2.options[window.document.GO.LKA2.selectedIndex].value
	if(id == "LKA1") {
		if(((document.GO.LERW.selectedIndex + 1) * 2) < LKA1VALUE){
			alert('pro Erwachsenen sind max. ist nur 2 Kinder erlaubt!');
		}
	}
	if(id == "LKA2") {
		if(((document.GO.LERW.selectedIndex + 1) * 2) < LKA2VALUE){
			alert('pro Erwachsenen sind max. ist nur 2 Kinder erlaubt! ');
		}
	}
}


