
var nav=navigator.appName;
var myindate = new Date();
var myoutdate = new Date();
//myindate = new Date(myindate.setDate(myindate.getDate()+10));
//myoutdate = new Date(myoutdate.setDate(myoutdate.getDate()+11));
myindate = new Date(myindate.setDate(myindate.getDate()+7));
myoutdate = new Date(myoutdate.setDate(myoutdate.getDate()+8));
var inmm 	= myindate.getMonth();
var indd 	= myindate.getDate();
var inyy 	= (nav=="Netscape")? myindate.getYear()+1900:myindate.getYear();
var outmm = myoutdate.getMonth();
var outdd = myoutdate.getDate();
var outyy = (nav=="Netscape")? myoutdate.getYear()+1900:myoutdate.getYear();
var dayimagepath="http://www.londonhotelsavings.com/hotels/";

function book_mark(){
	if (navigator.appName.indexOf('Microsoft')>-1){
		window.external.AddFavorite(document.location,document.title);
	}else{
		alert("Press &quot;Ctrl+D&quot; to Bookmark This Site");
	}
}

function EMailFriend() { 
	window.open("http://www.londonhotelsavings.com/ForwardToFriend.html","EMFF","width=510,height=210,scrollbars=no,resizable=no,status=no") 
	} 

function printPage(){
window.print();
}

function OpenCurrConv(){ 
Url="http://www.thisismoney.com/calculators/currency/ns3_currency.asp"; 
window.open(Url,'Curr','width=300,height=270,status=0,toolbar=0,menubar=0,scrollbars=0,top=300,left=300'); 
} 

var nav=navigator.appName;
var sw= 760;

function set_position(){
document.all["progress"].style.left=(sw-300)/2;
document.all["progress"].style.top=10;
document.all["progress"].style.visibility="visible";
}
function hide_preload(){
document.all["progress"].style.visibility="hidden";
}

function loadPricingFrame(m_hotel_code,m_hotel_name){
//alert('hi6');
m_url="http://www.londonhotelsavings.com/servlet/TravelStayNetwork.WebSiteSetup?Frame=RatesTable1&hotel_code="+m_hotel_code+"";
if (nav=="Netscape" && navigator.userAgent.indexOf("Netscape/7")==-1){
document.layers["PrFrame"].src=m_url;
document.layers["PrFrame"].left=document.images["PricingFrame"].x
document.layers["PrFrame"].top=document.images["PricingFrame"].y
document.layers["PrFrame"].visibility="show";
}else if (nav=="Netscape" && navigator.userAgent.indexOf("Netscape/7")>-1){
document.getElementById("PrFrame").src=m_url;
}else{
document.frames["PrFrame"].location.replace(m_url);
}

}

function test(){
alert('hi');
}


function set_default_date(){
document.frm1.cmbCheckInYear.options.length=0;
document.frm1.cmbCheckOutYear.options.length=0;
document.frm1.hidCurrYear.value=inyy;

for (a=0; a<5; a++){
with (document.frm1){
cmbCheckInYear.options[a]= new Option(inyy+a,inyy+a);
cmbCheckOutYear.options[a]= new Option(inyy+a,inyy+a);
}
}
if (inyy<2004){
return;
}
with (document.frm1){
cmbNoOfAdults.selectedIndex=0;
cmbCheckInMonth.selectedIndex		=	inmm;
cmbCheckInYear.selectedIndex			= inyy-inyy;
cmbCheckOutMonth.selectedIndex	= outmm;
cmbCheckOutYear.selectedIndex		= outyy-inyy;
cmbNoOfNights.selectedIndex				=	0;
}
document.images["inday"].src=""+dayimagepath+"dd"+(myindate.getDay())+".gif";
document.images["outday"].src=""+dayimagepath+"dd"+(myoutdate.getDay())+".gif";
setMonthDays("In");
setMonthDays("Out");
document.frm1.cmbCheckInDate.selectedIndex			= indd-1;
document.frm1.cmbCheckOutDate.selectedIndex		= outdd-1;

}


