var Browser ='IE'; 
var Username = ""; 
var UserType = "IU1"; 
var User_Industry = "-"; 
var MyHotel = 0; 
var Mylocation = 0; 
var MyArray7 = new Array(); 
var MyArray8 = new Array(); 
var MyArray9 = new Array(); 
var MyArray10= new Array(); 
var MyArray11= new Array(); 
var MyArray13= new Array(); 
var MyArray14= new Array(); 
var MyArray15= new Array(); 
var Mon_Next1 = 0; 

if (navigator.appName == 'Netscape') {
	Browser='NS'
} 

MyArray7[0]="4"; 
MyArray8[0]="Best Western Paddington Court Hotel"; 
MyArray9[0]="HYD"; 

MyArray7[1]="4"; 
MyArray8[1]="Best Western Paddington Court Hotel"; 
MyArray9[1]="PAD"; 

MyArray7[2]="5"; 
MyArray8[2]="Best Western Paddington Extended Stay Suites"; 
MyArray9[2]="HYD"; 

MyArray7[3]="5"; 
MyArray8[3]="Best Western Paddington Extended Stay Suites"; 
MyArray9[3]="PAD"; 

MyArray7[4]="THH"; 
MyArray8[4]="Best Western Premier Shaftesbury Kensington"; 
MyArray9[4]="ECT"; 

MyArray7[5]="SHA"; 
MyArray8[5]="Best Western Premier Shaftesbury Piccadilly"; 
MyArray9[5]="TEST"; 

MyArray7[6]="SHHP"; 
MyArray8[6]="Clarion Collection Shaftesbury London Hyde Park"; 
MyArray9[6]="HYD"; 

MyArray7[7]="HH"; 
MyArray8[7]="Hogarth Hotel London Kensington"; 
MyArray9[7]="ECT"; 

MyArray7[8]="HH"; 
MyArray8[8]="Hogarth Hotel London Kensington"; 
MyArray9[8]="KNS"; 

MyArray7[9]="HH"; 
MyArray8[9]="Hogarth Hotel London Kensington"; 
MyArray9[9]="WSE"; 

MyArray7[10]="SHFP"; 
MyArray8[10]="Hyde Park Premier London Paddington"; 
MyArray9[10]="LGT"; 

MyArray7[11]="SHFP"; 
MyArray8[11]="Hyde Park Premier London Paddington"; 
MyArray9[11]="PAD"; 

MyArray7[12]="HYD"; 
MyArray8[12]="The Hyde Hotel Paddington"; 
MyArray9[12]="HYD"; 

MyArray7[13]="HYD"; 
MyArray8[13]="The Hyde Hotel Paddington"; 
MyArray9[13]="PAD"; 

MyArray7[14]="SHPP"; 
MyArray8[14]="The Shaftesbury Hyde Park Paddington"; 
MyArray9[14]="HYD"; 

MyArray7[15]="SHPP"; 
MyArray8[15]="The Shaftesbury Hyde Park Paddington"; 
MyArray9[15]="RGP"; 

MyArray7[16]="SHPP"; 
MyArray8[16]="The Shaftesbury Hyde Park Paddington"; 
MyArray9[16]="PAD"; 

MyArray7[17]="SHPP"; 
MyArray8[17]="The Shaftesbury Hyde Park Paddington"; 
MyArray9[17]="LGT"; 

MyArray7[18]="4ACC"; 
MyArray8[18]="TOP SECRET 4 STAR ACCOMODATION"; 
MyArray9[18]="CTY"; 

MyHotel=19; 

function DateFix() { 
	datein = new Date();

	document.form1.res_txt_Duration.selectedIndex=0; 
	document.form1.res_sel_check_in_Date.selectedIndex = Number(datein.getDate())-1; document.form1.res_Hid_check_in_Date.value = Number(datein.getDate()); 
	document.form1.res_sel_check_in_Month.selectedIndex = Number(datein.getMonth()); document.form1.res_Hid_check_in_Month.value = Number(datein.getMonth()); 
	Mon_Next1 = Number(datein.getMonth()) + 1; 
	document.form1.res_txt_check_in_Year.value = Number(datein.getYear()); 
	document.form1.res_Hid_check_in_Year.value = Number(datein.getYear()); 
	return true; 
} 

