var nava = (document.layers);
	var dom = (document.getElementById);
	var iex = (document.all);
	
	if (nava) { 
		cach = document.cache 
	} else if (dom) {
		cach = document.getElementById("cache").style 
	} else if (iex) {
		cach = cache.style
	}
	
	largeur = screen.width;
	cach.left = Math.round((largeur/2)-200);
	cach.visibility = "hidden";
function update_ara(ara)	{
		if (document.CVForm.ara.value != "")	{	
		document.CVForm.ara.value=ara;
		//alert(document.searchFlight.ara.value);
		}
		else {
		document.CVForm.ara.selectedIndex=0;
		}	
	}
	
	





function PresetDates() {
	ready = 0;
	if (document) {
		if (document.CVForm) {
			if (document.CVForm.deptDate_year) {
				ready = 1;
			}
		}
	}
	if (ready == 0) {
		setTimeout("PresetDates()",1000);
	} else {
		if (document.CVForm.deptDate_year.value != 0) {
			return;
		}
		d = new Date(new Date().valueOf()+86400000);
		d1 = d.getDate();
		d2 = d.getMonth();
		d3 = d.getFullYear();
		
		document.CVForm.arrDate_day.selectedIndex = d1;
		document.CVForm.arrDate_mon.selectedIndex=d2+1;
		document.CVForm.arrDate_year.value = d3;

	
		
		d = new Date(new Date().valueOf()+ 172800000);
		d1x = d.getDate();
		d2x = d.getMonth();
		d3x = d.getFullYear();
	
		document.CVForm.deptDate_day.selectedIndex = d1x;
		document.CVForm.deptDate_mon.selectedIndex = d2x+1;
		document.CVForm.deptDate_year.value = d3x;
			
	}
}

setTimeout("PresetDates()",1000);

