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


var MINUTE = 60 * 1000
var HOUR = MINUTE * 60
var DAY = HOUR * 24
var WEEK = DAY * 7

function addDays(myDate,days) {
    days = parseInt(days);     
    var mDate = new Date(myDate);
    var dt = new Date(mDate.getTime() + days*DAY);     
    var st = (dt.getMonth()+1) + "/" + dt.getDate() + "/"  +  dt.getFullYear();     
    return st;     
}

function searchFamily()
{
	with (window.document.SUCH)
	{
		Ra = parseInt(RA.options[RA.selectedIndex].value);
		if (KA1.selectedIndex != 0) Ra++;
		if (KA2.selectedIndex != 0) Ra++;
			if (Ra >4)
			{
				alert("Es sind nur max. 4 Reisende möglich!");
				return;
			} 
		//if (R1[1].checked) Ra+=4;
		
//		RA.value=Ra;
		submit();
	}
}
function searchEPackage()
{
	with (window.document.SUCH)
	{
		Ra = parseInt(RA.options[RA.selectedIndex].value);
		if (KA1.selectedIndex != 0) Ra++;
		if (KA2.selectedIndex != 0) Ra++;
			if (Ra >4)
			{
				alert("Es sind nur max. 4 Reisende mæglich!");
				return;
			} 
		//if (R1[1].checked) Ra+=4;
		
//		RA.value=Ra;
		submit();
	}
}
function searchEPackageEx()
{
	with (window.document.SUCH)
	{
		Ra = parseInt(RA.value);
		if (KA1.value != 0) Ra++;
		if (KA2.value != 0) Ra++;
			if (Ra >4)
			{
				alert("Es sind nur max. 4 Reisende mæglich! Vorgang abgebrochen!");
				return;
			} 
		//if (R1[1].checked) Ra+=4;
		
//		RA.value=Ra;
		submit();
	}
}

function searchClub()
{
	with (window.document.SUCH)
	{
		Ra = parseInt(RA.options[RA.selectedIndex].value);
		if (KA1.selectedIndex != 0) Ra++;
		if (KA2.selectedIndex != 0) Ra++;
			if (Ra >4)
			{
				alert("Es sind nur max. 4 Reisende möglich!");
				return;
			} 
		//if (R1[1].checked) Ra+=4;
		// if (TrimStr(HOTEL.value) == "") HOTEL.value="CLUB";
//		RA.value=Ra;
		submit();
	}
}

function searchFamilyFly2()
{
with (window.document.SUCH)
{
Ra = parseInt(RA.options[RA.selectedIndex].value)
if (KA1.selectedIndex != 0) Ra++
if (KA2.selectedIndex != 0) Ra++
if (Ra >8)
{
	alert("Es sind nur max. 4 Reisende möglich!")
	return
} 
//RA.value=Ra
submit()
}
}

function searchFamilyFly()
{
	with (window.document.SUCH)
	{
		Ra = parseInt(RA.options[RA.selectedIndex].value);
		if (KA1.selectedIndex != 0) Ra++;
		if (KA2.selectedIndex != 0) Ra++;
			if (Ra >4)
			{
				alert("Es sind nur max. 4 Reisende möglich!");
				return;
			} 
		Ra+=4;
		
//		RA.value=Ra;
		submit();
	}
}

