var a; var b; function showTowns(str)
{ var q = str.substr(0,2); a = str.substr(0,2); var temp = new Array(); if (str !=='')
{ temp = str.split(','); var s = temp[1]; b = temp[1];}
if (window.ActiveXObject)
{ xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async=false; xmlDoc.setProperty('SelectionLanguage', 'XPath'); xmlDoc.load("../../inc/gulliver/towns.xml"); generateCombo();}
else if (document.implementation &&
document.implementation.createDocument)
{ xmlDoc=document.implementation.createDocument("","",null); xmlDoc.load("../../inc/gulliver/towns.xml"); xmlDoc.onload=generateCombo;}
else
{ alert('Your browser cannot handle this script');}
}
function generateCombo()
{ var output = ''; var q = a; if(b=='')
{ var xPath="location/p[starts-with(c," + "'" + a + "')]";}
else
{ var xPath="location/p[starts-with(c," + "'" + a + "," + b + "')]";}
var nodes=xmlDoc.selectNodes(xPath); output = ('<div class="gullTableTown"><div class="gullTownTitle' + gullTab + '"><\/div>'); if(nodes.length==0 || q=='')
{ output = output + ('<select class="gullTowns" id="gullSelTowns" name="gullSelTowns"><option>Any Town</option></select></div></div></div>'); document.getElementById("txtTowns").innerHTML=output; return;}
else
{ output = output + ('<select class="gullTowns" id="gullSelTowns" name="gullSelTowns"> <option>Any Town</option>>');}
if(document.implementation &&
document.implementation.createDocument)
{ for(var x=1; x <= nodes.length-1; x++)
{ for(var y=1; y<=1; y++)
{ if(nodes[x].childNodes[y].nodeName=='c')
{ str= '<option value=' + nodes[x].childNodes[y].textContent + '>';}
if(nodes[x].childNodes[y+2].nodeName=='t')
{ str = str + nodes[x].childNodes[y+2].textContent + '</option>'; output = output + str;}
}
}
}
else
{ for(var x=1; x <= nodes.length-1; x++)
{ for(var y=0; y<=1; y++)
{ if(nodes.item(x).childNodes(y).nodeName=='c')
{ str= '<option value=' + nodes.item(x).childNodes(y).text + '>';}
else if(nodes.item(x).childNodes(y).nodeName=='t')
{ str = str + nodes.item(x).childNodes(y).text + '</option>'; output = output + str;}
}
}
}
output = output + ('</div></div>'); document.getElementById("txtTowns").innerHTML=output;}
var gullTab; gullTab ='Tab'; function displayDirectSearch(strBookingURL, gullSet)
{ gullHidFld("hdnTypedSearch", ""); gullHidFld("hdnBookingURL", strBookingURL); gullHidFld("hdnAffiliateID", gullSet["AffiliateID"]); gullHidFld("hdnProviderID", gullSet["ProviderID"]); gullHidFld("hdnTownLevel", gullSet["TownLevel"]); gullHidFld("hdnPremType", gullSet["PremType"]); gullHidFld("hdnSharing", gullSet["Sharing"]); gullHidFld("hdnPremName", gullSet["PremName"]); gullHidFld("hdnGrade", gullSet["Grade"]); gullHidFld("hdnPrice", gullSet["Price"]); gullHidFld("hdnFacilities", gullSet["Facilities"]); gullHidFld("hdnoptional", gullSet["Optional"]); gullHidFld("hdnPremTypeShow", gullSet["PremTypeShow"]); var strGullSurroundStyle; strGullSurroundStyle = ""; if(gullSet["BackgroundColor"] != "")
{ strGullSurroundStyle = 'style="background-color:' + gullSet["BackgroundColor"] + '"';}
if(gullSet["BackgroundImage"] !="")
{ strGullSurroundStyle = 'style="background:transparent url(' + gullSet["BackgroundImage"] + ') no-repeat 0 0"';}
gullOut('<div id="gullSurround" class="gullSurround" '+ gullSet["GullSurroundStyle"] + '>'); var gullBasicCss = 'gullBasic'; if (gullSet["AdvancedTabShow"] == 'yes' || gullSet["Facilities"] == 'yes')
{ gullOut('<div id="gullTabs">'); gullOut('<ul>'); gullOut('<li id="gullBasicTab" class="gullCurrentTab"><div onclick="showhideDiv(\'gullBasic\'); return false"><span>Basic</span></div></li>'); if (gullSet["AdvancedTabShow"] == 'yes')
{ gullOut('<li id="gullOptionTab"><div onclick="showhideDiv(\'gullOptContainer\')"><span>Advanced</span></div></li>');}
if (gullSet["Facilities"] == 'yes')
{ gullOut('<li id="gullFacilitisTab"><div onclick="showhideDiv(\'gullFac\')"><span>Facilities</span></div></li>');}
gullOut('</ul>'); gullOut('</div>');}
else
{ gullBasicCss = 'gullBasicDown';}
gullOut('<div class="' + gullBasicCss + '" id="gullBasic">'); if(gullSet["TypeLocationShow"]=="yes")
{ gullOut('<div class="gullTypeLocationTitle">Type Location</div>'); gullOut('<input type="text" id="gullTypedLocation" value="" class="gullTypedLocation" />'); gullTab = '';}
if(gullSet["TypeLocationShow"]=="yes" && gullSet["LocationShow"]=="yes")
{ gullOut('<div class="gullChoose">-Or Choose-</div>');}
if(gullSet["LocationShow"]=="yes")
{ gullOut('<div class="gullLocation">'); if(gullSet["TownLevel"]=="yes")
{ gullOut('<select class="gullLocationCombo" id="hdnLocation" name="hdnLocation" onchange="showTowns(this.value)">');}
else
{ gullOut('<select class="gullLocationCombo" name="hdnLocation" id="hdnLocation">');}
gullOption("","Please Select"); gullOption("DU,,,0","Dublin County"); gullOption("DU,D1,,0","Dublin City"); gullOption("DU,D1,DCC,0","Dublin City Centre"); gullOption("DU,N,D089,0","Dublin Airport"); gullOption("GY,,,0","Galway County"); gullOption("KY,,,0","Kerry County"); gullOption("CK,,,0","Cork County"); gullOption("CE,,,0","Clare County"); gullOption(((gullSet["Location"]=="")?"":""),"---------------------------"); gullOption("AM,,,0","Antrim County"); gullOption("AH,,,0","Armagh County"); gullOption("AM,BC,B719,0","Belfast City"); gullOption("CW,,,0","Carlow County"); gullOption("CN,,,0","Cavan County"); gullOption("CE,,,0","Clare County"); gullOption("CK,C1,,0","Cork City"); gullOption("CK,,,0","Cork County"); gullOption("DY,FV,L709,0","Derry City"); gullOption("DY,,,0","Derry County"); gullOption("DL,,,0","Donegal County"); gullOption("DN,,,0","Down County"); gullOption("FH,,,0",'Fermanagh County'); gullOption("GY,G1,,0",'Galway City'); gullOption("GY,,,0",'Galway County'); gullOption("KY,,,0",'Kerry County'); gullOption("KE,,,0",'Kildare County'); gullOption("KK,,K037,0",'Kilkenny City'); gullOption("KK,,,0",'Kilkenny County'); gullOption("LS,,,0",'Laois County'); gullOption("LM,,,0",'Leitrim County'); gullOption("LK,L1,,0" ,'Limerick City'); gullOption("LK,,,0",'Limerick County'); gullOption("DY,FV,L709,0",'Londonderry City'); gullOption("DY,,,0",'Londonderry County'); gullOption("LD,,,0",'Longford County'); gullOption("LH,,,0",'Louth County'); gullOption("MO,,,0",'Mayo County'); gullOption("MH,,,0",'Meath County'); gullOption("MN,,,0",'Monaghan County'); gullOption("OY,,,0",'Offaly County'); gullOption("RN,,,0",'Roscommon County'); gullOption("CE,,S020,0",'Shannon Airport'); gullOption("SO,,,0",'Sligo County'); gullOption("TI,,,0",'Tipperary County'); gullOption("TE,,,0",'Tyrone County'); gullOption("WD,W1,,0",'Waterford City'); gullOption("WD,,,0",'Waterford County'); gullOption("WH,,,0",'Westmeath County'); gullOption("WX,,,0",'Wexford County'); gullOption("WW,,,0",'Wicklow County'); gullOut('</select>'); gullSetSelectedIndex("hdnLocation", gullSet["Location"]); gullOut('</div>');}
else
{ gullHidFld("hdnLocation", gullSet["Location"]);}
if(gullSet["TownLevel"]=="yes"){ gullOut('<div class="gullTown" id="txtTowns"></div>');}
if(gullSet["PremTypeShow"]=="yes"){ gullOut('<div class="gullType">'); gullOut('<select class="gullPremType" id="gullSelAccomType" name="gullSelAccomType">'); gullOption("20",'Hotel &amp; Guesthouse'); gullOption("5",'Bed and Breakfast'); gullOption("2",'Self-Catering'); gullOption("6",'Hostel'); gullOut('</select></div>'); gullSetSelectedIndex("gullSelAccomType", gullSet["PremType"]);}
else
{ gullHidFld("hdnPremType2", gullSet["PremType"]);}
gullOut('<div class="gullParty">'); gullOut('<div class="gullAdult">'); gullOut('<select class="gullNumAdults" id="gullSelNumAdults" name="gullSelNumAdults">'); createNumericOnlyOption(8,2); gullOut('</select></div>'); if(gullSet["Children"] =='yes')
{ gullOut('<div class="gullChild">'); gullOut('<select class="gullNumChildren" name=selNumChildren>'); gullOut('<option value=0 selected="selected">0</option> '); createNumericOnlyOption(8,0); gullOut('</select></div>');}
if(gullSet["Infants"]=='yes')
{ gullOut('<div class="gullInfants">'); gullOut('<select class="gullNumInfants" name=selNumInfants>'); gullOut('<option value=0 selected="selected">0</option> '); createNumericOnlyOption(8,0); gullOut('</select></div>');}gullOut('<div class="gullNight">'); gullOut('<select class="gullNumNight" id="gullSelNumNights" name="gullSelNumNights">'); createNumericOnlyOption(31,1); gullOut('</select></div>');
gullOut('</div>'); gullOut('<input name="date_sel" type="text" id="date_sel" class="split-date no-transparency range-low-2008-03-06 range-high-2013-03-28 lang-en" style="display:none;" />'); gullOut('<div class="gullArrival"><select class="gullDays" id="date_sel_dd" name="date_sel_dd_Day">'); var todaysDate = new Date(); for (var counter = 1; counter<=31;counter++)
{ gullOut('<option '); gullOut('value=' + counter); if (counter == parseInt(todaysDate.getDate()))
{ gullOut(' selected="selected"'); var gullDateSel = getField('date_sel'); gullDateSel = counter;}
gullOut('>' + counter ); gullOut('</option>');}
gullOut('</select> '); gullOut('<select class="gullMonthYear"  name="date_sel_mm" id="date_sel_mm">'); var m_names = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"); for (var yearCounter = todaysDate.getFullYear(); yearCounter<2013; yearCounter++ )
{ if(yearCounter == todaysDate.getFullYear())
{ for (var monthCounter = todaysDate.getMonth()+1; monthCounter<=12;monthCounter++)
{ gullOut('<option '); gullOut('value=' + yearCounter +'|'+ ((monthCounter+= "").length < 2 ? "0" + monthCounter : monthCounter) ); if ((monthCounter == parseInt(todaysDate.getMonth()+1)) && (yearCounter == parseInt(todaysDate.getFullYear())))
{ gullOut(' selected="selected"');}
gullOut('>' + m_names[monthCounter-1] + '-' + yearCounter); gullOut('</option>');}
}
else
{ for (var monthCounter = 1; monthCounter<=12;monthCounter++)
{ gullOut('<option '); gullOut('value=' + yearCounter +'|'+ ((monthCounter+= "").length < 2 ? "0" + monthCounter : monthCounter) ); if ((monthCounter == parseInt(todaysDate.getMonth()+1)) && (yearCounter == parseInt(todaysDate.getFullYear())))
{ gullOut(' selected="selected"');}
gullOut('>' + m_names[monthCounter-1] + '-' + yearCounter); gullOut('</option>');}
}
}
gullOut('</select> '); gullOut('<input name="date_sel_fd_but" type="button" id="date_sel_fd_but" class="gullCalendar" /></div>'); if(gullSet["TownLevel"]=="yes"){ var gullLocation = getField('hdnLocation'); showTowns(gullLocation.value);}
 gullOut('</div>'); gullOut('<div class="gullDividerHide" id="gullDivider1"></div>'); gullOut('<div class="gullOptContainer" id="gullOptContainer">'); if(gullSet["PremName"]=='yes')
{ gullOut('<div class="gullProperty"><div class="gullPropertyTitle">Property Name</div>'); gullOut('<div class="gullPropName"><input maxLength="30" id="txtPremName" class="txtPremName" name="txtPremName" /></div></div>');}
if(gullSet["Grade"]=='yes')
{ gullOut('<div class="gullGrade"><div class="gullGradeTitle">Grade</div>'); gullOut('<div class="gullGrdFive">'+ gullChkFld("chkGrade5") + '5 Star</div>'); gullOut('<div class="gullGrdFour">'+ gullChkFld("chkGrade4") + '4 Star</div>'); gullOut('<div class="gullGrdThree">'+ gullChkFld("chkGrade3") + '3 Star</div>'); gullOut('<div class="gullGrdFive">'+ gullChkFld("chkGrade2") + '2 Star</div>'); gullOut('<div class="gullGrdOne">'+ gullChkFld("chkGrade1") + '1 Star</div>'); gullOut('<div class="gullGrdAll"><input type="checkbox" value="Y" id="chkGradeAll" name="chkGradeAll" checked="checked" />All Grades</div></div>');}
if(gullSet["Price"]=='yes')
{ gullOut('<div class="gullPrice"><div class="gullPriceTitle">Price</div>'); gullOut('<div class="gullPriFrom"><div class="gullPriFromTitle">From </div><input id="txtPriceFrom" name="txtPriceFrom" class="txtPriceFrom"/></div>'); gullOut('<div class="gullPriTo"><div class="gullPriToTitle">To </div><input id="txtPriceTo" name="txtPriceTo" class="txtPriceFrom"/></div></div>');}
if(gullSet["Sharing"]=='yes')
{ gullOut('<div class="gullShare"><div class="gullShareTitle">Sharing:</div>'); gullOut('<select id="gullSelSharing" name="gullSelSharing">'); gullOut('<option value=1 selected="selected">Sharing Bedroom</option>'); gullOut('<option value=2>Own bed</option> '); gullOut('<option value=3>Own room</option>'); gullOut('</select></div>');}
gullOut('</div><div class="gullDividerHide" id="gullDivider2"></div>'); if (gullSet["Facilities"]=='yes')
{ gullOut('<div class="gullFac" id="gullFac"><div class="gullFacTitle">Facilities</div>'); gullOut('<div class="gullFacCol1">'); gullOut('<div class="gullAccDis">'+ gullChkFld("checkAccess",'AD,') + 'Access For Disabled</div>'); gullOut('<div class="gullBaby">'+ gullChkFld("checkBaby" ) + 'Babysitting Facilities</div>'); gullOut('<div class="gullWiFi">'+ gullChkFld("checkWIFI" ) + 'WIFI Internet Access</div>'); gullOut('<div class="gullPriv">'+ gullChkFld("checkPrivate" ) + 'Private Car Parking</div>'); gullOut('<div class="gullSpa">'+ gullChkFld("checkSpa") + 'Spa</div>'); gullOut('</div>'); gullOut('<div class="gullFacCol2">'); gullOut('<div class="gullConf">'+ gullChkFld("checkConference") + 'Conference Facilities</div>'); gullOut('<div class="gullSwim">'+ gullChkFld("checkSwimming") + 'Swimming pool</div>'); gullOut('<div class="gullPets">'+ gullChkFld("checkPetsinside") + 'Pets Welcome Inside</div>'); gullOut('<div class="gullLift">'+ gullChkFld("checkLift") + 'Lift</div>'); gullOut('<div class="gullAirCon">'+ gullChkFld("checkAirCon") + 'Air Conditioning</div>'); gullOut('</div'); gullOut('<div class="gullFacilHid"><input type="hidden" id="strfacilities" name="strfacilities" /></div></div>');}
gullOut('<input type="button" class="gullBtnSearch" id="Search_Button" value=""  alt="Check Availability" onclick="subx()" /></div>'); InitUnobtrusiveJavaScriptFunctions(); gullSetupAutoComplete();}
function subx()
{ var gullYearMonth = getField('date_sel_mm').value.split("|"); var gullYear = gullYearMonth[0]; var gullMonth = gullYearMonth[1]; var gullDaySel = getField('date_sel_dd').value; var gullLocation = getField('hdnLocation'); var gullUrl = getField('hdnBookingURL').value; var gullAffiliateID = getField('hdnAffiliateID').value; var gullProviderID = getField( 'hdnProviderID').value; var gullNumAdults = getField('gullSelNumAdults').value; var gullNumChildren = getField('selNumChildren'); var gullNumInfants = getField('selNumInfants'); var gullNumNights = getField('gullSelNumNights'); var gullTypedSearch = getField('hdnTypedSearch'); var gullHasTypedLocation = getField('gullTypedLocation'); var gullPremName = getField('txtPremName'); if((gullTypedSearch.value == '' || gullTypedSearch.value == '/') && gullHasTypedLocation && gullHasTypedLocation.value != '')
{ var gullTypedSearchXmlMatch = checkTypedLocation(gullHasTypedLocation.value); if(gullTypedSearchXmlMatch != "")
{ gullTypedSearch.value = gullTypedSearchXmlMatch;}
}
if(isValidDate(gullDaySel,gullMonth-1,gullYear))
{ var deepLink; if (( gullLocation.value == '' && (gullTypedSearch.value == '' || gullTypedSearch.value == '/') && gullPremName.value == ''))
{ alert('Please select a location.'); gullLocation.focus(); return;}
deepLink = gullUrl + "?affiliatevisitid=1" + "&affiliateid=" + gullAffiliateID + "&ProvID=" + gullProviderID + "&IsAdvanced=1"; if (gullTypedSearch.value == '' || gullTypedSearch.value == '/')
{ var gullTownLevel = getField('hdnTownLevel'); var gullTown = getField('gullSelTowns'); if(gullTownLevel.value=='yes' && gullTown.value != 'Any Town' && gullTown.value != '')
{ deepLink += "&hdnLocation=" + gullTown.value;}
else
{ deepLink += "&hdnLocation=" + gullLocation.value;}
}
else
{ deepLink += "&hdnLocation=" + gullTypedSearch.value;}
var gullTypeShowHide = getField('hdnPremTypeShow'); if(gullTypeShowHide.value=="yes"){ var gullAccomType = getField('gullSelAccomType'); deepLink += "&selAccomType=" + gullAccomType.value;}
else
{ var gullAccomType = getField('hdnPremType2'); deepLink += "&selAccomType=" + gullAccomType.value;}
deepLink += "&selArriveDay=" + gullDaySel; deepLink += "&selArriveMonth=" + gullMonth; deepLink += "&selArriveYear=" + gullYear; deepLink += "&selNumAdults=" + gullNumAdults; if(gullNumChildren == undefined)
{ deepLink += "&selNumChildren=0";}
else
{ deepLink += "&selNumChildren=" + gullNumChildren.value;}
if(gullNumInfants == undefined)
{ deepLink += "&selNumInfants=0";}
else
{ deepLink += "&selNumInfants=" + gullNumInfants.value;}
deepLink += "&selNumNights=" + gullNumNights.value; var gullFacilities = getField('hdnFacilities'); if(gullFacilities.value =='yes')
{ var gullFacPri = getField('checkPrivate'); var gullFacAcc = getField('checkAccess'); var gullFacSpa = getField('checkSpa'); var gullFacBab = getField('checkBaby'); var gullFacCon = getField('checkConference'); var gullFacWif = getField('checkWIFI'); var gullFacSwm = getField('checkSwimming'); var gullFacPet = getField('checkPetsinside'); var gullFacLift = getField('checkLift'); var gullFacAirCon = getField('checkAirCon'); var s = new String(''); if ((gullFacPri) && (gullFacPri.checked))
s += "PC,"; if ((gullFacAcc) && (gullFacAcc.checked))
s += "AD,"; if ((gullFacSpa) && (gullFacSpa.checked))
s += "S2,"; if ((gullFacBab) && (gullFacBab.checked))
s += "BS,"; if ((gullFacCon) && (gullFacCon.checked))
s += "CF,"; if ((gullFacWif) && (gullFacWif.checked))
s += "WI,"; if ((gullFacSwm) && (gullFacSwm.checked))
s += "SO,"; if ((gullFacPet) && (gullFacPet.checked))
s += "PW,"; if ((gullFacLift) && (gullFacPet.checked))
s += "LF,"; if ((gullFacAirCon) && (gullFacPet.checked))
s += "AC,"; if (s!='')
{ deepLink += "&strfacilities=" + s;}
}
var gullIsShare = getField('hdnSharing'); if(gullIsShare.value == 'yes')
{ var gullShare = getField('gullSelSharing'); deepLink += "&selSharing=" + gullShare.value;}
var gullShowPrice = getField('hdnPrice'); if(gullShowPrice.value=='yes')
{ var gullPriceFrom = getField('txtPriceFrom'); var gullPriceTo = getField('txtPriceTo'); if(gullPriceTo.value == '')
{ deepLink += "&selPriceUpper=5000";}
else
{ deepLink += "&selPriceUpper=" + gullPriceTo.value;}
if(gullPriceFrom.value == '')
{ deepLink += "&selPriceLower=0";}
else
{ deepLink += "&selPriceLower=" + gullPriceFrom.value;}
}
var gullShowPremName = getField('hdnPremName'); if(gullShowPremName.value=='yes' && gullPremName.value!='')
{ deepLink += "&txtPremName=" + gullPremName.value;}
var gullShowPremGrade = getField('hdnGrade'); if(gullShowPremGrade.value=='yes')
{ var gullGradeAll = getField('chkGradeAll'); var gullGrade1 = getField('chkGrade1'); var gullGrade2 = getField('chkGrade2'); var gullGrade3 = getField('chkGrade3'); var gullGrade4 = getField('chkGrade4'); var gullGrade5 = getField('chkGrade5'); if (gullGradeAll.checked){ deepLink += "&chkGradeAll=" + gullGradeAll.value;}
else{deepLink += "&chkGradeAll=N";}
if (gullGrade1.checked){ deepLink += "&chkGrade1=" + gullGrade1.value;}
else{deepLink += "&chkGrade1=N";}
if (gullGrade2.checked){ deepLink += "&chkGrade2=" + gullGrade2.value;}
else{deepLink += "&chkGrade2=N";}
if (gullGrade3.checked){ deepLink += "&chkGrade3=" + gullGrade3.value;}
else{deepLink += "&chkGrade3=N";}
if (gullGrade4.checked){ deepLink += "&chkGrade4=" + gullGrade4.value;}
else{deepLink += "&chkGrade4=N";}
if (gullGrade5.checked){ deepLink += "&chkGrade5=" + gullGrade5.value;}
else{deepLink += "&chkGrade5=N";}
}
var gullHasOptional = getField('hdnoptional'); if (gullHasOptional.value!='' && gullHasOptional.value!='/')
{ deepLink += "&" + gullHasOptional.value;}
deepLink += "&strAction=search" + "&intInterPageSearchType=9" + "&intDirectPremSpecificSearch=0" + "&strDirectSearchRootURL=" + document.location.href + "&selCurrency=978" + "&SearchSource=10"; if(gullHasTypedLocation)
{ gullHasTypedLocation.value = '';}
gullTypedSearch.value = ''; window.location.href = deepLink;}
}
function isValidDate(day,month,year)
{ var dteDate; var todaysDateTime; todaysDateTime = new Date(); dteDate=new Date(year,month,day,"23","59","59"); if (dteDate>=todaysDateTime)
{ return ((day==dteDate.getDate()) && (month==dteDate.getMonth()) && (year==dteDate.getFullYear()));}
else
{ return false;}
}
function showhideDiv(div)
{ var gullBasicOptionDiv = getField('gullBasic'); var gullOptGradeDiv = getField('gullOptContainer'); var gullFacilitiesDiv = getField('gullFac'); var gullBasicTab = getField('gullBasicTab'); var gullOptTab = getField('gullOptionTab'); var gullFacilTab = getField('gullFacilitisTab'); if(div == 'gullBasic')
{ gullBasicOptionDiv.style.display = 'block'; if(gullOptGradeDiv)
gullOptGradeDiv.style.display = 'none'; if(gullFacilitiesDiv)
gullFacilitiesDiv.style.display = 'none'; gullBasicTab.className = 'gullCurrentTab'; if(gullOptTab)
gullOptTab.className = ''; if(gullFacilTab)
gullFacilTab.className = '';}
else if(div == 'gullOptContainer')
{ gullBasicOptionDiv.style.display = 'none'; if(gullOptGradeDiv)
gullOptGradeDiv.style.display = 'block'; if(gullFacilitiesDiv)
gullFacilitiesDiv.style.display = 'none'; gullBasicTab.className = ''; if(gullOptTab)
gullOptTab.className = 'gullCurrentTab'; if(gullFacilTab)
gullFacilTab.className = '';}
else if(div == 'gullFac')
{ gullBasicOptionDiv.style.display = 'none'; if(gullOptGradeDiv)
gullOptGradeDiv.style.display = 'none'; if(gullFacilitiesDiv)
gullFacilitiesDiv.style.display = 'block'; gullBasicTab.className = ''; if(gullOptTab)
gullOptTab.className = ''; if(gullFacilTab)
gullFacilTab.className = 'gullCurrentTab';}
var gullListArea = getField('as_gullTypedLocation'); if (gullListArea)
{ gullListArea.style.visibility = "hidden";}
return false;}
function gullSetSelectedIndex(DropDownControlID, ValueToMatch)
{ if (ValueToMatch!='')
{ for(var i=0;i< getField(DropDownControlID).length;i++)
{ var ddlText = getField(DropDownControlID).options[i].value; if( ddlText == ValueToMatch)
{ getField(DropDownControlID).selectedIndex=i; break;}
}
}
else
{ getField(DropDownControlID).selectedIndex = 0;}
}
function gullOut(Html)
{ document.write(Html);}
function gullOption(value, text)
{ gullOut('<option value=' + value + '>' + text + '</option>');}
function createNumericOnlyOption(maxOption, selectedNum)
{ for (var Count = 1; Count <= maxOption; Count ++)
{ if(Count == selectedNum)
{ gullOut('<option value=' + Count + ' selected="selected">' + Count + '</option>');}
else
{ gullOut('<option value=' + Count + '>' + Count + '</option>');}
}
}
function getField(ID)
{ return document.getElementById(ID);}
function gullHidFld(idName, value)
{ gullOut('<input type="hidden" id="'+ idName + '" name="'+ idName + '" value=' + value + ' />');}
function gullChkFld(idName, value)
{ if(value)
{ return '<input type="checkbox" value="'+value+'" id="' + idName + '" name="' + idName + '" />';}
else
{ return '<input type="checkbox" value="Y" id="' + idName + '" name="' + idName + '" />';}
}
function gullHideIE6DropDowns(numberOfMatches)
{ if(numberOfMatches <= 1 || numberOfMatches >= 6)
getField("hdnLocation").className = 'gullHide'; if(numberOfMatches == 2 || numberOfMatches >= 6)
getField("gullSelTowns").className = 'gullHide'; if(numberOfMatches == 3 || numberOfMatches >= 6)
getField("gullSelAccomType").className = 'gullHide'; if(numberOfMatches == 4 || numberOfMatches >= 6)
getField("selNumChildren").className = 'gullHide'; if(numberOfMatches == 4 || numberOfMatches >= 6)
getField("gullSelNumAdults").className = 'gullHide'; if(numberOfMatches == 5 || numberOfMatches >= 6)
getField("date_sel_dd").className = 'gullHide'; if(numberOfMatches == 5 || numberOfMatches >= 6)
getField("date_sel_mm").className = 'gullHide'; if(numberOfMatches >= 6 || numberOfMatches >= 6)
getField("gullSelNumNights").className = 'gullHide';}
function gullShowIE6DropDowns()
{ getField("hdnLocation").className = 'gullLocationCombo'; getField("gullSelTowns").className = 'gullTowns'; getField("gullSelAccomType").className = 'gullPremType'; getField("selNumChildren").className = 'gullNumChildren'; getField("gullSelNumAdults").className = 'gullNumAdults'; getField("date_sel_dd").className = 'gullDays'; getField("date_sel_mm").className = 'gullMonthYear'; getField("gullSelNumNights").className = 'gullNumNight';}
function InitUnobtrusiveJavaScriptFunctions()
{ var gullAccomType = getField('gullSelAccomType'); if (gullAccomType)
{ gullAccomType.onchange = function () { var gullNumNight = getField('gullSelNumNights'); if(gullAccomType.value == 2)
gullNumNight.value = 7; else
{ gullNumNight.value = 1;}
}
}
}
var datePickerController; (function() { datePicker.isSupported = typeof document.createElement != "undefined" && typeof document.documentElement != "undefined" && typeof document.documentElement.offsetWidth == "number"; datePicker.languageinfo = 'en'; datePicker.months = ["January","February","March","April","May","June","July","August","September","October","November","December"]; datePicker.fullDay = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]; datePicker.titles = ["Previous month","Next month","Previous year","Next year", "Close", "Show Calendar"]; datePicker.daysPerMonth = [31,28,31,30,31,30,31,31,30,31,30,31]; datePicker.getDaysPerMonth = function(nMonth, nYear) { nMonth = (nMonth + 12) % 12; var res = datePicker.daysPerMonth[nMonth]; if(((0 == (nYear%4)) && ((0 != (nYear%100)) || (0 == (nYear%400)))) && nMonth == 1)
{ res = 29;}; return res;}; function datePicker(options) { this.defaults = {}; for(opt in options) { this[opt] = this.defaults[opt] = options[opt];}; this.date = new Date(); this.yearinc = 1; this.timer = null; this.pause = 1000; this.timerSet = false; this.opacity = 0; this.opacityTo = 0; this.fadeTimer = null; this.interval = new Date(); this.firstDayOfWeek = this.defaults.firstDayOfWeek = 0; this.dateSet = null; this.visible = false; this.ondisplay = false; this.disabledDates = []; this.enabledDates = []; this.div; this.table; var o = this; o.events = { onkeydown: function (e) { o.stopTimer(); if(!o.visible) return false; if(e == null) e = document.parentWindow.event; var kc = e.keyCode ? e.keyCode : e.charCode; if( kc == 13 ) { o.returnFormattedDate(); o.hide(); return o.killEvent(e);} else if(kc == 27) { o.hide(); return o.killEvent(e);} else if(kc == 32 || kc == 0) { o.date = new Date(); o.updateTable(); return o.killEvent(e);}; if ((kc > 49 && kc < 56) || (kc > 97 && kc < 104)) { if (kc > 96) kc -= (96-48); kc -= 49; o.firstDayOfWeek = (o.firstDayOfWeek + kc) % 7; o.updateTable(); return o.killEvent(e);}; if ( kc < 37 || kc > 40 ) return true; var d = new Date( o.date ).valueOf(); if ( kc == 37 ) { if( e.ctrlKey ) { d = new Date( o.date ); d.setDate( Math.min(d.getDate(), datePicker.getDaysPerMonth(d.getMonth() - 1,d.getFullYear())) ); d.setMonth( d.getMonth() - 1 );} else { d = new Date( o.date.getFullYear(), o.date.getMonth(), o.date.getDate() - 1 );};} else if ( kc == 39 ) { if( e.ctrlKey ) { d = new Date( o.date ); d.setDate( Math.min(d.getDate(), datePicker.getDaysPerMonth(d.getMonth() + 1,d.getFullYear())) ); d.setMonth( d.getMonth() + 1 );} else { d = new Date( o.date.getFullYear(), o.date.getMonth(), o.date.getDate() + 1 );};} else if ( kc == 38 ) { if( e.ctrlKey ) { d = new Date( o.date ); d.setDate( Math.min(d.getDate(), datePicker.getDaysPerMonth(d.getMonth(),d.getFullYear() + 1)) ); d.setFullYear( d.getFullYear() + 1 );} else { d = new Date( o.date.getFullYear(), o.date.getMonth(), o.date.getDate() - 7 );};} else if ( kc == 40 ) { if( e.ctrlKey ) { d = new Date( o.date ); d.setDate( Math.min(d.getDate(), datePicker.getDaysPerMonth(d.getMonth(),d.getFullYear() - 1)) ); d.setFullYear( d.getFullYear() - 1 );} else { d = new Date( o.date.getFullYear(), o.date.getMonth(), o.date.getDate() + 7 );};}; var tmpDate = new Date( d ); if(o.outOfRange(tmpDate)) return o.killEvent(e); var cacheDate = new Date(o.date); o.date = tmpDate; if(cacheDate.getFullYear() != o.date.getFullYear() || cacheDate.getMonth() != o.date.getMonth()) o.updateTable(); else { o.disableTodayButton(); var tds = o.table.getElementsByTagName('td'); var txt; var start = o.date.getDate() - 6; if(start < 0) start = 0; for(var i = start, td; td = tds[i]; i++) { txt = Number(td.firstChild.nodeValue); if(isNaN(txt) || txt != o.date.getDate()) continue; var el = document.getElementById("date-picker-hover"); if(el) el.id = ""; td.id = "date-picker-hover";}; setTimeout("datePickerController.focusTD()",0);}; return o.killEvent(e);}, gotoToday: function(e) { o.date = new Date( ); o.updateTable(); o.hide();}, onmousedown: function(e) { if ( e == null ) e = document.parentWindow.event; var el = e.target != null ? e.target : e.srcElement; o.stopTimer(); var found = false; while(el.parentNode) { if(el.id && (el.id == 'fd_' + o.id || el.id == o.id + '_fd_but')) { found = true; break;}; try { el = el.parentNode;} catch(err) { break;};}; if(found) return true; datePickerController.hideAll();}, onmouseover: function(e) { o.stopTimer(); if(document.getElementById("date-picker-hover")) { document.getElementById("date-picker-hover").id = "";}; this.id = "date-picker-hover"; o.date.setDate(this.firstChild.nodeValue); o.disableTodayButton(); setTimeout("datePickerController.focusTD()",0);}, onclick: function (e) { if(o.opacity != o.opacityTo) return false; if ( e == null ) e = document.parentWindow.event; var el = e.target != null ? e.target : e.srcElement; while ( el.nodeType != 1 ) el = el.parentNode; var d = new Date( o.date ); var n = Number( el.firstChild.data ); if(isNaN(n)) { return true;}; d.setDate( n ); o.date = d; o.returnFormattedDate(); o.hide(); o.stopTimer(); return o.killEvent(e);}, incDec: function(e) { if ( e == null ) e = document.parentWindow.event; var el = e.target != null ? e.target : e.srcElement; o.stopTimer(); if(el && el.className && el.className.search('disabled') != -1) { return false;}
datePickerController.addEvent(document, "mouseup", o.events.clearTimer); o.timerInc = 1000; o.dayInc = arguments[1]; o.yearInc = arguments[2]; o.monthInc = arguments[3]; o.onTimer(); o.startTimer(); return o.killEvent(e);}, clearTimer: function(e) { o.stopTimer(); o.stopped = true; o.timerInc = 1000; o.yearInc = 0; o.monthInc = 0; o.dayInc = 0;}
}; o.reset = function() { for(def in o.defaults) { o[def] = o.defaults[def];};}; o.setOpacity = function(op) { o.div.style.opacity = op/100; o.div.style.filter = 'alpha(opacity=' + op + ')'; o.opacity = op;}; o.fade = function() { window.clearTimeout(o.fadeTimer); o.fadeTimer = null; delete(o.fadeTimer); var diff = Math.round(o.opacity + ((o.opacityTo - o.opacity) / 4)); o.setOpacity(diff); if(Math.abs(o.opacityTo - diff) > 3 && !o.noFade) { o.fadeTimer = window.setTimeout(o.fade, 50);} else { o.setOpacity(o.opacityTo); if(o.opacityTo == 0) { o.div.style.display = "none"; o.visible = false;} else { o.visible = true;};};}; o.killEvent = function(e) { if(e == null) e = document.parentWindow.event; if(e.stopPropagation) { e.stopPropagation(); e.preventDefault();}
return false;}; o.startTimer = function () { o.timer = window.setTimeout(o.onTimer, o.timerInc); o.timerSet = true;}; o.stopTimer = function () { window.clearTimeout(o.timer); o.timer = null; delete(o.timer); o.timerSet = false;}; o.onTimer = function() { var d = o.date; d.setDate( Math.min(d.getDate()+o.dayInc, datePicker.getDaysPerMonth(d.getMonth()+o.monthInc,d.getFullYear()+o.yearInc)) ); d.setMonth( d.getMonth() + o.monthInc ); d.setFullYear( d.getFullYear() + o.yearInc ); o.date = d; if(o.timerInc > 50) { o.timerInc = 50 + Math.round(((o.timerInc - 50) / 1.8));}; o.updateTable(); if(o.timerSet) o.timer = window.setTimeout(o.onTimer, o.timerInc);}; o.getElem = function() { return document.getElementById(o.id.replace(/^fd-/, '')) || false;}; o.setRangeLow = function(range) { if(String(range).search(/^(\d\d?\d\d)(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$/) == -1) range = ''; o.low = o.defaults.low = range;}; o.setRangeHigh = function(range) { if(String(range).search(/^(\d\d?\d\d)(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$/) == -1) range = ''; o.high = o.defaults.high = range;}; o.setDisabledDays = function(dayArray) { o.disableDays = o.defaults.disableDays = dayArray;}; o.setDisabledDates = function(dateArray) { var fin = []; for(var i = dateArray.length; i-- ;) { if(dateArray[i].match(/^(\d\d\d\d|\*\*\*\*)(0[1-9]|1[012]|\*\*)(0[1-9]|[12][0-9]|3[01])$/) != -1) fin[fin.length] = dateArray[i];}
if(fin.length) { o.disabledDates = fin; o.enabledDates = [];};}; o.setEnabledDates = function(dateArray) { var fin = []; for(var i = dateArray.length; i-- ;) { if(dateArray[i].match(/^(\d\d\d\d|\*\*\*\*)(0[1-9]|1[012]|\*\*)(0[1-9]|[12][0-9]|3[01]|\*\*)$/) != -1 && dateArray[i] != "********") fin[fin.length] = dateArray[i];}; if(fin.length) { o.disabledDates = []; o.enabledDates = fin;};}; o.getDisabledDates = function(y, m) { if(o.enabledDates.length) return o.getEnabledDates(y, m); var obj = {}; var d = datePicker.getDaysPerMonth(m - 1, y); m = m < 10 ? "0" + String(m) : m; for(var i = o.disabledDates.length; i-- ;) { var tmp = o.disabledDates[i].replace("****", y).replace("**", m); if(tmp < Number(String(y)+m+"01") || tmp > Number(y+String(m)+d)) continue; obj[tmp] = 1;}
return obj;}; o.getEnabledDates = function(y, m) { var obj = {}; var d = datePicker.getDaysPerMonth(m - 1, y); m = m < 10 ? "0" + String(m) : m; var day,tmp,de,me,ye,disabled; for(var dd = 1; dd <= d; dd++) { day = dd < 10 ? "0" + String(dd) : dd; disabled = true; for(var i = o.enabledDates.length; i-- ;) { tmp = o.enabledDates[i]; ye = String(o.enabledDates[i]).substr(0,4); me = String(o.enabledDates[i]).substr(4,2); de = String(o.enabledDates[i]).substr(6,2); if(ye == y && me == m && de == day) { disabled = false; break;}
if(ye == "****" || me == "**" || de == "**") { if(ye == "****") tmp = tmp.replace(/^\*\*\*\*/, y); if(me == "**") tmp = tmp = tmp.substr(0,4) + String(m) + tmp.substr(6,2); if(de == "**") tmp = tmp.replace(/\*\*/, day); if(tmp == String(y + String(m) + day)) { disabled = false; break;};};}; if(disabled) obj[String(y + String(m) + day)] = 1;}; return obj;}; o.setFirstDayOfWeek = function(e) { if ( e == null ) e = document.parentWindow.event; var elem = e.target != null ? e.target : e.srcElement; if(elem.tagName.toLowerCase() != "th") { while(elem.tagName.toLowerCase() != "th") elem = elem.parentNode;}
var cnt = 0; while(elem.previousSibling) { elem = elem.previousSibling; if(elem.tagName.toLowerCase() == "th") cnt++;}
o.firstDayOfWeek = (o.firstDayOfWeek + cnt) % 7; o.updateTable(); return o.killEvent(e);}; o.truePosition = function(element) { var pos = o.cumulativeOffset(element); if(window.opera) { return pos;}
var iebody = (document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body; var dsocleft = document.all ? iebody.scrollLeft : window.pageXOffset; var dsoctop = document.all ? iebody.scrollTop : window.pageYOffset; var posReal = o.realOffset(element); var top = pos[1] - posReal[1] + dsoctop; var left = pos[0] - posReal[0] + dsocleft; return [left, top];}; o.realOffset = function(element) { var t = 0, l = 0; do { t += element.scrollTop || 0; l += element.scrollLeft || 0; element = element.parentNode;} while (element); return [l, t];}; o.cumulativeOffset = function(element) { var t = 0, l = 0; do { t += element.offsetTop || 0; l += element.offsetLeft || 0; element = element.offsetParent;} while (element); return [l, t];}; o.resize = function() { if(!o.created || !o.getElem()) return; o.div.style.visibility = "hidden"; o.div.style.left = o.div.style.top = "0px"; o.div.style.display = "block"; var osh = o.div.offsetHeight; var osw = o.div.offsetWidth; o.div.style.visibility = "visible"; o.div.style.display = "none"; var elem = document.getElementById(o.id + '_fd_but'); var pos = o.truePosition(elem); var trueBody = (document.compatMode && document.compatMode!="BackCompat") ? document.documentElement : document.body; if(parseInt(trueBody.clientWidth+trueBody.scrollLeft) < parseInt(osw+pos[0])) { o.div.style.left = Math.abs(parseInt((trueBody.clientWidth+trueBody.scrollLeft) - osw)) + "px";} else { o.div.style.left = pos[0] + "px";}; if(parseInt(trueBody.clientHeight+trueBody.scrollTop) < parseInt(osh+pos[1]+elem.offsetHeight+2)) { o.div.style.top = Math.abs(parseInt(pos[1] - (osh + 2))) + "px";} else { o.div.style.top = Math.abs(parseInt(pos[1] + elem.offsetHeight + 2)) + "px";};}; o.equaliseDates = function() { var clearDayFound = false; var tmpDate; for(var i = o.low; i <= o.high; i++) { tmpDate = String(i); if(!o.disableDays[new Date(tmpDate.substr(0,4), tmpDate.substr(6,2), tmpDate.substr(4,2)).getDay() - 1]) { clearDayFound = true; break;};}; if(!clearDayFound) o.disableDays = o.defaults.disableDays = [0,0,0,0,0,0,0];}; o.outOfRange = function(tmpDate) { if(!o.low && !o.high) return false; var level = false; if(!tmpDate) { level = true; tmpDate = o.date;}; var d = (tmpDate.getDate() < 10) ? "0" + tmpDate.getDate() : tmpDate.getDate(); var m = ((tmpDate.getMonth() + 1) < 10) ? "0" + (tmpDate.getMonth() + 1) : tmpDate.getMonth() + 1; var y = tmpDate.getFullYear(); var dt = String(y)+String(m)+String(d); if(o.low && parseInt(dt) < parseInt(o.low)) { if(!level) return true; o.date = new Date(o.low.substr(0,4), o.low.substr(4,2)-1, o.low.substr(6,2), 5, 0, 0); return false;}; if(o.high && parseInt(dt) > parseInt(o.high)) { if(!level) return true; o.date = new Date( o.high.substr(0,4), o.high.substr(4,2)-1, o.high.substr(6,2), 5, 0, 0);}; return false;}; o.create = function() { var regExpLang = /lang-(af|ar|de|du|en|es|fi|fr|gr|he|it|nl|no|pt|ro|ru|sp|sv|ua)/g; var inputs = document.getElementsByTagName('input'); for(var i=0, inp; inp = inputs[i]; i++) { if(inp.className.search(regExpLang) != -1) { var lang = inp.className.match(regExpLang)[0].replace('lang-', ''); if (lang == 'af') { fdLocale = af_fdLocale;}; if (lang == 'de') { fdLocale = de_fdLocale;}; if (lang == 'du') { fdLocale = du_fdLocale;}; if (lang == 'es') { fdLocale = es_fdLocale;}; if (lang == 'fi') { fdLocale = fi_fdLocale;}; if (lang == 'fr') { fdLocale = fr_fdLocale;}; if (lang == 'it') { fdLocale = it_fdLocale;}; if (lang == 'nl') { fdLocale = nl_fdLocale;}; if (lang == 'no') { fdLocale = no_fdLocale;}; if (lang == 'pt') { fdLocale = pt_fdLocale;}; if (lang == 'ro') { fdLocale = ro_fdLocale;}; if (lang == 'sp') { fdLocale = sp_fdLocale;}; if (lang == 'sv') { fdLocale = sv_fdLocale;}; if (lang == 'en') { fdLocale = en_fdLocale;};};}; function createTH(details) { var th = document.createElement('th'); if(details.thClassName) th.className = details.thClassName; if(details.colspan) { th.setAttribute('colSpan',details.colspan);}; return th;}; function createThAndButton(tr, obj) { for(var i = 0, details; details = obj[i]; i++) { var th = createTH(details); tr.appendChild(th); var but = document.createElement('button'); but.setAttribute("type", "button"); but.className = details.className; but.id = o.id + details.id; but.appendChild(document.createTextNode(details.text)); but.title = details.title || ""; if(details.onmousedown) but.onmousedown = details.onmousedown; if(details.onclick) but.onclick = details.onclick; th.appendChild(but);}
}
if(typeof(fdLocale) == "object" && o.locale) { datePicker.titles = fdLocale.titles; datePicker.months = fdLocale.months; datePicker.fullDay = fdLocale.fullDay; if(fdLocale.dayAbbr) datePicker.dayAbbr = fdLocale.dayAbbr; if(fdLocale.firstDayOfWeek) o.firstDayOfWeek = o.defaults.firstDayOfWeek = fdLocale.firstDayOfWeek;}; o.div = document.createElement('div'); o.div.style.zIndex = 9999; o.div.id = 'fd_'+ o.id; o.div.className = "datePicker"; document.getElementsByTagName('body')[0].appendChild(o.div); var nbsp = String.fromCharCode( 160 ); var tr, row, col, tableHead, tableBody; o.table = document.createElement('table'); o.div.appendChild( o.table ); tableHead = document.createElement('thead'); o.table.appendChild( tableHead ); tr = document.createElement('tr'); tableHead.appendChild(tr); o.titleBar = createTH({thClassName:"date-picker-title", colspan:7}); tr.appendChild( o.titleBar ); tr = null; tr = document.createElement('tr'); tableHead.appendChild(tr); createThAndButton(tr, [{className:"prev-year-but", id:"-prev-year-but", text:"", title:datePicker.titles[2], onmousedown:function(e) { o.events.incDec(e,0,-1,0);}},{className:"prev-month-but", id:"-prev-month-but", text:"<<", title:datePicker.titles[0], onmousedown:function(e) { o.events.incDec(e,0,0,-1);}},{colspan:3, className:"today-but", id:"-today-but", text:datePicker.titles.length > 4 ? datePicker.titles[4] : "Today", onclick:o.events.test},{className:"next-month-but", id:"-next-month-but", text:">>", title:datePicker.titles[1], onmousedown:function(e) { o.events.incDec(e,0,0,1);}},{className:"next-year-but", id:"-next-year-but", text:"", title:datePicker.titles[3], onmousedown:function(e) { o.events.incDec(e,0,1,0);}}]); tableBody = document.createElement('tbody'); o.table.appendChild( tableBody ); for(var rows = 0; rows < 7; rows++) { row = document.createElement('tr'); if(rows != 0) tableBody.appendChild(row); else tableHead.appendChild(row); for(var cols = 0; cols < 7; cols++) { col = (rows == 0) ? document.createElement('th') : document.createElement('td'); if(rows > 0) col.setAttribute("tabIndex", "-1"); row.appendChild(col); if(rows != 0) { col.appendChild(document.createTextNode(nbsp));} else { col.className = "date-picker-day-header"; col.scope = "col";}; col = null;}; row = null;}; tableBody = tableHead = tr = createThAndButton = createTH = null; o.created = true;}; o.setDateFromInput = function() { function m2c(val) { return String(val).length < 2 ? "00".substring(0, 2 - String(val).length) + String(val) : val;}; o.dateSet = null; var elem = o.getElem(); if(!elem) return; if(!o.splitDate) { var date = datePickerController.dateFormat(elem.value, o.format.search(/m-d-y/i) != -1);} else { var mmN = document.getElementById(o.id+'_mm'); var ddN = document.getElementById(o.id+'_dd'); var tm = (mmN.tagName.toLowerCase() == "input" ? mmN.value || new Date().getMonth() + 1 : mmN.options[mmN.selectedIndex].value); var mm_yyyy = tm.split('|'); tm = mm_yyyy[1]; var td = parseInt(ddN.tagName.toLowerCase() == "input" ? ddN.value || new Date().getDate() : ddN.options[ddN.selectedIndex].value, 10); var ty = parseInt(elem.tagName.toLowerCase() == "input" ? elem.value || new Date().getFullYear() : elem.options[elem.selectedIndex].value); ty = mm_yyyy[0]; if(tm > 0 && tm < 13 && String(ty).search(/^([0-9]{4})$/) != -1) { var dpm = datePicker.getDaysPerMonth(tm - 1, ty); if(isNaN(td) || td > dpm || td < 1) td = m2c(dpm);}; var date = datePickerController.dateFormat(tm + "/" + td + "/" + ty, true);}; if(!date) { date = String(new Date().getFullYear()) + m2c(new Date().getMonth() + 1) + m2c(new Date().getDate());}
var d,m,y; y = date.substr(0, 4); m = date.substr(4, 2); d = date.substr(6, 2); if(!y || !m || !d || new Date( y, m - 1, d ) == 'Invalid Date' || new Date( y, m - 1, d ) == 'NaN') { o.date = new Date(); o.date.setHours(5); return;}; o.date.setFullYear(y); o.date.setMonth(m-1); o.date.setDate(d); o.dateSet = new Date(o.date); m2c = null;}; o.returnFormattedDate = function() { var elem = o.getElem(); if(!elem) return; var d = (o.date.getDate() < 10) ? "0" + o.date.getDate() : o.date.getDate(); var m = ((o.date.getMonth() + 1) < 10) ? "0" + (o.date.getMonth() + 1) : o.date.getMonth() + 1; var yyyy = o.date.getFullYear(); var disabledDates = o.getDisabledDates(yyyy, m); var weekDay = ( o.date.getDay() + 6 ) % 7; if(!(o.disableDays[weekDay] || String(yyyy)+m+d in disabledDates)) { if(o.splitDate || o.splitSubDate) { if (o.splitDate) { var ddE = document.getElementById(o.id+'_dd'); var mmE = document.getElementById(o.id+'_mm'); if(ddE.tagName.toLowerCase() == "input") { ddE.value = d;}
else { ddE.selectedIndex = d - 1;}; if(mmE.tagName.toLowerCase() == "input") { mmE.value = m;}
else { mmE.selectedIndex = m - 1; for (var i = 0; i < mmE.options.length; i++) { if (mmE.options[i].value == (yyyy + '|' + m)) { mmE.selectedIndex = i; break;}
}
}; if(elem.tagName.toLowerCase() == "input") elem.value = yyyy; else { for(var opt = 0; opt < elem.options.length; opt++) { if(elem.options[opt].value == yyyy) { elem.selectedIndex = opt; break;};};}; document.getElementById(o.id+'_dd').focus(); if(document.getElementById(o.id+'_dd').onchange) document.getElementById(o.id+'_dd').onchange(); if(document.getElementById(o.id+'_mm').onchange) document.getElementById(o.id+'_mm').onchange();}
if (o.splitSubDate) { var ddE = document.getElementById(o.id+'_day'); var mmE = document.getElementById(o.id); if(ddE.tagName.toLowerCase() == "input") { ddE.value = d;}
else { ddE.selectedIndex = d - 1;}; var strMonthYear = datePicker.months[m-1].substring(0,3) + ' ' + yyyy; var strMonthYear = yyyy + '-' + m; if(mmE.tagName.toLowerCase() == "input") { mmE.value = strMonthYear;}
else { for(var i = 0, opt; opt = mmE[i]; i++) { if (opt.value == strMonthYear) { mmE.selectedIndex = i;}
}
}; document.getElementById(o.id+'_day').focus(); if(document.getElementById(o.id+'_day').onchange) document.getElementById(o.id+'_day').onchange(); if(document.getElementById(o.id).onchange) document.getElementById(o.id).onchange();}
} else { elem.value = o.format.replace('y',yyyy).replace('m',m).replace('d',d).replace(/-/g,o.divider); elem.focus();}; if(elem.onchange) elem.onchange();};}; o.disableTodayButton = function() { var today = new Date(); document.getElementById(o.id + "-today-but").className = document.getElementById(o.id + "-today-but").className.replace("fd-disabled", ""); if(o.outOfRange(today) || (o.date.getDate() == today.getDate() && o.date.getMonth() == today.getMonth() && o.date.getFullYear() == today.getFullYear())) { document.getElementById(o.id + "-today-but").className; document.getElementById(o.id + "-today-but").onclick = o.events.gotoToday;} else { document.getElementById(o.id + "-today-but").onclick = o.events.gotoToday;};}; o.updateTable = function() { if(document.getElementById("date-picker-hover")) { document.getElementById("date-picker-hover").id = "";}; if("onupdate" in datePickerController && typeof(datePickerController.onupdate) == "function") datePickerController.onupdate(o); var i; var str = ""; var rows = 6; var cols = 7; var currentWeek = 0; var nbsp = String.fromCharCode( 160 ); var cells = new Array( rows ); for ( i = 0; i < rows; i++ ) { cells[i] = new Array( cols );}; o.outOfRange(); o.disableTodayButton(); var tmpDate = new Date( o.date.getFullYear(), o.date.getMonth(), 2 ); tmpDate.setHours(5); var m = ((tmpDate.getMonth() + 1) < 10) ? "0" + (tmpDate.getMonth() + 1) : tmpDate.getMonth() + 1; var y = tmpDate.getFullYear(); var disabledDates = o.getDisabledDates(o.date.getFullYear(), o.date.getMonth() + 1); var today = new Date(); document.getElementById(o.id + "-prev-year-but").className = document.getElementById(o.id + "-prev-year-but").className.replace("fd-disabled", ""); if(o.outOfRange(new Date((y - 1), Number(m)-1, datePicker.getDaysPerMonth(Number(m)-1, y-1)))) { document.getElementById(o.id + "-prev-year-but").className += " fd-disabled"; o.yearInc = 0;}; document.getElementById(o.id + "-prev-month-but").className = document.getElementById(o.id + "-prev-month-but").className.replace("fd-disabled", ""); if(o.outOfRange(new Date(y, (Number(m) - 2), datePicker.getDaysPerMonth(Number(m)-2, y)))) { document.getElementById(o.id + "-prev-month-but").className += " fd-disabled"; o.monthInc = 0;}; document.getElementById(o.id + "-next-year-but").className = document.getElementById(o.id + "-next-year-but").className.replace("fd-disabled", ""); if(o.outOfRange(new Date((y + 1), Number(m) - 1, 1))) { document.getElementById(o.id + "-next-year-but").className += " fd-disabled"; o.yearInc = 0;}; document.getElementById(o.id + "-next-month-but").className = document.getElementById(o.id + "-next-month-but").className.replace("fd-disabled", ""); if(o.outOfRange(new Date(y, Number(m), 1))) { document.getElementById(o.id + "-next-month-but").className += " fd-disabled"; o.monthInc = 0;}; var titleText = datePicker.months[o.date.getMonth()] + nbsp + o.date.getFullYear(); while(o.titleBar.firstChild) o.titleBar.removeChild(o.titleBar.firstChild); var span = document.createElement('span'); span.appendChild(document.createTextNode(datePicker.months[o.date.getMonth()] + nbsp)); span.className = "month-display"; o.titleBar.appendChild(span); span = null; span = document.createElement('span'); span.appendChild(document.createTextNode(o.date.getFullYear())); span.className = "year-display"; o.titleBar.appendChild(span); span = null; for ( i = 1; i < 32; i++ ) { tmpDate.setDate( i ); var weekDay = ( tmpDate.getDay() + 6 ) % 7; var colIndex = ( (weekDay - o.firstDayOfWeek) + 7 ) % 7; var cell = { text:"", className:"", id:"" }; var d = (tmpDate.getDate() < 10) ? "0" + tmpDate.getDate() : tmpDate.getDate(); var dt = String(y)+m+d; if ( tmpDate.getMonth() == o.date.getMonth() ) { cells[currentWeek][colIndex] = { text:"", className:"", id:"" }; var isToday = tmpDate.getDate() == today.getDate() &&
tmpDate.getMonth() == today.getMonth() &&
tmpDate.getFullYear() == today.getFullYear(); if ( o.dateSet != null && o.dateSet.getDate() == tmpDate.getDate() && o.dateSet.getMonth() == tmpDate.getMonth() && o.dateSet.getFullYear() == tmpDate.getFullYear()) { cells[currentWeek][colIndex].className = "date-picker-selected-date";}; if ( o.date.getDate() == tmpDate.getDate() && o.date.getFullYear() == tmpDate.getFullYear()) { cells[currentWeek][colIndex].id = "date-picker-hover";}; if(o.highlightDays[weekDay]) { cells[currentWeek][colIndex].className += " date-picker-highlight";}; if ( isToday ) { cells[currentWeek][colIndex].className = "date-picker-today";}; if(o.outOfRange(tmpDate)) { cells[currentWeek][colIndex].className = "out-of-range";} else if(o.disableDays[weekDay] || dt in disabledDates) { cells[currentWeek][colIndex].className = "day-disabled";}; cells[currentWeek][colIndex].text = tmpDate.getDate(); cells[currentWeek][colIndex].className += " dm-" + tmpDate.getDate() + '-' + tmpDate.getMonth() + " " + " dmy-" + tmpDate.getDate() + '-' + tmpDate.getMonth() + '-' + tmpDate.getFullYear(); if ( colIndex == 6 ) currentWeek++;};}; var lnk, d, butt; var ths = o.table.getElementsByTagName('thead')[0].getElementsByTagName('tr')[2].getElementsByTagName('th'); for ( var y = 0; y < 7; y++ ) { d = (o.firstDayOfWeek + y) % 7; butt = ths[y].getElementsByTagName("button"); if(butt.length && butt.length > 0) butt[0].onclick = butt.onkeypress = null; while(ths[y].firstChild) ths[y].removeChild(ths[y].firstChild); ths[y].title = datePicker.fullDay[d]; if(y > 0) { but = document.createElement("BUTTON"); but.className = "fd-day-header"; but.onclick = but.onkeypress = ths[y].onclick = o.setFirstDayOfWeek; but.appendChild(document.createTextNode(datePicker.dayAbbr ? datePicker.dayAbbr[d] : datePicker.fullDay[d].charAt(0))); ths[y].appendChild(but); but.title = datePicker.fullDay[d]; but = null;} else { ths[y].appendChild(document.createTextNode(datePicker.dayAbbr ? datePicker.dayAbbr[d] : datePicker.fullDay[d].charAt(0))); ths[y].onclick = null;};}; var trs = o.table.getElementsByTagName('tbody')[0].getElementsByTagName('tr'); var tmpCell; for ( var y = 0; y < rows; y++ ) { var tds = trs[y].getElementsByTagName('td'); for (var x = 0; x < cols; x++) { tmpCell = tds[x]; while(tmpCell.firstChild) tmpCell.removeChild(tmpCell.firstChild); if ( typeof cells[y][x] != "undefined" ) { tmpCell.className = cells[y][x].className; tmpCell.id = cells[y][x].id; tmpCell.appendChild(document.createTextNode(cells[y][x].text)); if(cells[y][x].className.search(/out-of-range/) == -1) { tmpCell.onmouseover = o.events.onmouseover; tmpCell.onclick = cells[y][x].className.search(/day-disabled/) == -1 ? o.events.onclick : null; tmpCell.title = datePicker.months[o.date.getMonth()] + nbsp + cells[y][x].text + "," + nbsp + o.date.getFullYear();} else { tmpCell.onmouseover = null; tmpCell.onclick = null; tmpCell.title = "";};} else { tmpCell.className = "date-picker-unused"; tmpCell.id = ""; tmpCell.onmouseover = null; tmpCell.onclick = null; tmpCell.appendChild(document.createTextNode(nbsp)); tmpCell.title = "";};};}; setTimeout("datePickerController.focusTD()",0);}; o.init = function() { if(o.low && o.high && (o.high - o.low < 7)) { o.equaliseDates();}
o.setDateFromInput(); o.fade();}; o.show = function() { var elem = o.getElem(); if(!elem || o.visible || elem.disabled) return; o.reset(); o.setDateFromInput(); o.updateTable(); o.resize(); datePickerController.addEvent(document, "mousedown", o.events.onmousedown); datePickerController.addEvent(document, "keypress", o.events.onkeydown); if(window.devicePixelRatio) { datePickerController.removeEvent(document, "keypress", o.events.onkeydown); datePickerController.addEvent(document, "keydown", o.events.onkeydown);}
o.opacityTo = o.noFade ? 99 : 90; o.div.style.display = "block"; o.fade(); o.visible = true;}; o.hide = function() { if(!o.visible) return; o.stopTimer(); try { datePickerController.removeEvent(document, "mousedown", o.events.onmousedown);} catch(e) { }; try { datePickerController.removeEvent(document, "mouseup", o.events.clearTimer);} catch(e) { }; try { datePickerController.removeEvent(document, "keypress", o.events.onkeydown);} catch(e) { }; try { datePickerController.removeEvent(document, "keydown", o.events.onkeydown);} catch(e) { }; o.opacityTo = 0; o.fade(); o.visible = false; var elem = o.getElem(); try { if(elem) elem.focus();} catch(e) { };}; o.destroy = function() { try { datePickerController.removeEvent(document, "mousedown", o.events.onmousedown);} catch(e) { }; try { datePickerController.removeEvent(document, "mouseup", o.events.clearTimer);} catch(e) { }; try { datePickerController.removeEvent(document, "keypress", o.events.onkeydown);} catch(e) { }; try { datePickerController.removeEvent(document, "keydown", o.events.onkeydown);} catch(e) { }; var ths = o.table.getElementsByTagName("th"); for(var i = 0, th; th = ths[i]; i++) { th.onmouseover = th.onmouseout = th.onmousedown = th.onclick = null;}
var tds = o.table.getElementsByTagName("td"); for(var i = 0, td; td = tds[i]; i++) { td.onmouseover = td.onclick = null;}
var butts = o.table.getElementsByTagName("button"); for(var i = 0, butt; butt = butts[i]; i++) { butt.onmousedown = butt.onclick = butt.onkeypress = null;}
clearTimeout(o.fadeTimer); clearTimeout(o.timer); o.fadeTimer = o.timer = null; if(document.getElementById(o.id.replace(/^fd-/, '_fd_but'))) { var butt = document.getElementById(o.id.replace(/^fd-/, '_fd_but')); butt.onclick = butt.onpress = null;}
o.titleBar = o.table = o.div = null; o = null;}; o.create(); o.init();}; datePickerController = { datePickers: {}, addEvent: function(obj, type, fn, tmp) { tmp || (tmp = true); if( obj.attachEvent ) { obj["e"+type+fn] = fn; obj[type+fn] = function(){obj["e"+type+fn]( window.event );}; obj.attachEvent( "on"+type, obj[type+fn] );} else { obj.addEventListener( type, fn, true );};}, removeEvent: function(obj, type, fn, tmp) { tmp || (tmp = true); if( obj.detachEvent ) { obj.detachEvent( "on"+type, obj[type+fn] ); obj[type+fn] = null;} else { obj.removeEventListener( type, fn, true );};}, focusTD: function() { try { if(document.getElementById("date-picker-hover")) document.getElementById("date-picker-hover").focus();} catch(e) { }
}, hideAll: function(exception) { for(dp in datePickerController.datePickers) { if(exception && exception == datePickerController.datePickers[dp].id) { continue;}; if(document.getElementById(datePickerController.datePickers[dp].id)) { datePickerController.datePickers[dp].hide();};};}, cleanUp: function() { var dp; for(dp in datePickerController.datePickers) { if(!document.getElementById(datePickerController.datePickers[dp].id)) { dpElem = document.getElementById('fd_'+datePickerController.datePickers[dp].id); datePickerController.datePickers[dp].destroy(); datePickerController.datePickers[dp] = null; delete datePickerController.datePickers[dp]; if(dpElem) { dpElem.parentNode.removeChild(dpElem);};};};}, destroy: function() { for(dp in datePickerController.datePickers) { datePickerController.datePickers[dp].destroy(); datePickerController.datePickers[dp] = null; delete datePickerController.datePickers[dp];}; datePickerController.datePickers = null; datePicker.script = null; datePickerController.removeEvent(window, 'load', datePickerController.create); datePickerController.removeEvent(window, 'unload', datePickerController.destroy);}, dateFormat: function(dateIn, favourMDY) { var dateTest = [ { regExp:/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/, d:1, m:3, y:5 }, { regExp:/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/, d:3, m:1, y:5 }, { regExp:/^(\d\d\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/, d:5, m:3, y:1 } ]; var start; var cnt = 0; while(cnt < 3) { start = (cnt + (favourMDY ? 4 : 3)) % 3; if(dateIn.match(dateTest[start].regExp)) { res = dateIn.match(dateTest[start].regExp); y = res[dateTest[start].y]; m = res[dateTest[start].m]; d = res[dateTest[start].d]; if(m.length == 1) m = "0" + m; if(d.length == 1) d = "0" + d; if(y.length != 4) y = (parseInt(y) < 50) ? '20' + y : '19' + y; return String(y)+m+d;}; cnt++;}; return 0;}, joinNodeLists: function() { if(!arguments.length) { return [];}
var nodeList = []; for (var i = 0; i < arguments.length; i++) { for (var j = 0, item; item = arguments[i][j]; j++) { nodeList[nodeList.length] = item;};}; return nodeList;}, create: function() { if(!datePicker.isSupported) return; datePickerController.cleanUp(); var inputs = datePickerController.joinNodeLists(document.getElementsByTagName('input'), document.getElementsByTagName('select')); var regExp1 = /disable-days-([1-7]){1,6}/g; var regExp2 = /no-transparency/g; var regExp3 = /highlight-days-([1-7]){1,7}/g; var regExp4 = /range-low-(\d\d\d\d-\d\d-\d\d)/g; var regExp5 = /range-high-(\d\d\d\d-\d\d-\d\d)/g; var regExp6 = /format-(d-m-y|m-d-y|y-m-d)/g; var regExp7 = /divider-(dot|slash|space|dash)/g; var regExp8 = /no-locale/g; var regExp9 = /lang-(af|ar|de|du|en|es|fi|fr|gr|he|it|nl|no|pt|ro|ru|sp|sv|ua)/g; for(var i=0, inp; inp = inputs[i]; i++) { if(inp.className && (inp.className.search(regExp6) != -1 || inp.className.search(/split-date/) != -1 || inp.className.search(/split-sub-date/) != -1) && ((inp.tagName.toLowerCase() == "input" && inp.type == "text") || inp.tagName.toLowerCase() == "select") && inp.name) { if(!inp.id) { if(document.getElementById(inp.name)) continue; inp.id = inp.name;}; var options = { id:inp.id, low:"", high:"", divider:"/", format:"d-m-y", highlightDays:[0,0,0,0,0,1,1], disableDays:[0,0,0,0,0,0,0], locale:inp.className.search(regExp8) == -1, lang:'en', splitDate:0, splitSubDate:0, noFade:inp.className.search(regExp2) != -1
}; if(inp.className.search(/split-date/) != -1) { if(document.getElementById(inp.id+'_dd') && document.getElementById(inp.id+'_mm') && document.getElementById(inp.id+'_dd').tagName.search(/input|select/i) != -1 && document.getElementById(inp.id+'_mm').tagName.search(/input|select/i) != -1) { options.splitDate = 1;};}; if(inp.className.search(/split-sub-date/) != -1) { if(document.getElementById(inp.id+'_day') && document.getElementById(inp.id+'_day').tagName.search(/input|select/i) != -1) { options.splitSubDate = 1;};}; if(inp.className.search(regExp6) != -1) { options.format = inp.className.match(regExp6)[0].replace('format-','');}; if(inp.className.search(regExp7) != -1) { var dividers = { dot:".", space:" ", dash:"-", slash:"/" }; options.divider = (inp.className.search(regExp7) != -1 && inp.className.match(regExp7)[0].replace('divider-','') in dividers) ? dividers[inp.className.match(regExp7)[0].replace('divider-','')] : "/";}; if(inp.className.search(regExp3) != -1) { var tmp = inp.className.match(regExp3)[0].replace(/highlight-days-/, ''); options.highlightDays = [0,0,0,0,0,0,0]; for(var j = 0; j < tmp.length; j++) { options.highlightDays[tmp.charAt(j) - 1] = 1;};}; if(inp.className.search(regExp1) != -1) { var tmp = inp.className.match(regExp1)[0].replace(/disable-days-/, ''); options.disableDays = [0,0,0,0,0,0,0]; for(var j = 0; j < tmp.length; j++) { options.disableDays[tmp.charAt(j) - 1] = 1;};}; if(inp.className.search(/range-low-today/i) != -1) { options.low = datePickerController.dateFormat((new Date().getMonth() + 1) + "/" + new Date().getDate() + "/" + new Date().getFullYear(), true);} else if(inp.className.search(regExp4) != -1) { options.low = datePickerController.dateFormat(inp.className.match(regExp4)[0].replace(/range-low-/, ''), false); if(!options.low) { options.low = '';};}; if(inp.className.search(/range-high-today/i) != -1 && inp.className.search(/range-low-today/i) == -1) { options.high = datePickerController.dateFormat((new Date().getMonth() + 1) + "/" + new Date().getDate() + "/" + new Date().getFullYear(), true);} else if(inp.className.search(regExp5) != -1) { options.high = datePickerController.dateFormat(inp.className.match(regExp5)[0].replace(/range-high-/, ''), false); if(!options.high) { options.high = '';};}; if(inp.tagName.search(/select/i) != -1) { options.low = options.low ? Math.min(inp.options[0].value, inp.options[inp.options.length - 1].value) + String(options.low).substr(4,4) : datePickerController.dateFormat(Math.min(inp.options[0].value, inp.options[inp.options.length - 1].value) + "/01/01"); options.high = options.high ? Math.max(inp.options[0].value, inp.options[inp.options.length - 1].value) + String(options.high).substr(4,4) : datePickerController.dateFormat(Math.max(inp.options[0].value, inp.options[inp.options.length - 1].value) + "/12/31");}; if(document.getElementById('fd-'+inp.id)) { for(var opt in options) { datePickerController.datePickers[inp.id].defaults[opt] = options[opt];}; datePickerController.datePickers[inp.id].enabledDays = datePickerController.datePickers[inp.id].disabledDays = [];}; if(!document.getElementById(inp.id + '_fd_but')) { var but = document.createElement('button'); but.setAttribute("type", "button"); but.className = "date-picker-control"; but.title = (typeof(fdLocale) == "object" && options.locale && fdLocale.titles.length > 5) ? fdLocale.titles[5] : ""; but.id = inp.id + '_fd_but'; but.appendChild(document.createTextNode(String.fromCharCode( 160 ))); if(inp.nextSibling) { inp.parentNode.insertBefore(but, inp.nextSibling);} else { inp.parentNode.appendChild(but);};} else { var but = document.getElementById( inp.id + '_fd_but' );}; but.onclick = but.onpress = function() { var inpId = this.id.replace('_fd_but',''); datePickerController.hideAll(inpId); if(inpId in datePickerController.datePickers && !datePickerController.datePickers[inpId].visible) { datePickerController.datePickers[inpId].show();}; return false;}; if(!document.getElementById('fd-'+inp.id)) { datePickerController.datePickers[inp.id] = new datePicker(options);}; but = null;};};}
};})(); datePickerController.addEvent(window, 'load', datePickerController.create); datePickerController.addEvent(window, 'unload', datePickerController.destroy); var en_fdLocale = { months:["January","February","March","April","May","June","July","August","September","October","November","December"], fullDay:["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"], titles:["Previous month","Next month","Previous year","Next year","Close","Show Calendar"]
}; var fdLocale = { months:[ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], fullDay:[ "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ], titles:[ "Previous month", "Next month", "Previous year", "Next year", "Today", "Show Calendar"
]
}; var options_xml; var as_xml; var gullSearchXmlDoc; function SetupXmlFunction()
{ if( document.implementation.hasFeature("XPath", "3.0") )
{ XMLDocument.prototype.selectNodes = function(cXPathString, xNode)
{ if( !xNode ) { xNode = this;}
var oNSResolver = this.createNSResolver(this.documentElement)
var aItems = this.evaluate(cXPathString, xNode, oNSResolver, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null)
var aResult = []; for( var i = 0; i < aItems.snapshotLength; i++)
{ aResult[i] = aItems.snapshotItem(i);}
return aResult;}
XMLDocument.prototype.selectSingleNode = function(cXPathString, xNode)
{ if( !xNode ) { xNode = this;}
var xItems = this.selectNodes(cXPathString, xNode); if( xItems.length > 0 )
{ return xItems[0];}
else
{ return null;}
}
Element.prototype.selectNodes = function(cXPathString)
{ if(this.ownerDocument.selectNodes)
{ return this.ownerDocument.selectNodes(cXPathString, this);}
else{throw "For XML Elements Only";}
}
Element.prototype.selectSingleNode = function(cXPathString)
{ if(this.ownerDocument.selectSingleNode)
{ return this.ownerDocument.selectSingleNode(cXPathString, this);}
else{throw "For XML Elements Only";}
}
}
}
function LoadXmlDoc()
{ if (window.ActiveXObject)
{ gullSearchXmlDoc=new ActiveXObject("Microsoft.XMLDOM"); gullSearchXmlDoc.async=false; gullSearchXmlDoc.setProperty('SelectionLanguage', 'XPath'); gullSearchXmlDoc.load("results.xml"); donothing();}
else if (document.implementation && document.implementation.createDocument)
{ gullSearchXmlDoc=document.implementation.createDocument("","",null); gullSearchXmlDoc.load("results.xml"); gullSearchXmlDoc.onload=donothing();}
else
{ alert('Your browser cannot handle this script');}
}
function donothing()
{ }
if (typeof(bsn) == "undefined")
_b = bsn = {}; if (typeof(_b.Autosuggest) == "undefined")
_b.Autosuggest = {}; else
alert("Autosuggest is already set!"); _b.AutoSuggest = function (id, param)
{ if (!document.getElementById)
return 0; this.fld = _b.DOM.gE(id); if (!this.fld)
return 0; this.sInp = ""; this.nInpC = 0; this.aSug = []; this.iHigh = 0; this.oP = param ? param : {}; var k, def = {minchars:1, meth:"get", varname:"input", className:"autosuggest", timeout:2500, delay:500, offsety:-5, shownoresults: true, noresults: "No results!", maxheight: 250, cache: true, maxentries: 25}; for (k in def)
{ if (typeof(this.oP[k]) != typeof(def[k]))
this.oP[k] = def[k];}
var p = this; this.fld.onkeypress = function(ev){ return p.onKeyPress(ev);}; this.fld.onkeyup = function(ev){ return p.onKeyUp(ev);}; this.fld.setAttribute("autocomplete","off");}; _b.AutoSuggest.prototype.onKeyPress = function(ev)
{ var key = (window.event) ? window.event.keyCode : ev.keyCode; var RETURN = 13; var TAB = 9; var ESC = 27; var bubble = 1; switch(key)
{ case RETURN:
this.setHighlightedValue(); bubble = 0; return !(window.event && window.event.keyCode == 13); break; case ESC:
this.clearSuggestions(); break;}
return bubble;}; _b.AutoSuggest.prototype.onKeyUp = function(ev)
{ if(Browser.Version() < 7)
{ gullShowIE6DropDowns();}
var key = (window.event) ? window.event.keyCode : ev.keyCode; var ARRUP = 38; var ARRDN = 40; var bubble = 1; switch(key)
{ case ARRUP:
this.changeHighlight(key); bubble = 0; break; case ARRDN:
this.changeHighlight(key); bubble = 0; break; default:
this.getSuggestions(this.fld.value);}
return bubble;}; _b.AutoSuggest.prototype.getSuggestions = function (val)
{ if (val == this.sInp)
return 0; _b.DOM.remE(this.idAs); this.sInp = val; if (val.length < this.oP.minchars)
{ this.aSug = []; this.nInpC = val.length; return 0;}
var ol = this.nInpC; this.nInpC = val.length ? val.length : 0; var l = this.aSug.length; var pointer = this; var input = this.sInp; clearTimeout(this.ajID); this.ajID = setTimeout( function() { pointer.doAjaxRequest(input) }, this.oP.delay ); return false;}; _b.AutoSuggest.prototype.doAjaxRequest = function (input)
{ var pointer = this; if (input != this.fld.value)
return false; if (options_xml != null && options_xml != 'undefined')
{ pointer.setSuggestions(options_xml, input)
}
}; _b.AutoSuggest.prototype.setSuggestions = function (req, input)
{ if (input != this.fld.value)
return false; this.aSug = []; var xml = req; var xPath = "//r[starts-with(.,'" + input.toLowerCase() + "')][position()<10]"; var results = gullSearchXmlDoc.selectNodes(xPath); for (var i=0;i<results.length;i++)
{ if (results[i].hasChildNodes())
this.aSug.push( { 'id':results[i].getAttribute('id'), 'value':results[i].childNodes[0].nodeValue } );}
this.idAs = "as_"+this.fld.id; this.createList(this.aSug); if(Browser.Version() < 7)
{ gullHideIE6DropDowns(this.aSug.length);}
}; _b.AutoSuggest.prototype.createList = function(arr)
{ var pointer = this; _b.DOM.remE(this.idAs); this.killTimeout(); if (arr.length == 0 && !this.oP.shownoresults)
return false; var div = _b.DOM.cE("div", {id:this.idAs, className:this.oP.className}); var ul = _b.DOM.cE("ul", {id:"as_ul"}); for (var i=0;i<arr.length;i++)
{ var val = arr[i].value; var st = val.toLowerCase().indexOf( this.sInp.toLowerCase() ); var output = val.substring(0,st) + "<em>" + val.substring(st, st+this.sInp.length) + "</em>" + val.substring(st+this.sInp.length); var span = _b.DOM.cE("span", {}, output, true); var a = _b.DOM.cE("a", { href:"#" }); var tl = _b.DOM.cE("span", {className:"tl"}, " "); var tr = _b.DOM.cE("span", {className:"tr"}, " "); a.appendChild(tl); a.appendChild(tr); a.appendChild(span); a.name = i+1; a.onclick = function () { pointer.setHighlightedValue(); return false;}; a.onmouseover = function () { pointer.setHighlight(this.name);}; var li = _b.DOM.cE( "li", {}, a ); ul.appendChild( li );}
if (arr.length == 0 && this.oP.shownoresults)
{ var li = _b.DOM.cE( "li", {className:"as_warning"}, this.oP.noresults ); ul.appendChild( li );}
div.appendChild( ul ); var pos = _b.DOM.getPos(this.fld); div.style.left = pos.x + "px"; div.style.top = ( pos.y + this.fld.offsetHeight + this.oP.offsety ) + "px"; div.style.width = this.fld.offsetWidth + "px"; div.onmouseover = function(){ pointer.killTimeout() }; div.onmouseout = function(){ pointer.resetTimeout() }; document.getElementsByTagName("body")[0].appendChild(div); this.iHigh = 0; var pointer = this; this.toID = setTimeout(function () { pointer.clearSuggestions() }, this.oP.timeout);}; _b.AutoSuggest.prototype.changeHighlight = function(key)
{ var list = _b.DOM.gE("as_ul"); if (!list)
return false; var n; if (key == 40)
n = this.iHigh + 1; else if (key == 38)
n = this.iHigh - 1; if (n > list.childNodes.length)
n = list.childNodes.length; if (n < 1)
n = 1; this.setHighlight(n);}; _b.AutoSuggest.prototype.setHighlight = function(n)
{ var list = _b.DOM.gE("as_ul"); if (!list)
return false; if (this.iHigh > 0)
this.clearHighlight(); this.iHigh = Number(n); list.childNodes[this.iHigh-1].className = "as_highlight"; this.killTimeout();}; _b.AutoSuggest.prototype.clearHighlight = function()
{ var list = _b.DOM.gE("as_ul"); if (!list)
return false; if (this.iHigh > 0)
{ list.childNodes[this.iHigh-1].className = ""; this.iHigh = 0;}
}; _b.AutoSuggest.prototype.setHighlightedValue = function ()
{ if (this.iHigh)
{ this.sInp = this.fld.value = this.aSug[ this.iHigh-1 ].value; this.fld.focus(); if (this.fld.selectionStart)
this.fld.setSelectionRange(this.sInp.length, this.sInp.length); this.clearSuggestions(); if (typeof(this.oP.callback) == "function")
this.oP.callback( this.aSug[this.iHigh-1] );}
}; _b.AutoSuggest.prototype.killTimeout = function()
{ clearTimeout(this.toID);}; _b.AutoSuggest.prototype.resetTimeout = function()
{ clearTimeout(this.toID); var pointer = this; this.toID = setTimeout(function () { pointer.clearSuggestions() }, 1000);}; _b.AutoSuggest.prototype.clearSuggestions = function ()
{ this.killTimeout(); var gullListArea = document.getElementById('as_gullTypedLocation'); if (gullListArea)
{ gullListArea.style.visibility = "hidden"; if(Browser.Version() < 7)
{ gullShowIE6DropDowns();}
}
return false;}; if (typeof(_b.DOM) == "undefined")
_b.DOM = {}; _b.DOM.cE = function ( type, attr, cont, html )
{ var ne = document.createElement( type ); if (!ne)
return 0; for (var a in attr)
ne[a] = attr[a]; var t = typeof(cont); if (t == "string" && !html)
ne.appendChild( document.createTextNode(cont) ); else if (t == "string" && html)
ne.innerHTML = cont; else if (t == "object")
ne.appendChild( cont ); return ne;}; _b.DOM.gE = function ( e )
{ var t=typeof(e); if (t == "undefined")
return 0; else if (t == "string")
{ var re = document.getElementById( e ); if (!re)
return 0; else if (typeof(re.appendChild) != "undefined" )
return re; else
return 0;}
else if (typeof(e.appendChild) != "undefined")
return e; else
return 0;}; _b.DOM.remE = function ( ele )
{ var e = this.gE(ele); if (!e)
return 0; else if (e.parentNode.removeChild(e))
return true; else
return 0;}; _b.DOM.getPos = function ( e )
{ var e = this.gE(e); var obj = e; var curleft = 0; if (obj.offsetParent)
{ while (obj.offsetParent)
{ curleft += obj.offsetLeft; obj = obj.offsetParent;}
}
else if (obj.x)
curleft += obj.x; var obj = e; var curtop = 0; if (obj.offsetParent)
{ while (obj.offsetParent)
{ curtop += obj.offsetTop; obj = obj.offsetParent;}
}
else if (obj.y)
curtop += obj.y; return {x:curleft, y:curtop};}; function gullSetupAutoComplete()
{ SetupXmlFunction(); LoadXmlDoc(); options_xml = { script: function (input) { return "results.xml";}, varname:"input", callback: function (obj) { document.getElementById('hdnTypedSearch').value = obj.id;}
}; as_xml = new bsn.AutoSuggest('gullTypedLocation', options_xml);}
function checkTypedLocation(input)
{ var xPath = "//r[starts-with(.,'" + input.toLowerCase() + "')][position()<10]"; var results = gullSearchXmlDoc.selectNodes(xPath); if(results.length > 0)
{ return results[0].getAttribute('id')
}
else
{ return '';}
}; var Browser = { Version: function() { var version = 999; if (navigator.appVersion.indexOf("MSIE") != -1)
version = parseFloat(navigator.appVersion.split("MSIE")[1]); return version;}
}


var gullSettings = new Object();
gullSettings["AffiliateID"] = '238';          
gullSettings["ProviderID"] = '43';    
gullSettings["Location"] = '';   
gullSettings["TypeLocationShow"] = 'no';  
gullSettings["LocationShow"] = 'yes';       
gullSettings["TownLevel"] = 'no';       
gullSettings["PremType"] = '1';           
gullSettings["PremTypeShow"] = 'yes';      
gullSettings["Children"] = 'yes';           
gullSettings["Infants"] = 'no';         
gullSettings["AdvancedTabShow"] = 'no';   
gullSettings["Sharing"] = 'no';     
gullSettings["PremName"] = 'yes';      
gullSettings["Grade"] = 'yes';      
gullSettings["Price"] = 'yes';   
gullSettings["Facilities"] = 'no'; 
gullSettings["Optional"] = '';     
gullSettings["BackgroundImage"] = '';     
gullSettings["BackgroundColor"] ='';  
gullSettings["ExpandCorrectionFromLeft"] = ''; 
