var timernames = new Array();
function TTBookSubmit(step, sitting, book_date, covers, room, id, timeslot){
if(step==0) {
$('bookstatus').style.display = 'none';
$('bookobjecttime').style.display = 'none';
$('bookobject').style.display = 'block';
}
if(step==1) {
var url = '/wayntravels.html?wci=ttbook&step=' + step + '&sitting=' + $('ttbook_radio').value + '&ttbook_date=' + $('ttbook_date').value + '&ttcovers=' + $('ttcovers').value + '&ttroom=' + $('ttroom').value + '&ttid=' + $('ttid').value;
}
if(step==2) {
var url = '/wayntravels.html?wci=ttbook&step=' + step + '&sitting=' + sitting + '&ttbook_date=' + book_date + '&ttcovers=' + covers + '&ttroom=' + room + '&ttid=' + id + '&timeslot=' + timeslot;
}
if(step==3) {
var url = '/wayntravels.html?wci=ttbook&step=' + step + '&sitting=' + sitting + '&ttbook_date=' + book_date + '&ttcovers=' + covers + '&ttroom=' + room + '&ttid=' + id + '&timeslot=' + timeslot + '&ttname=' + $('ttname').value + '&ttsurname=' + $('ttsurname').value + '&ttemail=' + $('ttemail').value + '&ttphone=' + $('ttphone').value;
if($('ttname').value == ''){
alert('Field "Name" is required.');
$('ttname').focus();
return;
}
if($('ttsurname').value == ''){
alert('Field "Surname" is required.');
$('ttsurname').focus();
return;
}
if($('ttemail').value == ''){
alert('Field "E-mail" is required.');
$('ttemail').focus();
return;
}
if($('ttphone').value == ''){
alert('Field "Phone" is required.');
$('ttphone').focus();
return;
}
}
if(step!=0) {
$('bookstatus').style.display = 'block';
try{
xmlRequest = newXMLobject();
xmlRequest.open("GET", url, true);
xmlRequest.onreadystatechange = function(){
if(xmlRequest.readyState==4){
if (xmlRequest.status != 200) {
msgBox('error','Sorry we\'re unable to update content. Please try again later (2-'+xmlRequest.status+').');
return;
}
var responseHTML = xmlRequest.responseText;
if(step==1){
$('bookobject').style.display = 'none';
$('bookstatus').style.display = 'none';
$('bookobjecttime').innerHTML = responseHTML;
$('bookobjecttime').style.display = 'block';
} else {
$('bookobject').innerHTML = responseHTML;
$('bookstatus').style.display = 'none';
$('bookobject').style.display = 'block';
$('bookobjecttime').style.display = 'none';
}
}
}
xmlRequest.send(null);
} catch(err) {
alert('smartxml:'+err);
}
}
}
// used in few boxes - stays here
function APISearch(searchtype,contentPage){
// TT basic form
if(searchtype==1){
var location_id = $('sel_location').value;
var ambience_id = $('sel_ambience').value;
var cuisine_id = $('sel_cuisine').value;
var price_id = $('sel_price').value;
var search_where = $('search_where').value;
var url = "/wayntravels.html?wci=ttsearch&searchtype=1&location_id=" + location_id + "&ambience_id=" + ambience_id + "&cuisine_id=" + cuisine_id + "&price_id=" + price_id + "&search_where=" + search_where+"&searchBoxTracker="+contentPage;
document.restaurants.action = url;
var objform = document.restaurants;
}
// TT advanced form 'search'
if(searchtype==2){
var searchstring = $('txtsearch').value;
var searchsubtype = $Radio('searchform','searchform_radio');
if(searchsubtype==null){
searchsubtype = 'name';
}
var url = "/wayntravels.html?wci=ttsearch&searchtype=2&searchstring=" + searchstring + "&searchsubtype=" + searchsubtype+"&searchBoxTracker="+contentPage
if(searchstring != ''){
document.restaurants.action = url;
var objform = document.restaurants;
} else {
msgBox('warning','Sorry, please could you enter something into the quick search box.');
return;
}
}
// TT advanced form 'finder'
if(searchtype==3){
var url = "/wayntravels.html?wci=ttsearch&searchtype=3"
var location_id = $('adv_location').value;
url = url + "&location_id=" + location_id;
var ambience_id = $('adv_ambience').value;
url = url + "&ambience_id=" + ambience_id;
var cuisine_id = $('adv_cuisine').value;
url = url + "&cuisine_id=" + cuisine_id;
var price_id = $('adv_price').value;
url = url + "&price_id=" + price_id;
var sitting_type = $Radio('finder','finder_radio');
url = url + "&sitting_type=" + sitting_type;
var selmonth = $('month').value;
url = url + "&selmonth=" + selmonth;
var selday = $('day').value;
url = url + "&selday=" + selday;
var special_only = $('special_only').checked;
url = url + "&special_only=" + special_only;
var search_where = $('search_where').value;
url = url + "&search_where=" + search_where;
document.restaurants.action = url+"&searchBoxTracker="+contentPage;
var objform = document.restaurants;
}
// HW basic form
if(searchtype==4){
if($('HostelsDate').value == ''){
var arr = $('HostelsDateInput').value.split('/');
$('HostelsDate').value = arr[2]+'-'+arr[1]+'-'+arr[0];
}
if($('HostelsDateEnd').value == ''){
var arr = $('HostelsDateEndInput').value.split('/');
$('HostelsDateEnd').value = arr[2]+'-'+arr[1]+'-'+arr[0];
}
var dStart = $('HostelsDate').value.split('-');
var dEnd = $('HostelsDateEnd').value.split('-');
$('hostels_days').value = (Date.parse(dEnd[0]+'/'+dEnd[1]+'/'+dEnd[2]) - Date.parse(dStart[0]+'/'+dStart[1]+'/'+dStart[2]))/86400000;
var fromToday = (Date.parse(dStart[0]+'/'+dStart[1]+'/'+dStart[2]) - new Date())/86400000;
if ($('hostels_countries').options[$('hostels_countries').selectedIndex].text == 'Choose a country'){
msgBox('warning','Please select a country');
return;
}
if ($('hostels_destination').options[$('hostels_destination').selectedIndex].text == 'Choose a city'){
msgBox('warning','Please select a city');
return;
}
if ($('HostelsDate').value == ''){
msgBox('warning','Please enter a valid check in date');
return;
}
var url = "wayntravels.html?wci=ttsearch&searchtype=4"
url = url + "&countryname=" + $('hostels_countries').options[$('hostels_countries').selectedIndex].text;
url = url + "&hostels_destination=" + $('hostels_destination').options[$('hostels_destination').selectedIndex].text;
url = url + "&hostels_countries=" + $('hostels_countries').value;
url = url + "&hostels_days=" + $('hostels_days').value;
url = url + "&HostelsDate=" + $('HostelsDate').value;
document.accomodation.action = url;
var objform = document.accomodation;
if(fromToday>330){
alert('Bookings cannot be made more than 11 months in advance. Please review your check-in date.');
return;
}
if(fromToday<1){
alert('Please revise your selection. You must use a future date for a new check-in.');
return;
}
if($('hostels_days').value<1){
alert('Please enter a check-out date which occurs after the check-in date.');
return;
}
if($('hostels_days').value>14){
alert('Please revise your reservation dates. The number of nights should not exceed 14.');
return;
}
}
// WCT basic form
if(searchtype==5){
var children_age = '';
if($('HotelsDate').value == ''){
var arr = $('HotelsDateInput').value.split('/');
$('HotelsDate').value = arr[2]+'-'+arr[1]+'-'+arr[0];
}
if($('HotelsDateEnd').value == ''){
var arr = $('HotelsDateEndInput').value.split('/');
$('HotelsDateEnd').value = arr[2]+'-'+arr[1]+'-'+arr[0];
}
var dStart = $('HotelsDate').value.split('-');
var dEnd = $('HotelsDateEnd').value.split('-');
$('hotels_days').value = (Date.parse(dEnd[0]+'/'+dEnd[1]+'/'+dEnd[2]) - Date.parse(dStart[0]+'/'+dStart[1]+'/'+dStart[2]))/86400000;
var fromToday = (Date.parse(dStart[0]+'/'+dStart[1]+'/'+dStart[2]) - new Date())/86400000;
if($('hotels_destination_hint').value == ''){
msgBox('warning','Please select a destination');
return;
}
if($('HotelsDateInput').value == ''){
msgBox('warning','Please enter a valid check in date');
return;
}
if($('hotels_rooms').value == ''){
$('hotels_rooms').value = '1';
}
if($('hotels_adults').value == ''){
$('hotels_adults').value = '1';
}
for (var i = 1; i <= 4; i++ ){
children_age = children_age + $('wct_child_' + i).value;
if(i < 4) {
children_age = children_age + ',';
}
}
var url = "/wayntravels.html?wci=ttsearch&searchtype=5";
url = url + "&hotels_destination=" + $('hotels_destination_hint').value.split(/\,/)[0];
url = url + "&hotels_countries=" + $('hotels_destination_hint_key').value.split(/\,/)[0];
url = url + "&hotels_days=" + $('hotels_days').value;
url = url + "&HotelsDate=" + $('HotelsDate').value;
url = url + "&hotels_rooms=" + $('hotels_rooms').value;
url = url + "&hotels_adults=" + $('hotels_adults').value;
url = url + "&hotels_children=" + $('hotels_children').value;
url = url + "&hotels_children_age=" + children_age;
url = url + "&city_key=" + $('hotels_destination_hint_key').value.split(/\,/)[1];
url = url + "&town_key=" + $('hotels_destination_hint_key').value.split(/\,/)[2];
url = url + "&sort=price";
document.accomodation.action = url;
var objform = document.accomodation;
if(fromToday>330){
alert('Bookings cannot be made more than 11 months in advance. Please review your check-in date.');
return;
}
if(fromToday<1){
alert('Please revise your selection. You must use a future date for a new check-in.');
return;
}
if($('hotels_days').value<1){
alert('Please enter a check-out date which occurs after the check-in date.');
return;
}
}
// Nightlife search
if(searchtype==6){
if($('sel_country').selectedIndex==0){
msgBox('warning','Please choose a country.');
return;
}
var selected_country = $('sel_country').selectedIndex;
if (selected_country == 0){
alert('Please select a country');
return;
}
var url = "/wayntravels.html?wci=ttsearch&searchtype=6";
var city_key = 0;
var town_key = 0;
url = url + "&country_code=" + $('sel_country').value;
try {
city_key = $('sel_town').value.split(/\|/)[0];
town_key = $('sel_town').value.split(/\|/)[1];
if(city_key > 0){
url = url + "&city_name=" + $('sel_town').options[$('sel_town').selectedIndex].text;
url = url + "&city_key=" + city_key;
url = url + "&town_key=" + town_key;
}
var neighborhood = $('sel_neighborhood').value.split(/\|/)[2];
if(neighborhood == null){neighborhood='0'}
url = url + "&neighborhood=" + neighborhood;
if($('sel_category').value != '0') {
url = url + "&category=" + $('sel_category').value;
}
} catch(e){}
document.nightlife.action = url;
var objform = document.nightlife;
}
document.cookie='searchtype='+searchtype+';expires=1h';
objform.submit();
WAYN.Popup.showLoader();
}
function onErrLoadPic(img, path){
img.onerror = '';
img.src = path;
}
function SearchNightlife(){
var wherekey = $('search_nightlife_key').value;
var URLSearchNightlife = '/wayntravels.html?wci=home&wce=getneighborhood&selection=' + wherekey.split(/\,/)[1];
try{
xmlRequest = new Ajax.Request ( URLSearchNightlife,
{
method : 'GET',
onSuccess : function ( xmlRequestRespond ) {
responseXml = xmlRequestRespond.responseXML;
for (var i = responseXml.firstChild; i != null; i = i.nextSibling) {
for (var j = i.firstChild; j != null; j = j.nextSibling) {
if(j.nodeValue != null && j.nodeValue != ''){
$('h_neighborhood').innerHTML = j.nodeValue;
}
}
}
},
onFailure : function ( xmlRequestRespond ) {
return;
}
}
);
}
catch(err) {
}
}
function NiceRadio(id, formname, testid){
try{
if(testid != null){
var elements = $(formname).elements;
for (var i = 0;i<elements.length ;i++ ){
if(elements[i].type=='radio'){
try{testid = elements[i].id}catch(e){}
if (testid.split(/_/)[0] == id.split(/_/)[0]) {
var cls = $('lbl_'+elements[i].id).className;
if ( cls == null ) cls = '';
cls = cls.replace( " chosen", "");
cls = cls.replace( "chosen", "");
$('lbl_'+elements[i].id).className= cls;
$('rd_'+elements[i].id).className='radioArea';
}
}
}
} else {
var elements = document.forms[formname].elements;
for (var i = 0;i<elements.length ;i++ ){
if(elements[i].type=='radio'){
var cls = $('lbl_'+elements[i].id).className;
if ( cls == null ) cls = '';
cls = cls.replace( " chosen", "");
cls = cls.replace( "chosen", "");
$('lbl_'+elements[i].id).className= cls;
$('rd_'+elements[i].id).className='radioArea';
}
}
}
}catch(e){console.debug(e)}
$('rd_'+id).className='radioAreaChecked';
$('lbl_'+id).className += ' chosen';
$(formname+'_radio').value = id;
}
function NiceCheckbox(id){
if ($('chk_'+id).className=='checkboxArea'){
$('chk_'+id).className='checkboxAreaChecked';
if ( $('lbl_'+id).className == null || $('lbl_'+id).className == '' ) {
$('lbl_'+id).style.color='#36A800';
}
$(id).checked = true;
return true;
}
if ($('chk_'+id).className=='checkboxAreaChecked'){
$('chk_'+id).className='checkboxArea';
if ( $('lbl_'+id).className == null || $('lbl_'+id).className == '' ) {
$('lbl_'+id).style.color='#1B6C9A';
}
$(id).checked = false;
return false;
}
}
function checkOut(){
var d = $('wct_check_in3').value;
var dt = d.split(/-/)[1] + '/' + d.split(/-/)[2] + '/' + d.split(/-/)[0];
try{
$('wct_check_out3').value = dateAdd('d',$('wct_nights3').value,dt);
}catch(e){
}
}
function dateAdd(p_Interval, p_Number, p_Date){
try{
p_Number = new Number(p_Number);
var dt = new Date(p_Date);
switch(p_Interval.toLowerCase()){
case "m": {dt.setMonth(dt.getMonth() + p_Number);break;}
case "d": {dt.setDate(dt.getDate() + p_Number);break;}
}
if(isNaN(dt)){return null}
return (dt.getDate()+'/'+(dt.getMonth()+1)+'/'+(dt.getFullYear()));
}catch(e){}
}
function accTab(obj,page){
if(obj == 'wct'){
$('hotels_div').style.display='block';
$('hostels_div').style.display='none';
obj = 'hotels';
}
if(obj == 'hw'){
$('hotels_div').style.display='none';
$('hostels_div').style.display='block';
obj = 'hostels';
}
if ( page != null && page != '' ) {
new Ajax.Request(location.protocol+"//"+location.hostname+"/waynfx.html?wci=statinc&counter=" + obj+"&contentpage="+page, {
onSuccess : function(resp) {
},
onFailure : function(resp) {
},
method : "GET"
});
}
}
// used in few boxes - stays here
function fillICalendar(id, startdate, days){
var d = new Date(startdate.split(/-/)[0],(startdate.split(/-/)[1])-1,startdate.split(/-/)[2]);
d.setDate(d.getDate()+(days*1));
var mm = d.getMonth() + 1 + '';
var dd = d.getDate() + '';
if(mm.length == 1){mm='0'+mm}
if(dd.length == 1){dd='0'+dd}
var textd = dd + '/' + mm + '/' + d.getFullYear();
var isod = d.getFullYear() + '-' + mm + '-' + dd;
$(id).value = isod;
$(id+'Input').value = textd;
}
function calcICalendar(){fillICalendar('HotelsDateEnd', $('HotelsDate').value, $('hotels_days').value);}
function calcICalendarBack(){fillICalendar('HotelsDate', $('HotelsDateEnd').value, ($('hotels_days').value)*-1);}
function checkCalender(cos){
if(cos == "wct_check_in2"){
if($("wct_check_out2").value !== ""){
fillICalendar('wct_check_out2', $('wct_check_in2').value, $("wct_nights2").value);
}
}else if (cos == "wct_check_out2"){
if($("wct_check_in2").value !== ""){
fillICalendar('wct_check_in2', $('wct_check_out2').value,"-" + $("wct_nights2").value);
}
}else  if(cos == "wct_check_in"){
if($("wct_check_out").value !== ""){
fillICalendar('wct_check_out', $('wct_check_in').value,  $("wct_nights").value);
}
}else if (cos == "wct_check_out"){
if($("wct_check_in").value !== ""){
fillICalendar('wct_check_in', $('wct_check_out').value, "-" + $("wct_nights").value);
}
}
}
function updatePhoto_Box(type,statsKey)
{
if(!type)
{
type = $('photosBoxLoadType').value;
var list = $('photoBoxList').list;
//update if on load or not by tab menu click
if(type== 'friends')
{
list.mark(list.items[0]);
}
else
{
list.mark(list.items[1]);
}
}
var BoxID = 'photosBox';
var BoxName = 'latest_photos';
var tmpObj = $(BoxID);
tmpObj.innerHTML = '<center><b>please wait whilst loading data ...</b></center>';
xmlRequest = new Ajax.Request (
'/waynphotos.html?wci=photo&wce=getbox&type=' + type + '&stats_key=' + statsKey,
{
method : 'GET',
asynchronous: false,
onSuccess : function ( resp ) {
var responseXml = resp.responseXML;
for (var i = responseXml.firstChild; i != null; i = i.nextSibling) {
for (var j = i.firstChild; j != null; j = j.nextSibling) {
if(j.nodeValue != null && j.nodeValue != ''){
if(BoxID){
tmpObj.innerHTML = j.nodeValue;
}
}
}
}
},
onFailure : function ( resp ) {
$(BoxID).innerHTML = '<center><b>Sorry we\'re unable to load data at the moment. We will try again in few seconds.</b></center>';
if (timernames["timername_"+BoxID]==BoxName){
setTimeout("updatePhoto_Box('" + type + "');",3000*count);
}
return;
},
onException: function ( resp ) {
$(BoxID).innerHTML = '<center><b>Sorry we\'re unable to load data at the moment. We will try again in few seconds.</b></center>';
if (timernames["timername_"+BoxID]==BoxName){
setTimeout("updatePhoto_Box('" + type + "');",3000*count);
}
return;
}
});
}
/**
* BoxName
* BoxId
* who
* tmpaddons
* From
* count
* img
* page
*/
function updateBox_Homepage(BoxName, BoxID, who, tmpaddons, From, count, img, page ) {
if ((From==1)||(From==2)){
if ((who==null)||(who=="")){
if ( $("who") )
who=$("who").value;
}
else{
if ( $("who") )
$("who").value=who;
}
}
if (From==2){
if ((BoxName==null)||(BoxName=="")){
if ($("box_name") )
BoxName=$("box_name").value;
}
else{
if ($("box_name") )
$("box_name").value=BoxName;
}
}
try{
if ((count==null)||(count<=0)||(count=='')){
timernames["timername_"+BoxID]=BoxName;
}
}
catch(e){
}
if (timernames["timername_"+BoxID]!=BoxName){return;}
if ((count==null)||(count<0)||(count=='')){count=0;}
count++;
if (count>10){return;}//failed to many times operation aborted
var xmlRequest = null;
try{
var addons="";
if (tmpaddons!=null){addons=tmpaddons;}
var boxDiv=$(BoxID);
var strUrl="/wayntravels.html?wci=destination&wce=getbox&box=";
if (BoxID=="search_box"){
if ( page != null ) {
strUrl="/wayntravels.html?wci=home&wce=getbox" + BoxName + "&contentpage="+page+"&box=";
} else {
strUrl="/wayntravels.html?wci=home&wce=getbox" + BoxName + "&box=";
}
}
if((boxDiv != null)&&(BoxName != null)){
var country_code = $("country_code").value;
var country_name = $("country_name").value;
var city_key = $("city_key").value;
var city_name = $("city_full_name").value;
if(city_name=='State/County not known') city_name='';
var town_key = $("town_key").value;
var town_name = $("town_name").value;
var directory_key = $("directory_key").value;
var category_key = $("category_key").value;
var OverviewName = $("OverviewName").value;
if ( OverviewName != "" ) {
addons+="&place=" + OverviewName;
}
if ( addons == null || addons == "undefined" ){
addons="";
}
var location_key = '';
try{
location_key = $("location_key").value;
}catch(err){}
addons+="&country_code="+country_code;
addons+="&city_key="+city_key+"&town_key="+town_key+"&town_name="+town_name;
addons+="&city_name="+city_name+"&country_name="+country_name;
addons+="&who="+who;
addons+="&category_key="+category_key+"&place_key="+directory_key+"&location_key="+location_key;
addons+="&home=1";
/**
* Load files
*/
var BoxName2 = BoxName.replace(/(\d*)$/,"");
switch ( BoxName2.toLowerCase() ) {
case "friendssearch":
WAYN.Import("/js/box/friendsimport.js");
break;
case "flightsearch":
WAYN.Import("/flights/flights.js");
break;
case "insurancesearch":
//WAYN.Import("/insurance/purchase.css"); //this css was included to homepage, travel guide and splash because importing css file caused error in buddy list layout
WAYN.Import("/insurance/purchase.js");
break;
case "accomodationsearch":
WAYN.Import("/js/box/accomodation.js");
break;
case "restaurantssearch":
WAYN.Import("/js/box/restaurants.js");
break;
case "nightlifesearch":
WAYN.Import("/js/box/nightlife.js");
break;
case "thingstodosearch":
WAYN.Import("/travels/Attractions.js");
break;
}
var tmpMessage="<table style='height:170px;width:100%'><tr><td align='center' valign='middle'><img align='absmiddle' style='padding: 5px' src='images/loading.gif'/><b>please wait whilst loading data ...</b></td></tr></table>";
boxDiv.innerHTML = tmpMessage;
/* // */
new Ajax.Request (
strUrl + BoxName + addons,
{
method : 'GET',
asynchronous: false,
onSuccess : function ( resp ) {
try {
if (timernames["timername_"+BoxID]!=BoxName){return;}
var BoxName2 = BoxName.replace(/(\d*)$/,"");
try{
responseXml = resp.responseXML;
if(responseXml.firstChild.nodeName =="parsererror"){
throw "parsererror"
}
for (var i = responseXml.firstChild; i != null; i = i.nextSibling) {
for (var j = i.firstChild; j != null; j = j.nextSibling) {
if(j.nodeValue != null && j.nodeValue != ''){
if(BoxID){
boxDiv.innerHTML = j.nodeValue;
}
}
}
}
}
catch(err){
boxDiv.innerHTML = '<center><b>There are no data available at the moment.</b></center>';
}
WAYN.Inputs.Init();
WAYN.Hint.Init();
WAYN.lightForm.Init();
if(BoxName2 == "accomodationSearch"){
var sd = new Date();
sd.setDate(sd.getDate()+7);
var ed = new Date();
ed.setDate(ed.getDate()+8);
var smm = sd.getMonth() + 1 + '';
var sdd = sd.getDate() + '';
if(smm.length == 1){smm='0'+smm}
if(sdd.length == 1){sdd='0'+sdd}
var emm = ed.getMonth() + 1 + '';
var edd = ed.getDate() + '';
if(emm.length == 1){emm='0'+emm}
if(edd.length == 1){edd='0'+edd}
var startd = sdd + ' / ' + smm + ' / ' + sd.getFullYear();
var isostartd = sd.getFullYear() + '-' + smm + '-' + sdd;
var endd = edd + ' / ' + emm + ' / ' + ed.getFullYear();
var isoendd = sd.getFullYear() + '-' + emm + '-' + edd;
var divcHotels = document.createElement('div');
divcHotels.setAttribute("id", "HotelsDateContainer");
var scrHotels = document.createElement('script');
var txtHotels = 'new DatetimeToolbocks({ inputValue:"' + isostartd + '", elementId:"HotelsDate",startDate:"true",elementNextId:"HotelsDateEnd",calendarOptions: {textDateClass:"textBlackDefault"}});';
scrHotels.text = txtHotels;
var cellHotels = $('hotels_dateStartContainer');
cellHotels.appendChild(divcHotels);
cellHotels.appendChild(scrHotels);
var divcHotelsEnd = document.createElement('div');
divcHotelsEnd.setAttribute("id", "HotelsDateEndContainer");
var scrHotelsEnd = document.createElement('script');
var txtHotelsEnd = 'new DatetimeToolbocks({ inputValue:"' + isoendd + '", elementId:"HotelsDateEnd",startDate:"false",elementNextId:"HotelsDate",calendarOptions: {textDateClass:"textBlackDefault"}})';
scrHotelsEnd.text = txtHotelsEnd;
var cellHotelsEnd = $('hotels_dateEndContainer');
cellHotelsEnd.appendChild(divcHotelsEnd);
cellHotelsEnd.appendChild(scrHotelsEnd);
var divcHostels = document.createElement('div');
divcHostels.setAttribute("id", "HostelsDateContainer");
var scrHostels = document.createElement('script');
var txtHostels = 'new DatetimeToolbocks({ inputValue:"' + isostartd + '", elementId:"HostelsDate",startDate:"true",elementNextId:"HostelsDateEnd",calendarOptions: {textDateClass:"textBlackDefault"}})';
scrHostels.text = txtHostels;
var divcHostelsEnd = document.createElement('div');
divcHostelsEnd.setAttribute("id", "HostelsDateEndContainer");
var scrHostelsEnd = document.createElement('script');
var txtHostelsEnd = 'new DatetimeToolbocks({ inputValue:"' + isoendd + '", elementId:"HostelsDateEnd",startDate:"false",elementNextId:"HostelsDate",calendarOptions: {textDateClass:"textBlackDefault"}})';
scrHostelsEnd.text = txtHostelsEnd;
var cellHostels = $('hostels_dateStartContainer');
var cellHostelsEnd = $('hostels_dateEndContainer');
cellHostels.appendChild(divcHostels);
cellHostels.appendChild(scrHostels);
cellHostelsEnd.appendChild(divcHostelsEnd);
cellHostelsEnd.appendChild(scrHostelsEnd);
if ($('HotelsDate'))
$('HotelsDate').value = isostartd;
if($('HotelsDateInput'))
$('HotelsDateInput').value = startd;
if($('HotelsDateEnd'))
$('HotelsDateEnd').value = isoendd;
if($('HotelsDateEndInput'))
$('HotelsDateEndInput').value = endd;
var iStart = $('HotelsDateDetail');
var iEnd = $('HotelsDateEndDetail');
if ($('HostelsDate'))
$('HostelsDate').value = isostartd;
if($('HostelsDateInput'))
$('HostelsDateInput').value = startd;
if($('HostelsDateEnd'))
$('HostelsDateEnd').value = isoendd;
if($('HostelsDateEndInput'))
$('HostelsDateEndInput').value = endd;
}
if (BoxName2=="flightSearch"){
try {
if ($('flights_a6d0ed38_arrive'))
{
var script = null;
for ( var n = $('flights_a6d0ed38_arrive').firstChild; n != null; n = n.nextSibling ) {
if (n.tagName != null) {
if(n.tagName.toLowerCase() == "script") {
var script = n;
}
}
}
if ( script != null ) {
var divcFlights =  $('flights_a6d0ed38_arrive');
$('return_date_Container').innerHTML = '';
divcFlights.removeChild(script);
var scrFlights = document.createElement('script');
scrFlights.text = script.innerHTML;
divcFlights.appendChild(scrFlights);
}
for ( var n = $('flights_eab574fc_depart').firstChild; n != null; n = n.nextSibling ) {
if (n.tagName != null) {
if(n.tagName.toLowerCase() == "script") {
var script = n;
}
}
}
if ( script != null ) {
var divcFlights =  $('flights_eab574fc_depart');
$('depart_date_Container').innerHTML = '';
divcFlights.removeChild(script);
var scrFlights = document.createElement('script');
scrFlights.text = script.innerHTML;
divcFlights.appendChild(scrFlights);
}
}
} catch (e) {msgBox('error',e.message);}
}
} catch(e) {}
},
onFailure : function ( resp ) {
$(BoxID).innerHTML = '<center><b>Sorry we\'re unable to load data at the moment. We will try again in few seconds.</b></center>';
if (timernames["timername_"+BoxID]==BoxName){
setTimeout("updateBox_Homepage('" + BoxName + "','" + BoxID + "', '', '" + tmpaddons + "', '"+From+"',"+count+");",3000*count);
}
return;
},
onException: function ( resp ) {
$(BoxID).innerHTML = '<center><b>Sorry we\'re unable to load data at the moment. We will try again in few seconds.</b></center>';
if (timernames["timername_"+BoxID]==BoxName){
setTimeout("updateBox_Homepage('" + BoxName + "','" + BoxID + "', '', '" + tmpaddons + "', '"+From+"',"+count+");",3000*count);
}
return;
}
}
);
}
else{
//alert("Wrong ID for box or empty boxname");
}
}
catch(err) {
//msgBox('error','smartxml:'+err);
}
}
function myreviews_typeHint(){
if ( $( 'idcountry_key' ).value == 'ZZ') {
$('reviewHint').style.display = '';
} else {
$('reviewHint').style.display = 'none';
}
}
function myreviews_ChangePlaceType(sid_span, sid_input, obj_select){
//author:kriss
sid_input.value = '';
if ( obj_select.value == "l" ) {
$('countryRow').style.display = 'none';
$(sid_span).innerHTML = obj_select.options[obj_select.selectedIndex].innerHTML;
try {
$(sid_input).focus();
} catch(err) {
}
} else {
$('countryRow').style.display = '';
if ( $( 'idcountry_key' ).value == 'ZZ' && obj_select.value != '' ) {
$('reviewHint').style.display = '';
} else {
$('reviewHint').style.display = 'none';
}
if(obj_select.value>0 || obj_select.value == 't') {
$(sid_span).innerHTML = obj_select.options[obj_select.selectedIndex].innerHTML;
try {
$(sid_input).focus();
} catch(err) {
}
}else {
$(sid_span).innerHTML='Place'
}
}
}
function findPlacesToReview(){
if($('idcategory_key').selectedIndex==0){
msgBox('warning','Select place type first.');
return;
}
var typ = $('idcategory_key').value;
var selPl = String($('idPlaceName_key').value);
selPl = selPl.split(',');
if ( typ == 'l' && !(selPl[0] != 0 && selPl[0] != null && selPl != '' )) {
msgBox('warning','Select valid country.');
return;
}
if ( typ == 't' && !(selPl[2] != null && (selPl[2] * 1) > 1 )) {
msgBox('warning','Select valid town.');
return;
}
var d = $('reviewRefferer');
if ( d != null ) {
var refferer = d.value;
document.cookie='reviewRefferer='+refferer+';expires=1h';
}
var selCategory = $('idcategory_key');
var what = selCategory.options[selCategory.selectedIndex].innerHTML;
var val = selCategory.options[selCategory.selectedIndex].value;
var where = $('idPlaceName').value;
if(where!='') what +=','+where;
if ( val == 'l' ) {
var val = String($('idPlaceName_key').value).split(',')[0];
document.location.href='/wayntravels.html?wci=destination&country_code='+val+'&add_rev=1#ReviewAnchor';
} else if ( val == 't' ) {
var val = String($('idPlaceName_key').value).split(',');
document.location.href='/wayntravels.html?wci=destination&country_code='+val[0]+'&town_key='+val[2]+'&add_rev=1#ReviewAnchor';
} else {
var hintPlaceKey = String($('idPlaceName_key').value).split(',')[3];
if(hintPlaceKey > 0){
document.location.href='/wayntravels.html?wci=place&place_key=' + hintPlaceKey+'&add_rev=1#ReviewAnchor';
} else {
if(selCategory.value != ''){
what = selCategory.options[selCategory.selectedIndex].innerHTML;
if ($('idPlaceName').value != ''){
what = what + ', ' ;
}
what = what + $('idPlaceName').value;
}else{
what = $('idPlaceName').value;
}
var selCountry = $('idcountry_key');
if(selCountry.value != 'ZZ'){
where = selCountry.options[selCountry.selectedIndex].innerHTML;
}else{
where = '';
}
//alert('what:'+what + '   where:' + where);
var myurl= '/wayntravels.html?wci=search&search_type=hint_search&where='+where+'&what='+what+'';
//alert(myurl);
document.location.href=myurl;
}
}
}
function reviewHintGet() {
var hint = $('idPlaceName').hint;
if ( hint == null ) return;
$('idPlaceName_key').value = '';
$('idPlaceName').value = '';
switch ( $('idcategory_key').options[$('idcategory_key').selectedIndex].value ) {
case 't':
hint.source = '/waynfx.html?wci=GetLocationHint&search_type=t&cc=' + $('idcountry_key').options[$('idcountry_key').selectedIndex].value  +  '&town=Y&where=';
break;
case 'l':
hint.source = 'waynfx.html?wci=GetLocationHint&search_type=l&where=';
break;
default:
var cc = '';
var ck = '';
var cn = '';
if($('idcountry_key').selectedIndex>0) cc = $('idcountry_key').options[$('idcountry_key').selectedIndex].value;
if($('idcategory_key').selectedIndex>0) ck = $('idcategory_key').options[$('idcategory_key').selectedIndex].value;
if($('idcategory_key').selectedIndex>0) cn = $('idcategory_key').options[$('idcategory_key').selectedIndex].innerHTML;
hint.source = 'waynfx.html?wci=GetLocationPlaceHint&town=N&short=1&cc=' + cc  +  '&category_key='+ ck +'&category_name='+ cn +'&where=';
break;
}
}
function reviewCountryChanged(obj) {
if ( ( obj.value == null || obj.value == '' || obj.value == 'ZZ' ) && (  $('idcategory_key').value != '' ) ) {
$('reviewHint').style.display = '';
} else {
$('reviewHint').style.display = 'none';
}
}
function updateKidsAge(fd) {
try {
if (0 == fd.value) {
$("wct_kids_age").style.display = "none";
} else {
$("wct_kids_age").style.display = "inline";
}
for (i = 1; i <= 4; i++) {
var kidId = "wct_kid_" + i;
if (i <= fd.value) {
$(kidId).style.display = "inline";
} else {
$(kidId).style.display = "none";
}
}
}
catch (ex) {}
}
function fillWCTPlaceForm(){
var url = document.location + '';
var qstring = url.split('?')[1];
var hotelsChildren = 0;
if(qstring){
var querystring = qstring.split(/\&/);
for (var i=0; i<querystring.length; i++){
if(querystring[i].split('=')[0] == 'children') {
hotelsChildren = querystring[i].split('=')[1];
}
if(querystring[i].split('=')[0] == 'children_age') {
hotelsChildrenAge = querystring[i].split('=')[1].split(',');
}
}
}
if(hotelsChildren > 0){
$('wct_kids_age').style.display = 'block';
for (var i = 1; i <= hotelsChildren; i++){
$('wct_kid_' + i).style.display = 'block';
$('wct_child_' + i).value = hotelsChildrenAge[i-1];
//$('wct_child_' + i).selectedIndex = hotelsChildrenAge[i-1];
}
}
}