function Search()
{ with (window.document.SUCH)
{
Ra=1
if (R1[1].checked) Ra+=4

//RA.value=Ra
}
window.document.SUCH.submit()
}
function SELECT_VON()
{

document.write("<select class=\"input\" name='VON' size=1>")
document.write('<option value=1>'+GetDatum(1)+'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;')
for (var i=2; i<=100;i++)
{
document.write('<option value='+i+'>'+GetDatum(i)+'')
}
document.write("</select>")
}
function SELECT_BIS()
{
document.write("<select class=\"input\" name='BIS' size=1>")
for (var i=4; i<=120;i++)
{
if (i==22) document.write('<option selected ');  else document.write('<option ');
document.write('value='+i+'>'+GetDatum(i)+'')
}
document.write('</select>')
}
function SELECT_VONEX(nr)
{
document.write("<select class=\"input\" name='VON' size=1>")
document.write('<option value=1>'+GetDatum(1)+'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;')
for (var i=2; i<=nr;i++)
{
document.write('<option value='+i+'>'+GetDatum(i)+'')
}
document.write("</select>")
}
function SELECT_VONEXSMALL(nr)
{
document.write("<select class=\"input\" name='VON' size=1>")
document.write('<option value=1>'+GetDatum(1)+'&nbsp;&nbsp;')
for (var i=2; i<=nr;i++)
{
document.write('<option value='+i+'>'+GetDatum(i)+'')
}
document.write("</select>")
}
function SELECT_VONEXCUST(nr,classname)
{
document.write("<select class=\""+classname+"\" name='VON' size=1>")
document.write('<option value=1>'+GetDatum(1)+'&nbsp;&nbsp;')
for (var i=2; i<=nr;i++)
{
document.write('<option value='+i+'>'+GetDatum(i)+'')
}
document.write("</select>")
}
function SELECT_BIS()
{
	document.write("<select class=\"input\" name='BIS' size=1>")
	document.write('<option value=4>'+GetDatum(4)+'&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;')
	for (var i=5; i<=120;i++)
	{
		if (i==22) document.write('<option selected ');  else document.write('<option ');
		document.write('value='+i+'>'+GetDatum(i)+'')
	}
	document.write('</select>')
}
function SELECT_BISEX(nr)
{
	document.write("<select class=\"input\" name='BIS' size=1>")
	document.write('<option value=4>'+GetDatum(4)+'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;')
	for (var i=5; i<=nr;i++)
	{
		if (i==22) document.write('<option selected ');  else document.write('<option ');
		document.write('value='+i+'>'+GetDatum(i)+'')
	}
	document.write('</select>')
}
function SELECT_BISEXSMALL(nr)
{
	document.write("<select class=\"input\" name='BIS' size=1>")
	document.write('<option value=4>'+GetDatum(4)+'&nbsp;&nbsp;')
	for (var i=5; i<=nr;i++)
	{
		if (i==22) document.write('<option selected ');  else document.write('<option ');
		document.write('value='+i+'>'+GetDatum(i)+'')
	}
	document.write('</select>')
}

function SELECT_BISEXSMALL2(nr)
{

	document.write("<select class=\"input\" name='BIS' size=1>")
	document.write('<option value=2>'+GetDatum(2)+'&nbsp;&nbsp;')
	for (var i=3; i<=nr;i++)
	{
		document.write('<option ');
		document.write('value='+i+'>'+GetDatum(i)+'')
	}
	document.write('</select>')
}

function SELECT_BISEXCUST(nr,classname)
{
	document.write("<select class=\""+classname+"\" name='BIS' size=1>")
	document.write('<option value=4>'+GetDatum(4)+'&nbsp;&nbsp;')
	for (var i=5; i<=nr;i++)
	{
		if (i==22) 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)
    day = time.getDate();
    month = time.getMonth()+1;
    if (day   < 10)   day   = "0"+day;
    if (month < 10)   month = "0"+month;    
    return day+'.'+(month)+'.'+(time.getFullYear())+' - '+DatArray[time.getDay()];
}



function keyhandler(e)
{
	var code;
	if (!e) var e = window.event;
	if (e.keyCode) code = e.keyCode;
	else if (e.which) code = e.which;
	var character = String.fromCharCode(code);
	if (code==13) document.forms[0].submit();
}


function TrimStr(str){
   var tmp = ""
   var count = 0
   if (str!=null)
   {
	   var newArray = str.split(" ")
	   for (var i=0;i<newArray.length;i++){
		  if (newArray[i]!=""){
			 if (count == 0)
				tmp = newArray[i]
			 else
				tmp = tmp + " " + newArray[i]
			 count++
		  }
	   }
	   return tmp
	}
	return "";
}


function remainingDays()
{

today=new Date();
var endofyear=new Date(today.getFullYear(), 11, 31);
var one_day=1000*60*60*24;
var rdays;

//Calculate difference btw the two dates, and convert to days
rdays = Math.ceil((endofyear.getTime()-today.getTime())/(one_day));

return rdays;
}