function setCheckOut(){
tmpInDate = new Date(document.frm1.cmbCheckInYear.options[document.frm1.cmbCheckInYear.selectedIndex].value,document.frm1.cmbCheckInMonth.options[document.frm1.cmbCheckInMonth.selectedIndex].value,document.frm1.cmbCheckInDate.options[document.frm1.cmbCheckInDate.selectedIndex].value,0,0,0,0);
document.images["inday"].src=""+dayimagepath+"dd"+(tmpInDate.getDay())+".gif";
noDays = Number(document.frm1.cmbNoOfNights.options[document.frm1.cmbNoOfNights.selectedIndex].value);
tmpOutDate = new Date(tmpInDate.setDate(tmpInDate.getDate()+noDays));
document.frm1.cmbCheckOutMonth.selectedIndex	= tmpOutDate.getMonth();
document.frm1.cmbCheckOutYear.selectedIndex		= ((nav=="Netscape")? tmpOutDate.getYear()+1900:tmpOutDate.getYear())-inyy;
setMonthDays("Out");
document.frm1.cmbCheckOutDate.selectedIndex		= tmpOutDate.getDate()-1;
document.images["outday"].src=""+dayimagepath+"dd"+(tmpOutDate.getDay())+".gif";
}

function setNights(){
tmpInDate = new Date(document.frm1.cmbCheckInYear.options[document.frm1.cmbCheckInYear.selectedIndex].value,document.frm1.cmbCheckInMonth.options[document.frm1.cmbCheckInMonth.selectedIndex].value,document.frm1.cmbCheckInDate.options[document.frm1.cmbCheckInDate.selectedIndex].value,0,0,0,0);
tmpOutDate = new Date(document.frm1.cmbCheckOutYear.options[document.frm1.cmbCheckOutYear.selectedIndex].value,document.frm1.cmbCheckOutMonth.options[document.frm1.cmbCheckOutMonth.selectedIndex].value,document.frm1.cmbCheckOutDate.options[document.frm1.cmbCheckOutDate.selectedIndex].value,0,0,0,0);
dateDifference = get_deference(tmpInDate,tmpOutDate);
document.images["outday"].src=""+dayimagepath+"dd"+(tmpOutDate.getDay())+".gif";
if (dateDifference<1 || dateDifference>15){
return;
}
if (dateDifference>0){
document.frm1.cmbNoOfNights.selectedIndex = dateDifference-1;
}
}

function maxdate(mm,yy){
if (mm==1){
if(yy%4==0){return 29;}else{return 28;}
}else if (mm==0 || mm==2 || mm==4 || mm==6 || mm==7 || mm==9 || mm==11){
return 31;
}else{
return 30;
}
}

function setMonthDays(name){
tmpmm	= document.frm1.elements["cmbCheck"+name+"Month"].options[document.frm1.elements["cmbCheck"+name+"Month"].selectedIndex].value;
tmpyy	= document.frm1.elements["cmbCheck"+name+"Year"].options[document.frm1.elements["cmbCheck"+name+"Year"].selectedIndex].value;
maxdays = maxdate(tmpmm,tmpyy);
selectedInd=document.frm1.elements["cmbCheck"+name+"Date"].selectedIndex; 
document.frm1.elements["cmbCheck"+name+"Date"].options.length=28;
toAdd=maxdays-28;
for (a=0; a<toAdd; a++){
document.frm1.elements["cmbCheck"+name+"Date"].options[document.frm1.elements["cmbCheck"+name+"Date"].options.length] = new Option(29+a,29+a);
}
new_lnth=document.frm1.elements["cmbCheck"+name+"Date"].options.length;
if (new_lnth<selectedInd+1){
document.frm1.elements["cmbCheck"+name+"Date"].selectedIndex=document.frm1.elements["cmbCheck"+name+"Date"].options.length-1;
}else{
document.frm1.elements["cmbCheck"+name+"Date"].selectedIndex=selectedInd;
}
}