function DoSearchAvail() {


  i = document.CVForm.arrDate_day;
  j = i.options[i.selectedIndex].value;
  if (j == 0) {
    alert ('Check In Day is a required field');
    i.focus();
    return;
  }

  i = document.CVForm.arrDate_mon;
  j = i.options[i.selectedIndex].value;
  if (j == 0) {
    alert ('Check In Month is a required field');
    i.focus();
    return;
  }
  
   nereye_ulke = window.document.CVForm.nereye_ulke.selectedIndex;
if (nereye_ulke == 0) {
    alert ('City and Destinations are required');
    i.focus();
    return;
  }

  i = document.CVForm.arrDate_year;
  j = i.options[i.selectedIndex].value;
  if (j == 0) {
    alert ('Check In Year is a required field');
    i.focus();
    return;
  }

  iid = document.CVForm.arrDate_day;
  iim = document.CVForm.arrDate_mon;
  iiy = document.CVForm.arrDate_year;
  jjd = iid.options[iid.selectedIndex].value;
  jjm = iim.options[iim.selectedIndex].value;
  jjy = iiy.options[iiy.selectedIndex].value;
  if ((jjm == 1) || (jjm == 3) || (jjm == 5) || (jjm == 7) || (jjm == 8) || (jjm == 10) || (jjm == 12)) {
    jjdm = 31;
  }
  if ((jjm == 4) || (jjm == 6) || (jjm == 9) || (jjm == 11)) {
    jjdm = 30;
  }
  if (jjm == 2) {
    jjdm = 28;
    if ((jjy % 4) == 0) {
      jjdm = 29;
      if ((jjy % 100) == 0) {
        jjdm = 28;
        if ((jjy % 400) == 0) {
          jjdm = 29;
        }
      }
    }
  }
  if (jjd > jjdm) {
    alert('Check In Date must be a valid date');
    iid.focus();
    return;
  }
 bugun = new Date();
	  			yil = bugun.getYear();
	  			ay  = bugun.getMonth();
	  			gun = bugun.getDate();
	  			bugun = new Date();
  xx1 = new Date(jjy,jjm-1,jjd,0,0,0);

  xx3 = new Date(yil,ay,gun,0,0,0);
  if (xx1 < xx3) {
  	alert('Check In Date must be at least today');
    return;
  }

  i = document.CVForm.deptDate_day;
  j = i.options[i.selectedIndex].value;
  if (j == 0) {
    alert ('Check Out Day is a required field');
    i.focus();
    return;
  }


  i = document.CVForm.deptDate_mon;
  j = i.options[i.selectedIndex].value;
  if (j == 0) {
    alert ('Check Out Month is a required field');
    i.focus();
    return;
  }

  i = document.CVForm.deptDate_year;
  j = i.options[i.selectedIndex].value;
  if (j == 0) {
    alert ('Check Out Year is a required field');
    i.focus();
    return;
  }

  iid = document.CVForm.deptDate_day;
  iim = document.CVForm.deptDate_mon;
  iiy = document.CVForm.deptDate_year;
  jjd = iid.options[iid.selectedIndex].value;
  jjm = iim.options[iim.selectedIndex].value;
  jjy = iiy.options[iiy.selectedIndex].value;
  if ((jjm == 1) || (jjm == 3) || (jjm == 5) || (jjm == 7) || (jjm == 8) || (jjm == 10) || (jjm == 12)) {
    jjdm = 31;
  }
  if ((jjm == 4) || (jjm == 6) || (jjm == 9) || (jjm == 11)) {
    jjdm = 30;
  }
  if (jjm == 2) {
    jjdm = 28;
    if ((jjy % 4) == 0) {
      jjdm = 29;
      if ((jjy % 100) == 0) {
        jjdm = 28;
        if ((jjy % 400) == 0) {
          jjdm = 29;
        }
      }
    }
  }
  if (jjd > jjdm) {
    alert('Check Out Date must be a valid date');
    iid.focus();
    return;
  }
  xx2 = new Date(jjy,jjm-1,jjd,0,0,0);

  xx4 = new Date(2006,4,7,0,0,0);
  if (xx2 < xx4) {
  	alert('Check Out Date must be at least tomorrow');
    return;
  }

  jjmm = iim.options[iim.selectedIndex].text;

  if (xx2 <= xx1) {
  	alert('Check Out Date must be later than Check In Date');
    return;
  }

  xx3 = new Date(2006,4,6,0,0,0);
  dd3 = (xx1 - xx3)/86400000;
  dd3 = Math.round(dd3);

  if (dd3 <= 2) {
    brk = String.fromCharCode(13)+String.fromCharCode(10);
    if(confirm('LAST MINUTE WARNING'+brk+brk+'Do you really want to check in within the next 2 days ?') == false) {
      return;
    }
  }

  dd3 = (xx2 - xx1)/86400000;
  dd3 = Math.round(dd3);
  
  if (dd3 >= 31) {
    brk = String.fromCharCode(13)+String.fromCharCode(10);
    alert ('Are you really asking for a stay of '+dd3+' days ?  You are allowed to book only for 30 days, for long stay please call us.');
      return;
  }

 /* xx3 = new Date(2008,4,6,0,0,0);
  if ((xx1 >= xx3) || (xx2 > xx3)) {
   alert ('Are you sure you want to search availability for '+jjmm+' '+jjy+' ');
      return;
  }*/

  

  if (document.CVForm.xavailonlinegeoid.type != 'hidden') {
    i = document.CVForm.xavailonlinegeoid.options[document.CVForm.xavailonlinegeoid.selectedIndex].value;
    if (i < 0) {
      document.CVForm.xavailonlinewebid.value = (0-i);
    } else {
      document.CVForm.xavailonlinewebid.value = 7;
    }    	
  }
if(document.CVForm.action=="../") {
	document.CVForm.action = '../htl_result.php';
} else {
document.CVForm.action = 'htl_result.php';
}
  document.CVForm.submit();
		cach.visibility = "visible";

}
	

	 

	function DvzGoster(){
		BlockDvz.style.display = "block";
		BlockButton.style.display = "block";
		BlockProm.style.display = "block";
		BlockKP.style.display = "none";
		BlockBook.style.display = "none";
		
		tdDvz.style.backgroundColor = "#FF6600";
		tdKP.style.backgroundColor = "#21136F";
		tdBook.style.backgroundColor = "#21136F";

		
		tdDvz.style.borderBottom = "";
		tdKP.style.borderBottom = "1px solid #000000";
		tdBook.style.borderBottom = "1px solid #000000";

		
	}
	function KPGoster(){
		//BlockDvz.style.display = "block";
		//BlockButton.style.display = "block";
	//	BlockBook.style.display = "none";
		if(BlockKP.style.display=="block") {
					BlockKP.style.display = "none";
		} else {
		BlockKP.style.display = "block";
		}
		//BlockProm.style.display = "none";
		
		/*tdDvz.style.backgroundColor = "#21136F";
		tdBook.style.backgroundColor = "#21136F";
		tdKP.style.backgroundColor = "#FF6600";
		
		tdKP.style.borderBottom = "";
		tdBook.style.borderBottom = "1px solid #000000";
		tdDvz.style.borderBottom = "1px solid #000000";
		*/
	}
	
	function BookGoster(){
		BlockBook.style.display = "block";
		BlockDvz.style.display = "none";
		BlockKP.style.display = "none";
		BlockButton.style.display = "none";
		BlockProm.style.display = "none";
		
		tdBook.style.backgroundColor = "#FF6600";
		tdDvz.style.backgroundColor = "#21136F";
		tdKP.style.backgroundColor = "#21136F";
				
		tdBook.style.borderBottom = "";
		tdKP.style.borderBottom = "1px solid #000000";
		tdDvz.style.borderBottom = "1px solid #000000";
	}	

	
	
