// JavaScript Document
<!--
var bgMemory;	// save color information
var fgMemory;
var 	statusinfo = false;

function option(){
	document.forms[0].action = 'aviscomplete1a46.html?izbira=1';
	document.forms[0].submit();
}

function openHelp(URL)
{
    win = window.open( URL , 'HELP', "width=400,height=345,resizable=yes,scrollbars=no,status=yes");
    win.focus();
}

function bzOver(cell, id, statustxt)
{
     
      
      cell.style.backgroundColor='#e6e6e6';
	if (typeof document.getElementById(id + "cc") == "object")
	{
		Elem = document.getElementById(id + "cc");
		bgMemory = Elem.style.backgroundColor;
		Elem.style.backgroundColor='#e6e6e6';
	}
	if (typeof document.getElementById(id + "l") == "object")
	{
		Elem = document.getElementById(id + "l");
		fgMemory = Elem.style.color;
		Elem.style.color='#3D6484';
	}
	
	return true;
}
function bzOut(cell, id)
{
     
      
      cell.style.backgroundColor='';
      window.status="";
	if (typeof document.getElementById(id) == "object")
	{
		Elem = document.getElementById(id + "cc");
		Elem.style.backgroundColor = bgMemory;
	}
	if (typeof document.getElementById(id + "l") == "object")
	{
		Elem = document.getElementById(id + "l");
		Elem.style.color = fgMemory;
	}
	
	return true;
}
function mClick(cell)
{
   if(event.srcElement.tagName=='TD')
   {
      cell.children.tags('A')[0].click();
   }
}

function prestej(numm){
//alert(numm);
if (numm<10)
		numm = '0' + numm;
	
return numm;
}

function Checkdate(Kateri) {
	var err=0
	if (Kateri=='ETAx'){
		a=prestej((document.forms[0].ETAMonth.selectedIndex + 1)) + '/' + prestej((document.forms[0].ETADay.selectedIndex + 1)) + '/' + document.forms[0].ETAYear.value;
	}
	if (Kateri=='ETT'){
		a=prestej(document.forms[0].ETTMonth.selectedIndex + 1) + '/' + prestej(document.forms[0].ETTDay.selectedIndex + 1) + '/' + document.forms[0].ETTYear.value;
	}
	//alert(Kateri)
	if (a.length != 10) err=1
	b = a.substring(0, 2)// month
	c = a.substring(2, 3)// '/'
	d = a.substring(3, 5)// day
	e = a.substring(5, 6)// '/'
	f = a.substring(6, 10)// year
	if (b<1 || b>12) err = 1
	if (d<1 || d>31) err = 1
	if (f<1900) err = 1
	if (b==4 || b==6 || b==9 || b==11){
		if (d==31) err=1
	}
	if (b==2){
		var g=parseInt(f/4)
		if (isNaN(g)) {
			err=1
		}
		if (d>29) err=1
		if (d==29 && ((f/4)!=parseInt(f/4))) err=1
	}
	if (err==1) {
		alert('Selected date does not exist. Please check the selected date!');
		return false
	}
	return true;	
}

var xILCChanged = false;
function copySTA2ILC() {
	if (xILCChanged == false) {
		document.forms[0].ILC.selectedIndex = document.forms[0].STA.selectedIndex;
	}
}

function setILCChanged() {
	xILCChanged = true;
}

function setindex() {
	
}
var opener_feld = "";

function getDate() {
	var datum = new Date();
	var h_jahr = datum.getFullYear();
	var h_monat = datum.getMonth()+1;
	var h_tag = datum.getDate();
	
	//alert(h_tag + "." + h_monat + "." + h_jahr);
}

// MIt Hilfe dieser Funktion wird das Datum an den Opener ALbermittlelt
function setOpenerDatum(tag, monat, jahr) {
	//alert("Tag: " + tag);
	document.forms[0].elements[opener_feld + "Day"].selectedIndex = (tag -1);
	document.forms[0].elements[opener_feld + "Month"].selectedIndex = (monat -1);
	document.forms[0].elements[opener_feld + "Year"].value = jahr
	//document.forms[0].elements[opener_feld].value = tag + "." + monat + "." + jahr;
}

function setCar(index) {
	//alert("Tag: " + tag);
	document.forms[0].GRP.selectedIndex = index ;
}

function openKalender(of, iCalendarPickerURL) {
	opener_feld = of;
	window.open(iCalendarPickerURL,'newCal', 'width=190,height=230,left=30,screenX=30,top=30,screenY=30,resizable=no');	
}