function checkValues(hotcode){
tmpInDate = new Date(document.frm1.cmbCheckInYear.options[document.frm1.cmbCheckInYear.selectedIndex].value,document.frm1.cmbCheckInMonth.options[document.frm1.cmbCheckInMonth.selectedIndex].value,document.frm1.cmbCheckInDate.options[document.frm1.cmbCheckInDate.selectedIndex].value,0,0,0,0);
tmpOutDate = new Date(document.frm1.cmbCheckOutYear.options[document.frm1.cmbCheckOutYear.selectedIndex].value,document.frm1.cmbCheckOutMonth.options[document.frm1.cmbCheckOutMonth.selectedIndex].value,document.frm1.cmbCheckOutDate.options[document.frm1.cmbCheckOutDate.selectedIndex].value,0,0,0,0);
dateDifference = get_deference(tmpInDate,tmpOutDate);
noNights = document.frm1.cmbNoOfNights.options[document.frm1.cmbNoOfNights.selectedIndex].value;
today = new Date();
if ((today-tmpInDate)>86400000){
alert("Check in date can not be less than the system date");
set_default_date();
return;
}
if (dateDifference>document.frm1.cmbNoOfNights.options.length || dateDifference<1){
alert("Number of night(s) can not be grater than "+document.frm1.cmbNoOfNights.options.length+" or less than 1.\r\nPlease select again ...");
set_default_date();
return;
}else{
document.frm1.cmbNoOfNights.selectedIndex=dateDifference-1;
}

noOfRooms = document.frm1.cmbNoOfRooms.selectedIndex+1;
noOfAdults = document.frm1.cmbNoOfAdults.selectedIndex+1;

if(noOfRooms>noOfAdults){
alert("Number of adults is greater then the maximum no of adults for the rooms selected!");
return;
}

if (navigator.userAgent.indexOf("Netscape/7")>-1){
document.getElementById("progress1").style.visibility="visible";
}else{
document.all["progress1"].style.visibility="visible";
}


document.frm1.selAmenity.value='-';
document.frm1.selCategory.value='-';
document.frm1.HidStudNum.value='0'; 
document.frm1.HidRoomType.value='%'; 

document.frm1.selCategory.value='%';
document.frm1.selAmenity.value='%';
document.frm1.selLocation.value='%';
document.frm1.HidRoomType.value='%';
document.frm1.selGroup.value='%';
document.frm1.AffiliateMainPage.value='';
document.frm1.afftType.value='';

/*
mmurl='http://www.londonhotelsavings.com/servlet/LondonHotelSavings.ResevationSearch?param=SEARCH&AffiliateMainPage='+document.frm1.AffiliateMainPage.value+'&afftCode=RA&afftType='+document.frm1.afftType.value+'&cmbNoOfRooms='+document.frm1.cmbNoOfRooms.options[document.frm1.cmbNoOfRooms.selectedIndex].value+'&cmbNoOfAdults='+document.frm1.cmbNoOfAdults.options[document.frm1.cmbNoOfAdults.selectedIndex].value+'&cmbNoChi='+document.frm1.cmbNoChi.value+'&cmbNoOfNights='+document.frm1.cmbNoOfNights.options[document.frm1.cmbNoOfNights.selectedIndex].value+'&hidNbHood=-&hidTravelerType=-&startPriceRange=0&endPriceRange=999999&cmbCheckInDate='+document.frm1.cmbCheckInDate.options[document.frm1.cmbCheckInDate.selectedIndex].value+'&cmbCheckInMonth='+document.frm1.cmbCheckInMonth.options[document.frm1.cmbCheckInMonth.selectedIndex].value+'&cmbCheckInYear='+document.frm1.cmbCheckInYear.options[document.frm1.cmbCheckInYear.selectedIndex].value+'&cmbCheckOutDate='+document.frm1.cmbCheckOutDate.options[document.frm1.cmbCheckOutDate.selectedIndex].value+'&cmbCheckOutMonth='+document.frm1.cmbCheckOutMonth.options[document.frm1.cmbCheckOutMonth.selectedIndex].value+'&cmbCheckOutYear='+document.frm1.cmbCheckOutYear.options[document.frm1.cmbCheckOutYear.selectedIndex].value+'&hotelCode='+document.frm1.hotelCode.value+'&selAmenity='+escape(document.frm1.selAmenity.value)+'&selDiscount1=N&selDiscount2=N&maxpPrevalue=0&selLocation='+escape(document.frm1.selLocation.value)+'&engineType=HOTEL&HidRoomType='+escape(document.frm1.HidRoomType.value)+'&selGroup='+escape(document.frm1.selGroup.value)+'&selCategory='+escape(document.frm1.selCategory.value)+'&visitorInfo='+escape(document.frm1.visitorInfo.value)+'&language=en&country=US&browser=IE&showSimple=YES&filtBy=H';
*/
mmurl= 'http://www.londonhotelsavings.com/servlet/LondonHotelSavings.ResevationSearch?afCd=RA&afTy='+document.frm1.afftType.value+'&NoRm='+document.frm1.cmbNoOfRooms.options[document.frm1.cmbNoOfRooms.selectedIndex].value+'&NoAd='+document.frm1.cmbNoOfAdults.options[document.frm1.cmbNoOfAdults.selectedIndex].value+'&NoCh='+document.frm1.cmbNoChi.value+'&NoNgt='+document.frm1.cmbNoOfNights.options[document.frm1.cmbNoOfNights.selectedIndex].value+'&InDt='+document.frm1.cmbCheckInDate.options[document.frm1.cmbCheckInDate.selectedIndex].value+'&InMn='+document.frm1.cmbCheckInMonth.options[document.frm1.cmbCheckInMonth.selectedIndex].value+'&InYr='+document.frm1.cmbCheckInYear.options[document.frm1.cmbCheckInYear.selectedIndex].value+'&OtDt='+document.frm1.cmbCheckOutDate.options[document.frm1.cmbCheckOutDate.selectedIndex].value+'&OtMn='+document.frm1.cmbCheckOutMonth.options[document.frm1.cmbCheckOutMonth.selectedIndex].value+'&OtYr='+document.frm1.cmbCheckOutYear.options[document.frm1.cmbCheckOutYear.selectedIndex].value+'&htCd='+document.frm1.hotelCode.value+'&amty='+escape(document.frm1.selAmenity.value)+'&mxPv=0&Loc='+escape(document.frm1.selLocation.value)+'&rmty='+escape(document.frm1.HidRoomType.value)+'&grp='+escape(document.frm1.selGroup.value)+'&catg='+escape(document.frm1.selCategory.value)+'&vInf='+escape(document.frm1.visitorInfo.value)+'&language=en&country=US&browser=IE&shSp=YES&ftBy=H';

window.location=mmurl;
}


