function initCostSlider(minVal,maxVal){var mySlideA=new Slider($('gutterA'),$('minKnobA'),{start:500,end:15000,offset:10,knobheight:16,onChange:function(pos){$('sliderLabelA').setHTML('min '+pos.minpos+' - max '+pos.maxpos);$('minCost').value=pos.minpos;$('maxCost').value=pos.maxpos;},onComplete:function(pos){filterResults();}},$('maxKnobA')).setMin(minVal).setMax(maxVal);}
function initDistanceSlider(minVal,maxVal){var mySlideB=new Slider($('gutterB'),$('minKnobB'),{start:25,end:500,offset:10,knobheight:16,onChange:function(pos){$('sliderLabelB').setHTML('min '+pos.minpos+' - max '+pos.maxpos);$('minDistance').value=pos.minpos;$('maxDistance').value=pos.maxpos;},onComplete:function(pos){filterResults();}},$('maxKnobB')).setMin(minVal).setMax(maxVal);}
function initInterestCheckboxes(){toggleCheckBoxes(true);document.discover.selectAll.checked=true;}
function cityChanged(ele){document.getElementById('cityName').innerHTML=ele.options[ele.selectedIndex].text;document.getElementById('cityName').style.display='';document.getElementById('city_dropdown').style.display='none';filterResults();}
function toggleCityName_DropDownDisplay(){document.getElementById('city_dropdown').style.display='';document.getElementById('cityName').style.display='none'}
function initCity(cityId){var ele=document.getElementById("city");document.getElementById("city").selectedIndex=cityId-1;document.getElementById('cityName').innerHTML=ele.options[ele.selectedIndex].text;document.getElementById('cityName').style.display='';document.getElementById('city_dropdown').style.display='none';}
function initCheckBoxes(propertyTypes,activityTypes){var propertyTypesArray=propertyTypes.split(",");var activityTypesArray=activityTypes.split(",");for(i=0;i<propertyTypesArray.length;i++){if(propertyTypesArray[i]>0)
document.getElementsByName("criteria.propertyTypes")[propertyTypesArray[i]-1].checked=true;}
for(i=0;i<activityTypesArray.length;i++){if(activityTypesArray[i]>0)
document.getElementsByName("criteria.activityTypes")[activityTypesArray[i]-1].checked=true;}}
function toggleCheckBoxes(checkBox){var propertyTypes=document.getElementsByName("criteria.propertyTypes");var activityTypes=document.getElementsByName("criteria.activityTypes");for(var i=0;i<propertyTypes.length;i++)
propertyTypes[i].checked=checkBox;for(var i=0;i<activityTypes.length;i++){activityTypes[i].checked=checkBox;}
filterResults();}
function validate(){var checkinDateUnParsed=document.getElementById("from_date");var checkoutDateUnParsed=document.getElementById("to_date");var pattern=new RegExp("[0-9][0-9][ ][a-zA-Z][a-zA-Z][a-zA-Z][ ][0-9][0-9][0-9][0-9]");if(!checkinDateUnParsed.value.match(pattern)){checkinDateUnParsed.select();showDialog('Errror','Please select a valid \'from date\' in the format 01 Jan 2008','error',2);return false;}
if(!checkoutDateUnParsed.value.match(pattern)){checkoutDateUnParsed.select();showDialog('Errror','Please select a valid \'To date\' in the format 01 Jan 2008','error',2);return false;}
var checkinDate=Date.parseDate(checkinDateUnParsed.value,"%d %b %Y")
var checkoutDate=Date.parseDate(checkoutDateUnParsed.value,"%d %b %Y")
if(checkinDate>checkoutDate){checkoutDateUnParsed.select();showDialog('Error','To date cannot be prior to from date','error',3);return false;}
return true;}
function initDates(){var fromDate=document.getElementById("from_date");var currentDate=new Date();fromDate.value=currentDate.print("%d %b %Y");var toDate=document.getElementById("to_date");var futureDate=new Date();futureDate.setMonth(new Date().getMonth()+2);toDate.value=futureDate.print("%d %b %Y");}
function getHTTPObject(){var xmlhttp;if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}else if(window.ActiveXObject){try
{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}}
return xmlhttp;}
function filterResults(){if(document.discover.searchSource.value=='filter')
document.getElementById("submitDiscoverForm").click();}