function openCars(url) {
	window.open(url,'Select_a_car_group', 'width=640,height=450,left=80,screenX=80,top=80,screenY=80,resizable=no,scrollbars=yes');	
}

function preveridatum(){
	if (document.forms[0].ETTYear.selectedIndex<document.forms[0].ETAYear.selectedIndex){
			document.forms[0].ETTYear.selectedIndex=document.forms[0].ETAYear.selectedIndex}
	
}
function FrontPage_Form1_Validator(theForm)
{

  if (theForm.STA.selectedIndex == 0)
  {
    alert("Please select Rental office.");
    theForm.STA.focus();
    return (false);
  }

  if (theForm.ILC.selectedIndex == 0)
  {
    alert("Please select Return office.");
    theForm.ILC.focus();
    return (false);
  }
    
    if (theForm.ILC.selectedIndex == 0)
  {
    alert("Please select Return office.");
    theForm.ILC.focus();
    return (false);
  }
    
    if (Checkdate('ETAx') == false)
  {
    alert("Please check the Date.");
    theForm.ETADay.focus();
    return (false);
  }
  
     if (Checkdate('ETT') == false)
  {
    alert("Please check the Date.");
    theForm.ETTDay.focus();
    return (false);
  }
  
  startdate = new Date(theForm.ETAYear.selectedIndex+2002, theForm.ETAMonth.selectedIndex, theForm.ETADay.selectedIndex+1, theForm.ETAHour.selectedIndex, theForm.ETAMinute.selectedIndex);
  enddate = new Date(theForm.ETTYear.selectedIndex+2002, theForm.ETTMonth.selectedIndex, theForm.ETTDay.selectedIndex+1, theForm.ETTHour.selectedIndex, theForm.ETTMinute.selectedIndex);
  
  if (startdate >= enddate)
  {
  alert("End Date must be greater then start Date.");
  return (false);
  }
 
 return (true);
}

// -->

<!-- START AVIS QUICK BOOKING
var xMonths = new Array( 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec' );

function getListValue( option_object  ){return option_object[ option_object.selectedIndex ].value;}

function setListValue( option_object, value  ){ option_object.selectedIndex = value;}

function init()
{
xToday = new Date();
xMonth = xToday.getMonth();
xDay = xToday.getDate()+1;
xYear = xToday.getYear()-2005; if (xYear < 2005) xYear=0;
  xF = document.forms['quickbooking'];
  setListValue( xF.ETAMonth, xMonth )
  setListValue( xF.ETADay, xDay )
  setListValue( xF.ETAYear, xYear )
  setListValue( xF.ETTMonth, xMonth )
  setListValue( xF.ETTDay, xDay+1)
  setListValue( xF.ETTYear, xYear )
}


function openhelp( hlpString )
{
    hlpWin = window.open( hlpString , 'Help', 'width=395,height=345,resizable=yes,scrollbars=yes,status=yes')
    hlpWin.focus();
}

function doContinue( )
{
xF = document.forms['quickbooking'];
xCountry = getListValue( xF.country );
xETADay = getListValue( xF.ETADay );
xETAMonth = getListValue( xF.ETAMonth );
xETAYear = getListValue( xF.ETAYear );
xETAHour = getListValue( xF.ETAHour );
xETAMinute = getListValue( xF.ETAMinute );
xETA = xETADay + xMonths[ parseInt( xETAMonth )-1 ] + xETAYear.substr(2,2) + '/' + xETAHour + xETAMinute;xETTDay = getListValue( xF.ETTDay );
xETTMonth = getListValue( xF.ETTMonth );
xETTYear = getListValue( xF.ETTYear );
xETTHour = getListValue( xF.ETTHour );
xETTMinute = getListValue( xF.ETTMinute );
xETT = xETTDay + xMonths[ parseInt( xETTMonth )-1 ] + xETTYear.substr(2,2) + '/' + xETTHour + xETTMinute;
xWizardNumber = '';
xName = '';
xParams = '&CTR=' + xCountry +'&Country=' + xCountry + '&ETA=' + xETA + '&ETT=' + xETT;
url = 'http://book.rent-at-avis.com/avisonline/ibe.nsf/PrefillX?OpenAgent&ResStep=ReservationStep1&IBEOwner=<?=aktivanJezik();?>&LNG=GB' + xParams;location.href = url;
}