function Check_Dates_Range(val){ 
	St_Month = document.form1.res_sel_check_in_Month.options[document.form1.res_sel_check_in_Month.selectedIndex].value; 
	St_Date = document.form1.res_sel_check_in_Date.options[document.form1.res_sel_check_in_Date.selectedIndex].value; 
	St_Year = document.form1.res_txt_check_in_Year.options[document.form1.res_txt_check_in_Year.selectedIndex].value; 
	Search_Hotel(document.form1,val); 
} 

function asing_persones() { 
	document.form1.res_Hid_Persone.value = document.form1.res_txt_persone.options[document.form1.res_txt_persone.selectedIndex].value; 
} 

function asing_currency() { 
	document.form1.res_Hid_currency.value = document.form1.res_txt_currency.options[document.form1.res_txt_currency.selectedIndex].value; 
} 

/* function asing_hotel() { 
	document.form1.res_Hid_Hotel.value = document.form1.res_sel_hotel.options[document.form1.res_sel_hotel.selectedIndex].value; 
} */

function Search_Hotel(Doc,val){ 
	chd=chin_date(); 
	if(!chd){ //if02 
		alert('The Check in date should be after todays date'); 
		return false; 
	} 
	// j = document.form1.res_sel_hotel.selectedIndex; 
	
	if(document.form1.res_txt_Duration.options[document.form1.res_txt_Duration.selectedIndex].value > 365) { 
		alert('Duration cannot be greater than 365 days !'); 
		document.form1.res_txt_Duration.options[document.form1.res_txt_Duration.selectedIndex].value =1; 
	} 
	Fit_Gr = 1; 
	St_Month = document.form1.res_sel_check_in_Month.options[document.form1.res_sel_check_in_Month.selectedIndex].value; 
	St_Date = document.form1.res_sel_check_in_Date.options[document.form1.res_sel_check_in_Date.selectedIndex].value; 
	St_Year = document.form1.res_txt_check_in_Year.options[document.form1.res_txt_check_in_Year.selectedIndex].value; 
	Start_Date_Para = St_Date+"/"+St_Month+"/"+St_Year;
	End_Date_Para = 0; 
var checkinmonth_var=document.form1.res_sel_check_in_Month.options[document.form1.res_sel_check_in_Month.selectedIndex].value-1;

	var checkIn = new Date(St_Year , checkinmonth_var , St_Date); 
	
	var checkIn_time = checkIn.getTime(); 
	
	var checkOut_time = checkIn_time + (1000 * 60 * 60 * 24 * (document.form1.res_txt_Duration.options[document.form1.res_txt_Duration.selectedIndex].value)); 

	var checkOut = new Date(checkOut_time); 
	
	End_Date_Para = checkOut.getDate() + '/' + (checkOut.getMonth()+1) + '/' + checkOut.getFullYear();

	document.location='http://www.londonpremierhotels.com/index.php?option=reservation&task=search&dateCheckIn='+Start_Date_Para+'&dateCheckOut='+End_Date_Para+'&lstRooms=1&domain=www.londonhotelmarket.com';

	return 0;
} 

function checkYear(year) { 
	return (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) ? 1 : 0; 
} 

function adjustdate(form) { 
	if(form.res_txt_Duration.options[form.res_txt_Duration.selectedIndex].value < 365) { 
		datein = new Date(); 
		var inMonth = form.res_sel_check_in_Month.selectedIndex; 
		var feb_last=0; 
		
		if (Number(form.res_txt_check_in_Year.options[form.res_txt_check_in_Year.selectedIndex].value)<2000) {
			datein.setYear(form.res_txt_check_in_Year.options[form.res_txt_check_in_Year.selectedIndex].value); 
		} else { 
			datein.setYear(form.res_txt_check_in_Year.options[form.res_txt_check_in_Year.selectedIndex].value); 
		} 
		
		if(checkYear(form.res_txt_check_in_Year.options[form.res_txt_check_in_Year.selectedIndex].value)==1) { 
			feb_last=29; 
		} else { 
			feb_last=28; 
		} 
		
		if ((Number(form.res_sel_check_in_Month.selectedIndex)==1) && (Number(form.res_sel_check_in_Date.selectedIndex)>=feb_last)) { 
			datein.setMonth(inMonth); 
			datein.setDate(feb_last); 
			datein.setMonth(inMonth); 
		} else { 
			datein.setMonth(inMonth); 
			datein.setDate(form.res_sel_check_in_Date.selectedIndex +1); 
			datein.setMonth(inMonth); 
		} 
		
		var timein = datein.getTime(); 
		var timeout = timein + (1000 * 60 * 60 * 24 * (form.res_txt_Duration.options[form.res_txt_Duration.selectedIndex].value)); 
		dateout = new Date(); 
		dateout.setTime(timeout); 
		inMonth = datein.getMonth(); 
		
		var inDate = datein.getDate(); 
		form.res_sel_check_in_Date.selectedIndex=inDate-1; 
		form.res_sel_check_in_Month.selectedIndex=inMonth; 
	} 
	return 0; 
} 

