var thispath = "cis/hotels.nsf"; var deaddays = "5" //document.forms[0].DeadlineDays.value; var deadhours = "168" //document.forms[0].DeadlineHours.value; var limitdate = (parseInt(deadhours) )*60*60*1000; function valid() { var Cities; var Cityindex; var now = new Date(); var day = now.getDate(); var year = now.getFullYear(); var month = now.getMonth() +1; var msgflag; var Dobj; var Di; var Mobj; var Mi; //------------------------------------------------ msgflag = "false"; //limitdate = now.getTime() + 518400000; Dobj = document.forms[0].CheckInDay; Di = Dobj.selectedIndex Mobj = document.forms[0].CheckInMonth; Mi = Mobj.selectedIndex if (Mobj.options[ Mi ].value < month) year = year + 1; if ((Mobj.options[Mi].value == month) && (Dobj.options[Di].value < day)) year = year + 1; days = getDays( Mobj.options[Mi].value, year); if(Dobj.options[Di].value > days) { msgflag="true"; msg="Incorrect day for the month!"; Dobj.focus(); alert(msg); return false; } else if (Date.UTC(year, Mobj.options[Mi].value-1, Dobj.options[Di].value) < (now.valueOf() + limitdate)) { msgflag="true"; msg="There is not enough time left to process your booking! \n Please specify a date at least " + deaddays + " business days ahead of today."; Mobj.focus(); alert(msg); return false; } if (msgflag == "false") { if ( typeof( document.forms[0].AllCities) != "undefined" ) { Cities = document.forms[0].AllCities.options; Cityindex = Cities.selectedIndex; document.forms[0].City.value= Cities[Cityindex ].text; Countries = document.forms[0].Country.options; Countryindex = Countries.selectedIndex; document.forms[0].UserCountry.value= Countries[Countryindex].text; } if ( typeof( document.forms[0].OneCity) != "undefined" ) { Cities = document.forms[0].OneCity.options; Cityindex = Cities.selectedIndex; document.forms[0].City.value= Cities[Cityindex ].text; } var mediator = getCookie( "SashaHotels" ) if ( mediator == null ) { document.forms[0].AUNID.value = "" } else { document.forms[0].AUNID.value = mediator } mediator = getCookie( "SashaHotelsAF" ) if ( mediator == null ) { document.forms[0].AFFILIATEUNID.value = "" } else { document.forms[0].AFFILIATEUNID.value = mediator } mediator = getCookie( "SashaHotelsAG" ) if ( mediator == null ) { document.forms[0].AGENTUNID.value = "" } else { document.forms[0].AGENTUNID.value = mediator } document.forms[0].submit() } } function setDates() { var now = new Date(); var limitdate = now.getTime() +604800000; var day; var month; now.setTime(limitdate); day = now.getDate()-1; month = now.getMonth(); document.forms[0].CheckInDay.options[day].selected=true; document.forms[0].CheckInMonth.options[month].selected=true; } function afterSpecialLoading() { /* if ( typeof( document.forms[0].Country) != "undefined" ) { var CountryList = document.forms[0].Country.options; var CountrySize = CountryList.length -1; var country = document.forms[0].UserCountry.value; var CityList = document.forms[0].AllCities.options; for ( var i=0; i<=CountrySize; i++ ) { if (country == CountryList[i].text) { CountryList.selectedIndex = i; } } CityList.selectedIndex = 0; } */ if (document.images) { var img = document.images[3]; var img_alt = document.forms[0].P1Alt.value; img.alt = img_alt; } //=== to set a country if ( typeof( document.forms[0].Country) != "undefined" ) { var CountryList = document.forms[0].Country.options; var CountrySize = CountryList.length -1; var country = document.forms[0].UserCountry.value; var city = document.forms[0].City.value; var CityList = document.forms[0].AllCities.options; var CitySize = CityList.length -1; for ( var i=0; i<=CountrySize; i++ ) { if (country == CountryList[i].text) { CountryList.selectedIndex = i; } } var PairsList = document.forms[0].CountryCity.options; var PairsSize = PairsList.length -1; var EuroList = document.forms[0].MainCity.options; var EuroSize = EuroList.length -1; var CClist = document.forms[0].AllCities.options; var pairTXT; var pair; var nopt; if ( country != "All Countries" ) { CClist.length = 0; for ( var i=0; i<=PairsSize; i++ ) { pairTXT = PairsList[i].text; pair = pairTXT.split("="); if ( country == pair[0] ) { nopt = new Option( pair[1], pair[1], false, false ); CClist.length += 1; CClist[CClist.length - 1] = nopt; } } } var CitySize = CClist.length -1; for ( var i=0; i<=CitySize; i++ ) { if (city == CClist[i].text) { CClist.selectedIndex = i; } } } } function afterLoading() //==================== { if (document.forms[0].AUNID.value !="" ) { setCookie ( "SashaHotels", document.forms[0].AUNID.value, inTwoDays ) } if (document.forms[0].AGENTUNID.value !="" ) { setCookie ( "SashaHotelsAG", document.forms[0].AGENTUNID.value, inTwoDays ) } if (document.forms[0].AFFILIATEUNID.value !="" ) { setCookie ( "SashaHotelsAF", document.forms[0].AFFILIATEUNID.value, inTwoDays ) } //document.images("TGuide").alt="Allrussianhotels' Travel Guide — " + document.forms[0].PROMOTEUR.value; document.images("ATransfer").alt="Allrussianhotels' Airport Transfer — " + document.forms[0].PROMOTEUR.value; document.images("TGroup").alt="Allrussianhotels' Savings — " + document.forms[0].PROMOTEUR.value; //=== to set a country if ( typeof( document.forms[0].Country) != "undefined" ) { var CountryList = document.forms[0].Country.options; var CountrySize = CountryList.length -1; var country = document.forms[0].UserCountry.value; var city = document.forms[0].City.value; var CityList = document.forms[0].AllCities.options; var CitySize = CityList.length -1; for ( var i=0; i<=CountrySize; i++ ) { if (country == CountryList[i].text) { CountryList.selectedIndex = i; } } var PairsList = document.forms[0].CountryCity.options; var PairsSize = PairsList.length -1; var EuroList = document.forms[0].MainCity.options; var EuroSize = EuroList.length -1; var CClist = document.forms[0].AllCities.options; var pairTXT; var pair; var nopt; if ( country != "All Countries" ) { CClist.length = 0; for ( var i=0; i<=PairsSize; i++ ) { pairTXT = PairsList[i].text; pair = pairTXT.split("="); if ( country == pair[0] ) { nopt = new Option( pair[1], pair[1], false, false ); CClist.length += 1; CClist[CClist.length - 1] = nopt; } } } var CitySize = CClist.length -1; for ( var i=0; i<=CitySize; i++ ) { if (city == CClist[i].text) { CClist.selectedIndex = i; } } } } function afterChanging() //--------------------------------------- { var CountryList = document.forms[0].Country.options; var CountrySelected = CountryList.selectedIndex; var country = CountryList[CountrySelected].text; var PairsList = document.forms[0].CountryCity.options; var PairsSize = PairsList.length -1; var EuroList = document.forms[0].MainCity.options; var EuroSize = EuroList.length -1; var CClist = document.forms[0].AllCities.options; var TopList = new Array( "Moscow", "St.-Petersburg" ); var FullList = new Array( ); var FinalList; var pairTXT; var pair; var nopt; CClist.length = 0; switch ( country ) { case "All Countries": for ( var i=0; i<=PairsSize; i++ ) { pairTXT = PairsList[i].text; pair = pairTXT.split("="); FullList.push(pair[1]); } FullList.sort(); FinalList = TopList.concat( FullList ); for ( var i=0; i < FinalList.length; i++ ) { nopt = new Option( FinalList[i], FinalList[i], false, false ); CClist.length += 1; CClist[CClist.length - 1] = nopt; } break; case "Russia": for ( var i=0; i<=PairsSize; i++ ) { pairTXT = PairsList[i].text; pair = pairTXT.split("="); if ( country == pair[0] ) { FullList.push(pair[1]); } } FullList.sort(); FinalList = TopList.concat( FullList ); for ( var i=0; i < FinalList.length; i++ ) { nopt = new Option( FinalList[i], FinalList[i], false, false ); CClist.length += 1; CClist[CClist.length - 1] = nopt; } break; default: for ( var i=0; i<=PairsSize; i++ ) { pairTXT = PairsList[i].text; pair = pairTXT.split("="); if ( country == pair[0] ) { nopt = new Option( pair[1], pair[1], false, false ); CClist.length += 1; CClist[CClist.length - 1] = nopt; } } } if (CClist.length > 0 ) { CClist.selectedIndex = 0; } }