function get_deference(ind,oud){
ind_d = ind.getDate();
ind_m = ind.getMonth();
ind_y = ind.getYear();
oud_d = oud.getDate();
oud_m = oud.getMonth();
oud_y = oud.getYear();
ret_val=0;
		if (ind_y==oud_y){
				if (ind_m==oud_m){
				ret_val=oud_d-ind_d;
				}else{
				ret_val=(maxdate(ind_m,ind_y)-ind_d)+oud_d
				}
		}else{
				if (ind_m==11 && oud_m==0){
				ret_val=(maxdate(ind_m,ind_y)-ind_d)+oud_d
				}
		}
return ret_val;
}


var sw= 760;
var sWith=screen.width;
var toadd= 0;
if (sWith>800){
toadd = (sWith-800)/2;
}

function LoadCal(DateType,monthField,dayField,yearField,formName){
dayval=Number(document.forms[formName].elements[dayField].options[document.forms[formName].elements[dayField].selectedIndex].value);
monthval=Number(document.forms[formName].elements[monthField].options[document.forms[formName].elements[monthField].selectedIndex].value);
window.open("http://www.londonhotelsavings.com/loadDates.asp?DateType="+DateType+"&formName="+formName+"&DayField="+dayField+"&day="+dayval+"&MonthField="+monthField+"&month="+(Number(monthval)+1)+"&YearField=-&year=-","calwin","width=235,height=190,top=280,left=100,location=0,status=0");
}