function monthvalidation(month) { 
	m_month=Number(month)+1; 
	return false; 
} 

function currentday(value) { 
	if (value==1) { 
		now= new Date(); 
		now.setDate(document.form1.res_Hid_check_in_Date.value); 
		now.setMonth(document.form1.res_Hid_check_in_Month.value); 
		now.setYear(document.form1.res_Hid_check_in_Year.value); 
		
		var currenttime =now.getTime(); 
		dateout = new Date(); 
		
		var TESTCHIN ='TEXT'; 
		var outMonth = document.form1.res_sel_check_in_Month.selectedIndex; dateout.setDate(document.form1.res_sel_check_in_Date.selectedIndex +1); 
		dateout.setMonth(outMonth); 
		dateout.setYear(document.form1.res_txt_check_in_Year.value); 
		
		var timeout = dateout.getTime(); 
		if ((Number(timeout) < Number(currenttime))&&(value==3)) { 
			alert("Check in Date is less than the current date"); 
			DateFix(); 
			
			if (now.getYear()<2000 ) { 
				document.form1.res_txt_check_in_Year.value=1900+now.getYear(); 
			} else { 
				document.form1.res_txt_check_in_Year.value=now.getYear(); 
			} 
			
			adjustdate(document.form1); 
		} 
	} else { 
		now= new Date(); 
		document.form1.res_sel_check_in_Month.selectedIndex=now.getMonth(); 
		document.form1.res_sel_check_in_Date.selectedIndex=now.getDate()-1; 
		document.form1.res_txt_check_in_Year.value=1900+now.getYear(); 
	} 
	return true;
} 

function Check_Dates_Range(val){ 
	St_Month = document.form1.res_sel_check_in_Month.options[document.form1.res_sel_check_in_Month.selectedIndex].value; 
	St_Date = document.form1.res_sel_check_in_Date.options[document.form1.res_sel_check_in_Date.selectedIndex].value; 
	St_Year = document.form1.res_txt_check_in_Year.options[document.form1.res_txt_check_in_Year.selectedIndex].value; 
	Search_Hotel(document.form1,val); 
} 

function chin_date() { //fn01 
	now= new Date(); 

	Sys_year=now.getYear(); 
	Sys_month=now.getMonth(); 
	Sys_date=now.getDate(); Arv_date=document.form1.res_sel_check_in_Date.options[document.form1.res_sel_check_in_Date.selectedIndex].value; 
	Arv_month=document.form1.res_sel_check_in_Month.options[document.form1.res_sel_check_in_Month.selectedIndex].text; 
	Arv_year=document.form1.res_txt_check_in_Year.options[document.form1.res_txt_check_in_Year.selectedIndex].value; 
	Arvdate_full_01 =Arv_year+','+Arv_month+','+Arv_date; 
	Sysdate_full_01 =Sys_year+','+Sys_month+','+Sys_date; 
	Sysdate_full=new Date(Sysdate_full_01); 
	Arvdate_full=new Date(Arvdate_full_01); 
	Sysdate_full_time=Sysdate_full.getTime(); 
	Arvdate_full_time=Arvdate_full.getTime(); 
	
	if(Sysdate_full_time>Arvdate_full_time) { //if01 
		return false; 
	} else { 
		return true; 
	} //if01 
}//fn01 
