if(!this.ihsBooker)
this.ihsBooker={};(function(){ihsBooker.allowUpdates=true;ihsBooker.hotelStore="#hotel_store";ihsBooker.minStarRating=1;ihsBooker.maxStarRating=5;ihsBooker.minGuestRating=0;ihsBooker.maxGuestRating=10;ihsBooker.minPrice=0;ihsBooker.maxPrice=500;ihsBooker.showErrors=false;ihsBooker.hotelName='';ihsBooker.amenityIds=new Array();ihsBooker.chainCodeIds=new Array();ihsBooker.cityIds=new Array();ihsBooker.neighborhoodIds=new Array();ihsBooker.distance=0;ihsBooker.hotelCount=0;ihsBooker.totalPages=0;ihsBooker.currentPage=1;ihsBooker.currentPosition=0;ihsBooker.listSize=0;ihsBooker.displayedHotels=[];ihsBooker.debug=false;ihsBooker.sorts={CONFIDENCE_ASCENDING:1,STAR_RATING_DESCENDING:2,PRICE_ASCENDING:3,DISTANCE_ASCENDING:4,NAME_ASCENDING:5,GUEST_RATING_DESCENDING:6,CONFIDENCE_DESCENDING:11,STAR_RATING_ASCENDING:12,PRICE_DESCENDING:13,DISTANCE_DESCENDING:14,NAME_DESCENDING:15,GUEST_RATING_ASCENDING:16};ihsBooker.sort=ihsBooker.sorts.CONFIDENCE_DESCENDING;ihsBooker.subdomains=["xml","xml1","xml2","xml3"];ihsBooker.domain="ihsadvantage.com";ihsBooker.cityId=0;ihsBooker.geoSearch=false;function GeoPoint(){this.name='';this.city='';this.stateProvince='';this.country='';this.id=0;this.latitude=0;this.longitude=0;};ihsBooker.geoPoint=new GeoPoint();if(typeof ihsBooker.getCookie!=='function'){ihsBooker.getCookie=function(n){if(document.cookie){n+="=";var cs=document.cookie.split(';');for(var i=0;i<cs.length;i++){var c=cs[i].replace(/^\s+|\s+$/g,"");if(c.indexOf(n)==0)
return c.substring(n.length,c.length);}}
return null;};}
if(typeof ihsBooker.createCookie!=='function'){ihsBooker.createCookie=function(name,value,expires){var d=window.location.href.substring(('https:'==document.location.protocol?8:7),window.location.href.indexOf('/',8));var p=d.split('.');if(p.length>2)
d=p[p.length-2]+"."+p[p.length-1];if(!expires){var da=new Date();da.setTime(da.getTime()+(30*24*60*60*1000));expires=da.toGMTString();}
document.cookie=name+"="+value+"; expires="+expires+"; path=/; domain="+d+";";};}
var environment;var app;var liveRequests=0;var hotels=null;var filteredHotels;function HotelItem(index){this.index=index;this.item=false;this.avail=false;this.processing=false;}
var hotelMapObject=[];var updateQueue=new Array();var updateQueueNames=new Array();var getRequestType=function(request){if('billingPerson'in request)
return'reservation';if('rateCode'in request.hotel)
return'rules';else if('arrivalDate'in request.hotel){if('ids'in request.hotel&&request.hotel.ids.length>0)
return'multiavailability';else
return'availability';}else if('id'in request.hotel)
return'info';};function IhsDate(){this.year=null;this.month=null;this.dayOfMonth=null;this.hourOfDay=0;this.minute=0;this.second=0;}
function Request(){this.webId=null;this.requestId=null;this.version='1.0';this.locale=null;this.affiliateId=ihsBooker.getCookie('pfs');this.subAffiliateId=null;}
HotelRequest.prototype=new Request();function HotelRequest(){Request.apply(this,arguments);this.hotel={};this.hotel.id=null;}
function Address(){this.street1=null;this.street2=null;this.city=null;this.stateProvinceAbbreviation=null;this.countryAbbreviation=null;this.zip=null;this.addressTypeId=0;}
function Phone(){this.areaCode=null;this.prefix=null;this.exchange=null;this.number=null;this.phoneTypeId=0;}
function Email(){this.address=null;this.emailTypeId=0;}
function CreditCard(){this.number=null;this.expirationMonth=0;this.expirationYear=0;this.cvm=null;this.type=0;}
function Person(){this.firstName=null;this.middleName=null;this.lastName=null;this.name=null;}
HotelAvailRequest.prototype=new HotelRequest();function HotelAvailRequest(){HotelRequest.apply(this,arguments);this.hotel.ids=[];this.hotel.numberOfRooms=1;this.hotel.numberOfAdults=0;this.hotel.numberOfChildren=0;this.hotel.arrivalDate=new IhsDate();this.hotel.departureDate=new IhsDate();this.hotel.supplierId=0;}
HotelRulesRequest.prototype=new HotelAvailRequest();function HotelRulesRequest(){HotelAvailRequest.apply(this,arguments);this.hotel.roomRate=0;this.hotel.roomCode=null;this.hotel.rateCode=null;this.hotel.rateChange=false;this.hotel.currencyCode=null;}
HotelReservationRequest.prototype=new HotelRulesRequest();function HotelReservationRequest(){HotelRulesRequest.apply(this,arguments);this.hotel.totalRate=0;this.hotel.depositRequired=false;this.hotel.rateCodeDescription=null;this.hotel.roomCodeDescription=null;this.hotel.comments=null;this.hotel.chainCode=null;this.hotel.propertyId=null;this.hotel.promos=new Array();this.person=new Person();this.person.emails=new Array();this.person.emails.push(new Email());this.person.phones=new Array();this.person.phones.push(new Phone());this.billingPerson=new Person();this.billingPerson.addresses=new Array();this.billingPerson.addresses.push(new Address());this.billingPerson.creditCards=new Array();this.billingPerson.creditCards.push(new CreditCard());this.contractDisplay=null;}
function compareByConfidence(hotel1,hotel2){if(hotel1['address']['city']['id']==ihsBooker.cityId&&hotel2['address']['city']['id']!=ihsBooker.cityId)
return-1;if(hotel1['address']['city']['id']!=ihsBooker.cityId&&hotel2['address']['city']['id']==ihsBooker.cityId)
return 1;if(hotel2['confidence']==null)
return 1;else if(hotel1['confidence']==null)
return-1;return hotel1['confidence']-hotel2['confidence'];}
function compareByPrice(hotel1,hotel2){if(hotel2['low_rate']==null)
return 1;if(hotel1['low_rate']==null)
return-1;return hotel1['low_rate']-hotel2['low_rate'];}
function compareByGuestRating(hotel1,hotel2){if(hotel2['average_overall_rating']==null)
return 1;else if(hotel1['average_overall_rating']==null)
return-1;return hotel1['average_overall_rating']-hotel2['average_overall_rating'];}
function compareByStarRating(hotel1,hotel2){if(hotel2['star_rating']==null)
return 1;else if(hotel1['star_rating']==null)
return-1;return hotel1['star_rating']-hotel2['star_rating'];}
function compareByDistance(hotel1,hotel2){if(hotel2['address']['latitude']==null||hotel2['address']['longitude']==null)
return 1;else if(hotel1['address']['latitude']==null||hotel1['address']['longitude']==null)
return-1;return ihsBooker.getDistanceFromGeoPoints(ihsBooker.geoPoint,hotel1['address'])-ihsBooker.getDistanceFromGeoPoints(ihsBooker.geoPoint,hotel2['address']);}
function compareByName(hotel1,hotel2){if(hotel1['name']<hotel2['name'])
return-1;else if(hotel1['name']>hotel2['name'])
return 1;return 0;}
function compareByConfidenceRev(hotel1,hotel2){if(hotel1['address']['city']['id']==ihsBooker.cityId&&hotel2['address']['city']['id']!=ihsBooker.cityId)
return-1;if(hotel1['address']['city']['id']!=ihsBooker.cityId&&hotel2['address']['city']['id']==ihsBooker.cityId)
return 1;if(hotel2['confidence']==null)
return-1;else if(hotel1['confidence']==null)
return 1;return hotel2['confidence']-hotel1['confidence'];}
function compareByPriceRev(hotel1,hotel2){return compareByPrice(hotel2,hotel1);}
function compareByGuestRatingRev(hotel1,hotel2){return compareByGuestRating(hotel2,hotel1);}
function compareByStarRatingRev(hotel1,hotel2){return compareByStarRating(hotel2,hotel1);}
function compareByDistanceRev(hotel1,hotel2){return compareByDistance(hotel2,hotel1);}
function compareByNameRev(hotel1,hotel2){return compareByName(hotel2,hotel1);}
function hanldeErrors(handleErrorsFunction,errors){handleErrors(errors);handleErrorsFunction(errors);}
function formatListAvailabilityWrapper(request,htl){ihsBooker.formatListAvailability(request,htl);hotelMapObject[htl['id']]['availability']=true;};function formatListHotels(hotels){for(var index=0;index<hotels.length;index++){if(!hotelMapObject[hotels[index]['id']]['item']){jQuery(ihsBooker.hotelStore).append(ihsBooker.formatListHotel(hotels[index]));ihsBooker.formatListHotelGeoInformation(hotels[index]);if(hotelMapObject[hotels[index]['id']]['processing'])
ihsBooker.formatListHotelProcessing(hotels[index],true);hotelMapObject[hotels[index]['id']]['item']=true;}
if(!hotelMapObject[hotels[index]['id']]['availability']&&('availability'in hotels[index]||'errors'in hotels[index]))
formatListAvailabilityWrapper(null,hotels[index]);}};function handleErrorsWrapper(handleErrorsFunction,errors){ihsBooker.handleErrors(errors);handleErrorsFunction(errors);};function updateHotelMapObject(){for(var i=0;i<hotels.length;i++)
hotelMapObject[hotels[i]['id']]['index']=i;};function addToQueue(name,func){if(!(name in updateQueueNames)){updateQueueNames[name]=true;updateQueue.push(func);}};function queueSortPrice(){ihsBooker.sortByPriceAsc();delete updateQueueNames['sortPrice'];updateQueue.push(ihsBooker.filterList);};function queueFilterList(){ihsBooker.filterList();delete updateQueueNames['filterList'];};function validateAvail(avail,errors){var today=new Date();today.setHours(0);today.setMinutes(0);today.setSeconds(0);today.setMilliseconds(0);var arrivalDate;var departureDate;if('arrivalDate'in avail){if('year'in avail.arrivalDate&&avail.arrivalDate.year!=null&&'month'in avail.arrivalDate&&avail.arrivalDate.month!=null&&'dayOfMonth'in avail.arrivalDate&&avail.arrivalDate.dayOfMonth!=null){arrivalDate=new Date(avail.arrivalDate.year,avail.arrivalDate.month-1,avail.arrivalDate.dayOfMonth,0,0,0,0);if(arrivalDate<today)
errors.push('The arrival date cannot be in the past');}else
errors.push('Please specify the year, month, and day of month for the arrival date');}else
errors.push('Please specify an arrival date');if('departureDate'in avail){if('year'in avail.departureDate&&avail.departureDate.year!=null&&'month'in avail.departureDate&&avail.departureDate.month!=null&&'dayOfMonth'in avail.departureDate&&avail.departureDate.dayOfMonth!=null){departureDate=new Date(avail.departureDate.year,avail.departureDate.month-1,avail.departureDate.dayOfMonth,0,0,0,0);if(departureDate<today)
errors.push('The departure date cannot be in the past');}else
errors.push('Please specify the year, month, and day of month for the departure date');}else
errors.push('Please specify a departure date');if(arrivalDate&&departureDate&&departureDate<=arrivalDate)
errors.push('The departure date must be after the arrival date');if(!isValidNumber(avail,'numberOfAdults'))
errors.push('Please specify a number of adults');}
function isValidString(obj,property){return property in obj&&obj[property]!=null&&obj[property]!='';}
function isValidNumber(obj,property){return isValidString(obj,property)&&obj[property]>0;}
function validate(request){var errors=new Array();var containsRequest=false;if('hotel'in request){if('rateCode'in request.hotel){validateAvail(request.hotel,errors);if(!isValidNumber(request.hotel,'supplierId'))
errors.push('Please specify the supplierId');if(!isValidNumber(request.hotel,'roomRate'))
errors.push('Please specify the roomRate');if(!isValidString(request.hotel,'roomCode'))
errors.push('Please specify the roomCode');if(!isValidString(request.hotel,'rateCode'))
errors.push('Please specify the rateCode');if(!isValidString(request.hotel,'currencyCode'))
errors.push('Please specify the currencyCode');if('person'in request){if(!isValidNumber(request.hotel,'totalRate'))
errors.push('Please specify the totalRate');if(!isValidString(request.hotel,'roomCodeDescription'))
errors.push('Please specify the roomCodeDescription');if(!isValidString(request.hotel,'propertyId'))
errors.push('Please specify the propertyId');if(!isValidString(request.hotel,'chainCode'))
errors.push('Please specify the chainCode');if(!isValidNumber(request.billingPerson.creditCards[0],'expirationMonth'))
errors.push('Please specify the expirationMonth');if(!isValidNumber(request.billingPerson.creditCards[0],'expirationYear'))
errors.push('Please specify the expirationYear');if(!isValidString(request.billingPerson.creditCards[0],'type'))
errors.push('Please specify the credit card type');if(!isValidString(request.billingPerson.creditCards[0],'number'))
errors.push('Please specify the credit card number');if(!isValidString(request.billingPerson.creditCards[0],'cvm'))
errors.push('Please specify the number');if(!isValidString(request.billingPerson,'name'))
errors.push('Please specify the credit card holder\'s name');if(!isValidString(request.billingPerson.addresses[0],'street1'))
errors.push('Please specify the street1');if(!isValidString(request.billingPerson.addresses[0],'city'))
errors.push('Please specify the city');if(!isValidString(request.billingPerson.addresses[0],'stateProvinceAbbreviation'))
errors.push('Please specify the stateProvinceAbbreviation');if(!isValidString(request.billingPerson.addresses[0],'countryAbbreviation'))
errors.push('Please specify the countryAbbreviation');if(request.billingPerson.addresses[0].countryAbbreviation=='US'||request.billingPerson.addresses[0].countryAbbreviation=='CA')
if(!isValidString(request.billingPerson.addresses[0],'zip'))
errors.push('Please specify the zip for US or CA');if(!isValidString(request.person.phones[0],'number')&&(!isValidString(request.person.phones[0],'areaCode')||!isValidString(request.person.phones[0],'prefix')||!isValidString(request.person.phones[0],'exhange')))
errors.push('Please specify the phone number');if(!isValidString(request.person.emails[0],'address'))
errors.push('Please specify the email address');if(!isValidString(request.person,'firstName'))
errors.push('Please specify the firstName');if(!isValidString(request.person,'lastName'))
errors.push('Please specify the lastName');if(document.getElementById('ihsBookerIFrame')==null)
errors.push('Please create the required "ihsBookerIFrame" ihsBooker iFrame');}}else if('arrivalDate'in request.hotel)
validateAvail(request.hotel,errors);else{if(!('id'in request.hotel)||request.hotel.id==null||request.hotel.id<=0)
errors.push('Please specify the hotelId');}}else
errors.push('No request was present');return errors;};function sendRequests(request){var baseThrottleAmount=20;var throttleAmount=baseThrottleAmount;var simultaneousTotalRequests=0;var requestHotelIds=[];ihsBooker.createCookie("availability",JSON.stringify(request.hotel));for(var i=0;i<hotels.length;i++)
hotelMapObject[hotels[i]['id']]['processing']=true;var requestedHotels=[];var totalRequests=0;if(filteredHotels.length>0){var h1=filteredHotels[0]['id'];var h2=filteredHotels[filteredHotels.length-1]['id'];}else{var h1=hotels[0]['id'];var h2=hotels[hotels.length-1]['id'];}
var processingQueue=false;function processUpdateQueue(){processingQueue=true;for(var i=0;i<updateQueue.length;i++)(updateQueue.shift())();if(liveRequests>0)
setTimeout(processUpdateQueue,250);else
processingQueue=false;}
function processSendRequest(items,index){if(!(items[index]['id']in requestedHotels)){totalRequests++;requestedHotels[items[index]['id']]=true;hotelMapObject[items[index]['id']]['availability']=false;var requestSize=parseInt((simultaneousTotalRequests/ihsBooker.listSize)+1);if(requestSize>10)
requestSize=10;if(requestSize==1){var singleRequest=ihsBooker.clone(request);singleRequest.hotel.id=items[index]['id'];ihsBooker.send(singleRequest,ihsBooker.listAvailabilityFormatter);}else{requestHotelIds.push(items[index]['id']);if(requestHotelIds.length>=requestSize||totalRequests>=hotels.length){var singleRequest=ihsBooker.clone(request);singleRequest.hotel.ids=requestHotelIds;requestHotelIds=[];ihsBooker.send(singleRequest,ihsBooker.listMultiAvailabilityFormatter);}}
simultaneousTotalRequests++;}
if(!processingQueue)
processUpdateQueue();}
function sendThrottledRequests(index){var keepSending=true;while(totalRequests<hotels.length&&index<filteredHotels.length){if(liveRequests<throttleAmount){processSendRequest(filteredHotels,index);index++;}else{keepSending=false;break;}}
if(keepSending){index=0;while(keepSending&&totalRequests<hotels.length&&index<filteredHotels.length){if(liveRequests<throttleAmount){processSendRequest(filteredHotels,index);index++;}else{keepSending=false;break;}}}
while(keepSending&&totalRequests<hotels.length&&liveRequests<throttleAmount){if(liveRequests<throttleAmount){if(index>=hotels.length)
index=0;processSendRequest(hotels,index);index++;}else{keepSending=false;break;}}
if(totalRequests<hotels.length){if(filteredHotels.length>0){if(h1==filteredHotels[0]['id']&&h2==filteredHotels[filteredHotels.length-1]['id'])
setTimeout(function(){sendThrottledRequests(index);},500);else{h1=filteredHotels[0]['id'];h2=filteredHotels[filteredHotels.length-1]['id'];throttleAmount+=10;index=ihsBooker.currentPosition;simultaneousTotalRequests=0;setTimeout(function(){sendThrottledRequests(ihsBooker.currentPosition);},500);}}else{if(h1==hotels[0]['id']&&h2==hotels[hotels.length-1]['id'])
setTimeout(function(){sendThrottledRequests(index);},500);else{h1=hotels[0]['id'];h2=hotels[hotels.length-1]['id'];throttleAmount+=10;index=ihsBooker.currentPosition;simultaneousTotalRequests=0;setTimeout(function(){sendThrottledRequests(ihsBooker.currentPosition);},500);}}}}
sendThrottledRequests(ihsBooker.currentPosition);};if(typeof ihsBooker.handleErrors!=='function'){ihsBooker.handleErrors=function(errors){if(ihsBooker.debug&&window.console&&window.console.log){window.console.log('Please implement the ihsBooker.handleErrors function.');}};}
if(typeof ihsBooker.resetLocalVariables!=='function'){ihsBooker.resetLocalVariables=function(){alert('Please implement the ihsBooker.resetLocalVariables function.');};}
if(typeof ihsBooker.resetVariables!=='function'){ihsBooker.resetVariables=function(){alert('Please implement the ihsBooker.resetVariables function.');};}
if(typeof ihsBooker.formatListHotel!=='function'){ihsBooker.formatListHotel=function(htl){alert('Please implement the ihsBooker.formatListHotel function.');};}
if(typeof ihsBooker.formatListHotelProcessing!=='function'){ihsBooker.formatListHotelProcessing=function(htl,processing){if(ihsBooker.debug&&window.console&&window.console.log){window.console.log('Please implement the ihsBooker.formatListHotelProcessing function.');}};}
if(typeof ihsBooker.formatPages!=='function'){ihsBooker.formatPages=function(){alert('Please implement the ihsBooker.formatPages function.');};}
if(typeof ihsBooker.formatHotelList!=='function'){ihsBooker.formatHotelList=function(viewWindowUpdated){alert('Please implement the ihsBooker.formatHotelList function.');};}
if(typeof ihsBooker.formatListAvailability!=='function'){ihsBooker.formatListAvail=function(request,htl){alert('Please implement the ihsBooker.formatListAvailability function.');};}
if(typeof ihsBooker.setListAvailabilityProperties!=='function'){ihsBooker.setListAvailabilityProperties=function(availability){alert('Please implement the ihsBooker.setListAvailabilityProperties function.');};}
if(typeof ihsBooker.setListAvailabilityRequest!=='function'){ihsBooker.setListAvailabilityRequest=function(){alert('Please implement the ihsBooker.setListAvailabilityRequest function.');};}
if(typeof ihsBooker.handleListAvailabilityErrors!=='function'){ihsBooker.handleListAvailabilityErrors=function(){if(ihsBooker.debug&&window.console&&window.console.log){window.console.log('For list availability specific errors, please implement the ihsBooker.handleListAvailabilityErrors function.');}};}
if(typeof ihsBooker.formatAvailability!=='function'){ihsBooker.formatAvailability=function(request,htl){alert('Please implement the ihsBooker.formatAvailability function.');};}
if(typeof ihsBooker.setAvailabilityProperties!=='function'){ihsBooker.setAvailabilityProperties=function(availability){alert('Please implement the ihsBooker.setAvailabilityProperties function.');};}
if(typeof ihsBooker.setAvailabilityRequest!=='function'){ihsBooker.setAvailabilityRequest=function(){alert('Please implement the ihsBooker.setAvailabilityRequest function.');};}
if(typeof ihsBooker.handleAvailabilityErrors!=='function'){ihsBooker.handleAvailabilityErrors=function(){if(ihsBooker.debug&&window.console&&window.console.log){window.console.log('For availability specific errors, please implement the ihsBooker.handleAvailabilityErrors function.');}};}
if(typeof ihsBooker.setInfoRequest!=='function'){ihsBooker.setInfoRequest=function(){alert('Please implement the ihsBooker.setInfoRequest function.');};}
if(typeof ihsBooker.formatInfo!=='function'){ihsBooker.formatInfo=function(request,htl){alert('Please implement the ihsBooker.formatInfo function.');};}
if(typeof ihsBooker.handleInfoErrors!=='function'){ihsBooker.handleInfoErrors=function(){if(ihsBooker.debug&&window.console&&window.console.log){window.console.log('For info specific errors, please implement the ihsBooker.handleInfoErrors function.');}};}
if(typeof ihsBooker.setRulesRequest!=='function'){ihsBooker.setRulesRequest=function(){alert('Please implement the ihsBooker.setRulesRequest function.');};}
if(typeof ihsBooker.formatRules!=='function'){ihsBooker.formatRules=function(request,htl){alert('Please implement the ihsBooker.formatRules function.');};}
if(typeof ihsBooker.handleRulesErrors!=='function'){ihsBooker.handleRulesErrors=function(){if(ihsBooker.debug&&window.console&&window.console.log){window.console.log('For rules specific errors, please implement the ihsBooker.handleRulesErrors function.');}};}
if(typeof ihsBooker.setReservationRequest!=='function'){ihsBooker.setReservationRequest=function(){alert('Please implement the ihsBooker.setReservationRequest function.');};}
if(typeof ihsBooker.formatReservation!=='function'){ihsBooker.formatReservation=function(request,htl){alert('Please implement the ihsBooker.formatReservation function.');};}
if(typeof ihsBooker.handleReservationErrors!=='function'){ihsBooker.handleReservationErrors=function(){if(ihsBooker.debug&&window.console&&window.console.log){window.console.log('For reservation specific errors, please implement the ihsBooker.handleReservationErrors function.');}};}
if(typeof ihsBooker.formatListHotelGeoInformation!=='function'){ihsBooker.formatListHotelGeoInformation=function(htl){if(ihsBooker.debug&&window.console&&window.console.log){window.console.log('Please implement the ihsBooker.formatListHotelGeoInformation function.');}};}
if(typeof ihsBooker.removeListHotel!=='function'){ihsBooker.removeListHotel=function(htl){alert('Please implement the ihsBooker.removeListHotel function.');};}
if(typeof ihsBooker.formatPromos!=='function'){ihsBooker.formatPromos=function(htl){if(ihsBooker.debug&&window.console&&window.console.log){window.console.log('Please implement the ihsBooker.formatPromos function.');}};}
if(typeof ihsBooker.sortList!=='function'){ihsBooker.sortList=function(sort){if(undefined!=sort)
ihsBooker.sort=parseInt(sort,10);switch(ihsBooker.sort){case ihsBooker.sorts.CONFIDENCE_ASCENDING:ihsBooker.sortByConfidenceAsc();break;case ihsBooker.sorts.STAR_RATING_DESCENDING:ihsBooker.sortByStarRatingDesc();break;case ihsBooker.sorts.PRICE_ASCENDING:ihsBooker.sortByPriceAsc();break;case ihsBooker.sorts.DISTANCE_ASCENDING:ihsBooker.sortByDistanceAsc();break;case ihsBooker.sorts.NAME_ASCENDING:ihsBooker.sortByNameAsc();break;case ihsBooker.sorts.GUEST_RATING_DESCENDING:ihsBooker.sortByGuestRatingDesc();break;case ihsBooker.sorts.CONFIDENCE_DESCENDING:ihsBooker.sortByConfidenceDesc();break;case ihsBooker.sorts.STAR_RATING_ASCENDING:ihsBooker.sortByStarRatingAsc();break;case ihsBooker.sorts.PRICE_DESCENDING:ihsBooker.sortByPriceDesc();break;case ihsBooker.sorts.DISTANCE_DESCENDING:ihsBooker.sortByDistanceDesc();break;case ihsBooker.sorts.NAME_DESCENDING:ihsBooker.sortByNameDesc();break;case ihsBooker.sorts.GUEST_RATING_ASCENDING:ihsBooker.sortByGuestRatingAsc();break;}
ihsBooker.filterList();};}
if(typeof ihsBooker.sortByConfidenceDesc!=='function'){ihsBooker.sortByConfidenceDesc=function(){ihsBooker.sort=ihsBooker.sorts.CONFIDENCE_DESCENDING;hotels.sort(compareByConfidenceRev);updateHotelMapObject();};}
if(typeof ihsBooker.sortByConfidenceAsc!=='function'){ihsBooker.sortByConfidenceAsc=function(){ihsBooker.sort=ihsBooker.sorts.CONFIDENCE_ASCENDING;hotels.sort(compareByConfidence);updateHotelMapObject();};}
if(typeof ihsBooker.sortByPriceDesc!=='function'){ihsBooker.sortByPriceDesc=function(){ihsBooker.sort=ihsBooker.sorts.PRICE_DESCENDING;hotels.sort(compareByPriceRev);updateHotelMapObject();};}
if(typeof ihsBooker.sortByPriceAsc!=='function'){ihsBooker.sortByPriceAsc=function(){ihsBooker.sort=ihsBooker.sorts.PRICE_ASCENDING;hotels.sort(compareByPrice);updateHotelMapObject();};}
if(typeof ihsBooker.sortByGuestRatingDesc!=='function'){ihsBooker.sortByGuestRatingDesc=function(){ihsBooker.sort=ihsBooker.sorts.GUEST_RATING_DESCENDING;hotels.sort(compareByGuestRatingRev);updateHotelMapObject();};}
if(typeof ihsBooker.sortByGuestRatingAsc!=='function'){ihsBooker.sortByGuestRatingAsc=function(){ihsBooker.sort=ihsBooker.sorts.GUEST_RATING_ASCENDING;hotels.sort(compareByGuestRating);updateHotelMapObject();};}
if(typeof ihsBooker.sortByStarRatingDesc!=='function'){ihsBooker.sortByStarRatingDesc=function(){ihsBooker.sort=ihsBooker.sorts.STAR_RATING_DESCENDING;hotels.sort(compareByStarRatingRev);updateHotelMapObject();};}
if(typeof ihsBooker.sortByStarRatingAsc!=='function'){ihsBooker.sortByStarRatingAsc=function(){ihsBooker.sort=ihsBooker.sorts.STAR_RATING_ASCENDING;hotels.sort(compareByStarRating);updateHotelMapObject();};}
if(typeof ihsBooker.sortByDistanceDesc!=='function'){ihsBooker.sortByDistanceDesc=function(){ihsBooker.sort=ihsBooker.sorts.DISTANCE_DESCENDING;hotels.sort(compareByDistanceRev);updateHotelMapObject();};}
if(typeof ihsBooker.sortByDistanceAsc!=='function'){ihsBooker.sortByDistanceAsc=function(){ihsBooker.sort=ihsBooker.sorts.DISTANCE_ASCENDING;hotels.sort(compareByDistance);updateHotelMapObject();};}
if(typeof ihsBooker.sortByNameAsc!=='function'){ihsBooker.sortByNameAsc=function(){ihsBooker.sort=ihsBooker.sorts.NAME_ASCENDING;hotels.sort(compareByName);updateHotelMapObject();};}
if(typeof ihsBooker.sortByNameDesc!=='function'){ihsBooker.sortByNameDesc=function(){ihsBooker.sort=ihsBooker.sorts.NAME_DESCENDING;hotels.sort(compareByNameRev);updateHotelMapObject();};}
if(typeof ihsBooker.filterByPrice!=='function'){ihsBooker.filterByPrice=function(hotels){if(ihsBooker.minPrice>0||ihsBooker.maxPrice<500){for(var i=0;i<hotels.length;i++){if(hotels[i]['low_rate']==null||parseFloat(hotels[i]['low_rate'])<ihsBooker.minPrice||(ihsBooker.maxPrice<500&&parseFloat(hotels[i]['low_rate'])>ihsBooker.maxPrice)){hotels.splice(i,1);i--;}}}};}
if(typeof ihsBooker.filterByGuestRating!=='function'){ihsBooker.filterByGuestRating=function(hotels){for(var i=0;i<hotels.length;i++)
if((ihsBooker.minGuestRating>0&&(hotels[i]['average_overall_rating']==null||parseFloat(hotels[i]['average_overall_rating'])<ihsBooker.minGuestRating))||(ihsBooker.maxGuestRating<10&&parseFloat(hotels[i]['average_overall_rating'])>ihsBooker.maxGuestRating)){hotels.splice(i,1);i--;}};}
if(typeof ihsBooker.filterByHotelName!=='function'){ihsBooker.filterByHotelName=function(hotels){var name=ihsBooker.hotelName.toLowerCase();for(var i=0;i<hotels.length;i++)
if(hotels[i]['name'].toLowerCase().indexOf(name)<0){hotels.splice(i,1);i--;}};}
if(typeof ihsBooker.filterByStarRating!=='function'){ihsBooker.filterByStarRating=function(hotels){for(var i=0;i<hotels.length;i++)
if((ihsBooker.minStarRating>1&&(hotels[i]['star_rating']==null||parseInt(hotels[i]['star_rating'],10)<ihsBooker.minStarRating))||(ihsBooker.maxStarRating<5&&parseInt(hotels[i]['star_rating'],10)>ihsBooker.maxStarRating)){hotels.splice(i,1);i--;}};}
if(typeof ihsBooker.filterErrors!=='function'){ihsBooker.filterErrors=function(hotels){for(var i=0;i<hotels.length;i++)
if('errors'in hotels[i]){hotels.splice(i,1);i--;}};}
if(typeof ihsBooker.filterByAmenity!=='function'){ihsBooker.filterByAmenity=function(hotels){for(var i=0;i<hotels.length;i++){if(hotels[i]['amenities']==null||hotels[i]['amenities'].length==0){hotels.splice(i,1);i--;continue;}
for(var j=0;j<ihsBooker.amenityIds.length;j++){var keep=false;for(var k=0;k<hotels[i]['amenities'].length;k++)
if(hotels[i]['amenities'][k]['id']==ihsBooker.amenityIds[j]){keep=true;break;}
if(!keep){hotels.splice(i,1);i--;break;}}}};}
if(typeof ihsBooker.filterByChain!=='function'){ihsBooker.filterByChain=function(hotels){for(var i=0;i<hotels.length;i++){if(hotels[i]['chain']==null){hotels.splice(i,1);i--;continue;}
var keep=false;for(var j=0;j<ihsBooker.chainCodeIds.length;j++)
if(hotels[i]['chain']['id']==ihsBooker.chainCodeIds[j]){keep=true;break;}
if(!keep){hotels.splice(i,1);i--;}}};}
if(typeof ihsBooker.filterByCity!=='function'){ihsBooker.filterByCity=function(hotels){for(var i=0;i<hotels.length;i++){var keep=false;for(var j=0;j<ihsBooker.cityIds.length;j++)
if(hotels[i]['address']['city']['id']==ihsBooker.cityIds[j]){keep=true;break;}
if(!keep){hotels.splice(i,1);i--;}}};}
if(typeof ihsBooker.filterByNeighborhood!=='function'){ihsBooker.filterByNeighborhood=function(hotels){for(var i=0;i<hotels.length;i++){if(hotels[i]['neighborhoods']==null){hotels.splice(i,1);i--;continue;}
var keep=false;for(var j=0;j<ihsBooker.neighborhoodIds.length;j++){for(var k=0;k<hotels[i]['neighborhoods'].length;k++)
if(hotels[i]['neighborhoods'][k]['id']==ihsBooker.neighborhoodIds[j]){keep=true;break;}
if(keep)
break;}
if(!keep){hotels.splice(i,1);i--;}}};}
if(typeof ihsBooker.filterByDistance!=='function'){ihsBooker.filterByDistance=function(hotels){for(var i=0;i<hotels.length;i++)
if(ihsBooker.getDistanceFromGeoPoints(ihsBooker.geoPoint,hotels[i]['address'])>ihsBooker.distance){hotels.splice(i,1);i--;}};}
if(typeof ihsBooker.getDistanceFromGeoPoints!=='function'){ihsBooker.getDistanceFromGeoPoints=function(geoPoint1,geoPoint2){return ihsBooker.getDistance(parseFloat(geoPoint1['latitude']),parseFloat(geoPoint1['longitude']),parseFloat(geoPoint2['latitude']),parseFloat(geoPoint2['longitude']));};}
if(typeof ihsBooker.getDistance!=='function'){ihsBooker.getDistance=function(lat1,lon1,lat2,lon2){return(Math.acos(Math.sin(lat1*Math.PI/180)*Math.sin(lat2*Math.PI/180)+Math.cos(lat1*Math.PI/180)*Math.cos(lat2*Math.PI/180)*Math.cos((lon1-lon2)*Math.PI/180)))*180/Math.PI*60*1.1515;};}
if(typeof ihsBooker.clone!=='function'){ihsBooker.clone=function(obj){return jQuery.extend(true,{},obj);};}
if(typeof ihsBooker.listAvailabilityFormatter!=='function'){ihsBooker.listAvailabilityFormatter=function(request,json,hotelId){var htl=hotels[hotelMapObject[hotelId]['index']];var hadErrors='errors'in htl;if('availability'in json&&'rates'in json['availability']&&json['availability']['rates'].length>0){var update=false;var prevRate=htl['low_rate'];if(hadErrors)
delete htl['errors'];htl['availability']=json['availability'];htl['low_rate']=json['availability']['minRate'];if(ihsBooker.sort==ihsBooker.sorts.PRICE_ASCENDING||ihsBooker.sort==ihsBooker.sorts.PRICE_DESCENDING)
addToQueue('sortPrice',queueSortPrice);else{if((ihsBooker.minPrice>0||ihsBooker.maxPrice<500)&&prevRate>=ihsBooker.minPrice&&prevRate<=ihsBooker.maxPrice&&(htl['low_rate']<ihsBooker.minPrice||(ihsBooker.maxPrice!=500&&htl['low_rate']>ihsBooker.maxPrice)))
addToQueue('filterList',queueFilterList);else if(hotelMapObject[hotelId]['item'])
formatListAvailabilityWrapper(request,htl);}}else if('errors'in json||('availability'in json&&'errors'in json['availability'])){if('availability'in htl)
delete htl['availability'];if('errors'in json)
htl['errors']=json['errors'];else
htl['errors']=json['availability']['errors'];if(hotelMapObject[hotelId]['item'])
formatListAvailabilityWrapper(request,htl);if(!hadErrors&&!ihsBooker.showErrors)
addToQueue('filterList',queueFilterList);}
hotelMapObject[hotelId]['processing']=false;ihsBooker.formatListHotelProcessing(htl,false);if(liveRequests==0)
ihsBooker.filterList();};}
if(typeof ihsBooker.listMultiAvailabilityFormatter!=='function'){ihsBooker.listMultiAvailabilityFormatter=function(request,json,hotelId){if('multiAvailability'in json&&'availabilities'in json['multiAvailability']){for(var i=0;i<json['multiAvailability']['availabilities'].length;i++){var availResponse=new Object();availResponse.availability=json['multiAvailability']['availabilities'][i];ihsBooker.listAvailabilityFormatter(request,availResponse,availResponse['availability']['hotelId']);}}else{for(var i=0;i<request.hotel.ids.length;i++){var availResponse=new Object();if('errors'in json)
availResponse.errors=json['errors'];ihsBooker.listAvailabilityFormatter(request,availResponse,request.hotel.ids[i]);}}};}
var addOrUpdateHotelMapObject=function(json,hotelId,key){if(hotelId in hotelMapObject&&key in hotels[hotelMapObject[hotelId]['index']])
delete hotels[hotelMapObject[hotelId]['index']][key];if('errors'in json)
key='errors';if(hotelId in hotelMapObject){var htl=hotels[hotelMapObject[hotelId]['index']];htl[key]=json[key];}else{var htl={};htl[key]=json[key];hotelMapObject[hotelId]=new HotelItem(0);if(hotels==null)
hotels=[];hotelMapObject[hotelId]['index']=hotels.length;hotels.push(htl);}
return htl;};if(typeof ihsBooker.availabilityFormatter!=='function'){ihsBooker.availabilityFormatter=function(request,json,hotelId){var htl=addOrUpdateHotelMapObject(json,hotelId,'availability');ihsBooker.formatAvailability(request,htl);};}
if(typeof ihsBooker.infoFormatter!=='function'){ihsBooker.infoFormatter=function(request,json,hotelId){var htl=addOrUpdateHotelMapObject(json,hotelId,'info');ihsBooker.formatInfo(request,htl);};}
if(typeof ihsBooker.rulesFormatter!=='function'){ihsBooker.rulesFormatter=function(request,json,hotelId){var htl=addOrUpdateHotelMapObject(json,hotelId,'rules');ihsBooker.formatRules(request,htl);};}
if(typeof ihsBooker.reservationFormatter!=='function'){ihsBooker.reservationFormatter=function(request,json,hotelId){var htl=addOrUpdateHotelMapObject(json,hotelId,'reservation');ihsBooker.formatReservation(request,htl);};}
if(typeof ihsBooker.getListAvailability!=='function'){ihsBooker.getListAvailability=function(beforeSend,complete){var request=new HotelAvailRequest();ihsBooker.setListAvailabilityRequest(request);var errors=validate(request);if(errors.length==0){if(undefined!=beforeSend)
beforeSend();sendRequests(request);if(undefined!=complete)
complete();}else{handleErrorsWrapper(ihsBooker.handleListAvailabilityErrors,errors);}};}
if(typeof ihsBooker.getAvailability!=='function'){ihsBooker.getAvailability=function(beforeSend,complete){var request=new HotelAvailRequest();ihsBooker.setAvailabilityRequest(request);var errors=validate(request);if(errors.length==0){if(undefined!=beforeSend)
beforeSend();ihsBooker.send(request,ihsBooker.availabilityFormatter,complete);}else{handleErrorsWrapper(ihsBooker.handleAvailabilityErrors,errors);}};}
if(typeof ihsBooker.getInfo!=='function'){ihsBooker.getInfo=function(beforeSend,complete){var request=new HotelRequest();ihsBooker.setInfoRequest(request);var errors=validate(request);if(errors.length==0){if(request.hotel.id in hotelMapObject){var htl=hotels[hotelMapObject[request.hotel.id]['index']];if('info'in htl){ihsBooker.formatInfo(request,htl);if(undefined!=complete)
complete();return;}}
if(undefined!=beforeSend)
beforeSend();jQuery.ajax({type:'GET',url:(undefined!=environment&&environment!="prod"?"/"+app+"_"+environment+".php":"")+'/ajax/info/'+request.hotel.id+'.js',dataType:'jsonp',cache:true,jsonpCallback:'ihsBookerJsonp'+getRequestType(request)+request.hotel.id,error:function(jqXHR,textStatus,errorThrown){ihsBooker.send(request,ihsBooker.infoFormatter,complete);},success:function(json,textStatus,jqXHR){if('errors'in json)
ihsBooker.send(request,ihsBooker.infoFormatter,complete);else{ihsBooker.infoFormatter(request,json,request.hotel.id);if(undefined!=complete)
complete();}}});}else{handleErrorsWrapper(ihsBooker.handleInfoErrors,errors);}};}
if(typeof ihsBooker.getRules!=='function'){ihsBooker.getRules=function(beforeSend,complete){var request=new HotelRulesRequest();ihsBooker.setRulesRequest(request);var errors=validate(request);if(errors.length==0){if(undefined!=beforeSend)
beforeSend();ihsBooker.send(request,ihsBooker.rulesFormatter,complete);}else{handleErrorsWrapper(ihsBooker.handleRulesErrors,errors);}};}
if(typeof ihsBooker.getReservation!=='function'){ihsBooker.getReservation=function(beforeSend,complete){var request=new HotelReservationRequest();ihsBooker.setReservationRequest(request);var errors=validate(request);if(errors.length==0){if(undefined!=beforeSend)
beforeSend();ihsBooker.sendByIFrame(request,ihsBooker.reservationFormatter,complete,true);}else{handleErrorsWrapper(ihsBooker.handleReservationErrors,errors);}};}
if(typeof ihsBooker.send!=='function'){ihsBooker.send=function(request,formatter,complete,isSecure){if('ids'in request.hotel&&request.hotel.ids.length>0)
var hotelId=request.hotel.ids[0];else
var hotelId=request.hotel.id;if('hotel'in request&&'arrivalDate'in request.hotel){request.hotel.arrivalDate.month=parseInt(request.hotel.arrivalDate.month,10)-1;request.hotel.departureDate.month=parseInt(request.hotel.departureDate.month,10)-1;}
jQuery.ajax({type:'GET',url:((undefined!=isSecure&&isSecure)||'https:'==document.location.protocol?'https':'http')+'://'+ihsBooker.subdomains[hotelId%ihsBooker.subdomains.length]+'.'+ihsBooker.domain+'/rest/hotel/'+getRequestType(request)+'/',data:'json='+escape(JSON.stringify(request)),dataType:'jsonp',cache:(undefined!=isSecure&&isSecure?false:true),jsonpCallback:'ihsBookerJsonp'+getRequestType(request)+hotelId,success:function(json){formatter.apply(this,[request,json,hotelId]);},complete:function(){liveRequests--;if(undefined!=complete)
complete();}});if('hotel'in request&&'arrivalDate'in request.hotel){request.hotel.arrivalDate.month+=1;request.hotel.departureDate.month+=1;}
liveRequests++;};}
if(typeof ihsBooker.sendByIFrame!=='function'){ihsBooker.sendByIFrame=function(request,formatter,complete,isSecure){if('ids'in request.hotel&&request.hotel.ids.length>0)
var hotelId=request.hotel.ids[0];else
var hotelId=request.hotel.id;if('hotel'in request&&'arrivalDate'in request.hotel){request.hotel.arrivalDate.month=parseInt(request.hotel.arrivalDate.month,10)-1;request.hotel.departureDate.month=parseInt(request.hotel.departureDate.month,10)-1;}
var holdDomain=document.domain;document.domain="ihsadvantage.com";var json='json='+escape(JSON.stringify(request));if('hotel'in request&&'arrivalDate'in request.hotel){request.hotel.arrivalDate.month+=1;request.hotel.departureDate.month+=1;}
document.getElementById('ihsBookerIFrame').contentWindow.send(request,formatter,complete,json,hotelId,getRequestType(request),isSecure);var numberOfDots=holdDomain.match(/\./g).length;for(var i=1;i<numberOfDots;i++)
holdDomain=holdDomain.substring(holdDomain.indexOf(".")+1);document.domain=holdDomain;};}
if(typeof ihsBooker.getHotelListData!=='function'){ihsBooker.getHotelListData=function(beforeSend,complete){var url;var callback;if(ihsBooker.geoSearch){if(ihsBooker.geoPoint.id>0){url="/ajax/list/poi/"+ihsBooker.geoPoint.id;callback="poi"+ihsBooker.geoPoint.id;}else{url="/ajax/list/geo/"+ihsBooker.geoPoint.latitude.toString().replace('.','_')+"/"+ihsBooker.geoPoint.longitude.toString().replace('.','_');callback="geo";}}else{url="/ajax/list/city/"+ihsBooker.cityId;callback="city"+ihsBooker.cityId;}
if(ihsBooker.distance>0){if(ihsBooker.distance>15)
url+="/30";else
url+="/15";}
url+=".js";jQuery.ajax({type:'GET',url:(undefined!=environment&&environment!="prod"?"/"+app+"_"+environment+".php":"")+url,dataType:'jsonp',cache:true,jsonpCallback:callback,beforeSend:function(){if(undefined!=beforeSend)
beforeSend();},complete:function(){if(undefined!=complete)
complete();},success:function(json){ihsBooker.geoPoint.latitude=json['latitude'];ihsBooker.geoPoint.longitude=json['longitude'];if(hotels==null){hotels=json['hotels'];for(var i=0;i<json['hotels'].length;i++)
hotelMapObject[json['hotels'][i]['id']]=new HotelItem(i);}else{for(var i=0;i<hotels.length;i++){var keep=false;for(var j=0;j<json['hotels'].length;j++)
if(hotels[i]['id']==json['hotels'][j]['id']){keep=true;break;}
if(!keep){ihsBooker.removeListHotel(hotels[i]);delete hotelMapObject[hotels[i]['id']];hotels.splice(i,1);i--;}else if(hotelMapObject[hotels[i]['id']]['item'])
ihsBooker.formatListHotelGeoInformation(hotels[i]);}
for(var i=0;i<json['hotels'].length;i++){if(!(json['hotels'][i]['id']in hotelMapObject)){hotelMapObject[json['hotels'][i]['id']]=new HotelItem(hotels.length);hotels.push(json['hotels'][i]);}}
ihsBooker.currentPosition=0;}
ihsBooker.sortList();filteredHotels=hotels.slice(0);ihsBooker.hotelCount=hotels.length;ihsBooker.totalPages=Math.ceil(ihsBooker.hotelCount/ihsBooker.listSize);ihsBooker.filterList();ihsBooker.formatPages();}});};}
if(typeof ihsBooker.getNearbyPoi!=='function'){ihsBooker.getNearbyPoi=function(distance,beforeSend,complete){if(ihsBooker.cityId>0&&ihsBooker.cityId!=''){var url="/ajax/nearby/poi/"+ihsBooker.cityId+"/"+distance+".js";jQuery.ajax({type:'GET',url:(undefined!=environment&&environment!="prod"?"/"+app+"_"+environment+".php":"")+url,dataType:'jsonp',cache:true,jsonpCallback:"nearbyPoi"+ihsBooker.cityId,beforeSend:function(){if(undefined!=beforeSend)
beforeSend();},complete:function(){if(undefined!=complete)
complete();},success:function(json){ihsBooker.nearbyPoi=json;}});}};}
if(typeof ihsBooker.getNearbyCities!=='function'){ihsBooker.getNearbyCities=function(distance,beforeSend,complete){if(ihsBooker.cityId>0&&ihsBooker.cityId!=''){var url="/ajax/nearby/city/"+ihsBooker.cityId+"/"+distance+".js";if(ihsBooker.geoSearch)
url+="?include_self=true";jQuery.ajax({type:'GET',url:(undefined!=environment&&environment!="prod"?"/"+app+"_"+environment+".php":"")+url,dataType:'jsonp',cache:true,jsonpCallback:"nearbyCity"+ihsBooker.cityId,beforeSend:function(){if(undefined!=beforeSend)
beforeSend();},complete:function(){if(undefined!=complete)
complete();},success:function(json){ihsBooker.nearbyCities=json;}});}};}
if(typeof ihsBooker.verifyPromos!=='function'){ihsBooker.verifyPromos=function(promos,beforeSend,complete){if(promos!=null&&promos.length>0){var promoString='';var index=0;while(promoString==''&&index<promos.length)
if(promos[index]!=null)
promoString=jQuery.trim(promos[index++]);for(var i=index;i<promos.length;i++)
promoString+=","+promos[i];if(promoString!=''){var url="/ajax/promos/verify/?codes="+promoString;jQuery.ajax({type:'GET',url:(undefined!=environment&&environment!="prod"?"/"+app+"_"+environment+".php":"")+url,dataType:'jsonp',cache:false,beforeSend:function(){if(undefined!=beforeSend)
beforeSend();},complete:function(){if(undefined!=complete)
complete();},success:function(json){ihsBooker.formatPromos(json);}});}}};}
if(typeof ihsBooker.getChains!=='function'){ihsBooker.getChains=function(){var tempChainObject={};for(var i=0;i<hotels.length;i++)
if('chain'in hotels[i]&&hotels[i]['chain']!=null)
tempChainObject[hotels[i]['chain']['name']]=hotels[i]['chain']['id'];var tempChainArray=[];for(i in tempChainObject)
tempChainArray.push(i);tempChainArray.sort();ihsBooker.chains={};for(var i=0;i<tempChainArray.length;i++)
ihsBooker.chains[tempChainArray[i]]=tempChainObject[tempChainArray[i]];return ihsBooker.chains;};}
if(typeof ihsBooker.resetList!=='function'){ihsBooker.resetList=function(){var holdDistance=ihsBooker.distance;var holdGeoId=ihsBooker.geoPoint.id;var holdGeoRequest=ihsBooker.geoRequest;allowUpdates=false;ihsBooker.resetLocalVariables();allowUpdates=true;ihsBooker.resetVariables();if(holdDistance!=ihsBooker.distance||holdGeoRequest!=ihsBooker.geoRequest||(ihsBooker.geoRequest&&holdGeoId!=ihsBooker.geoPoint.id))
ihsBooker.getHotelListData();else
ihsBooker.filterList();};}
if(typeof ihsBooker.filterList!=='function'){ihsBooker.filterList=function(){if(ihsBooker.allowUpdates&&undefined!=hotels){filteredHotels=hotels.slice(0);if(ihsBooker.distance>0)
ihsBooker.filterByDistance(filteredHotels);if(ihsBooker.minStarRating>1||ihsBooker.maxStarRating<5)
ihsBooker.filterByStarRating(filteredHotels);if(ihsBooker.minGuestRating>0||ihsBooker.maxGuestRating<10)
ihsBooker.filterByGuestRating(filteredHotels);if(!ihsBooker.showErrors)
ihsBooker.filterErrors(filteredHotels);if(ihsBooker.amenityIds.length>0)
ihsBooker.filterByAmenity(filteredHotels);if(ihsBooker.chainCodeIds.length>0)
ihsBooker.filterByChain(filteredHotels);if(ihsBooker.cityIds.length>0)
ihsBooker.filterByCity(filteredHotels);if(ihsBooker.neighborhoodIds.length>0)
ihsBooker.filterByNeighborhood(filteredHotels);if(ihsBooker.hotelName!='')
ihsBooker.filterByHotelName(filteredHotels);if(ihsBooker.minPrice>0||ihsBooker.maxPrice<500)
ihsBooker.filterByPrice(filteredHotels);ihsBooker.hotelCount=filteredHotels.length;ihsBooker.totalPages=Math.ceil(ihsBooker.hotelCount/ihsBooker.listSize);ihsBooker.currentPage=ihsBooker.currentPosition/ihsBooker.listSize+1;ihsBooker.formatPages();ihsBooker.updateList();}};}
if(typeof ihsBooker.updateList!=='function'){ihsBooker.updateList=function(){var prevDisplayedHotels=ihsBooker.displayedHotels;if(filteredHotels.length>ihsBooker.currentPosition+ihsBooker.listSize)
ihsBooker.displayedHotels=filteredHotels.slice(ihsBooker.currentPosition,ihsBooker.currentPosition+ihsBooker.listSize);else
ihsBooker.displayedHotels=filteredHotels.slice(ihsBooker.currentPosition);formatListHotels(ihsBooker.displayedHotels);var update=false;if(prevDisplayedHotels!=undefined&&ihsBooker.displayedHotels.length==prevDisplayedHotels.length){for(var i=0;i<ihsBooker.displayedHotels.length;i++)
if(prevDisplayedHotels[i]['id']!=ihsBooker.displayedHotels[i]['id']){update=true;break;}}else
update=true;ihsBooker.formatHotelList(update);};}
if(typeof ihsBooker.generateImageUrl!=='function'){ihsBooker.generateImageUrl=function(url,width,height,crop,use_max){if(url!=null){if(url.indexOf('http://')!=0)
url='http://'+url;type=url.substring(url.lastIndexOf('.')+1);return'/images/dl/'+type+'/'+use_max+'/'+crop+'/'+width+'/'+height+'/'+Base64.encode(url)+'.'+type;}};}
if(window.ihsBookerAsyncInitQueue!=undefined&&window.ihsBookerAsyncInitQueue.length>0)
for(var i=0;i<window.ihsBookerAsyncInitQueue.length;i++)(window.ihsBookerAsyncInitQueue.shift())();}());if(!this.JSON){this.JSON={};}
(function(){"use strict";function f(n){return n<10?'0'+n:n;}
if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+f(this.getUTCMonth()+1)+'-'+f(this.getUTCDate())+'T'+f(this.getUTCHours())+':'+f(this.getUTCMinutes())+':'+f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
if(typeof rep==='function'){value=rep.call(holder,key,value);}
switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
v=partial.length===0?'[]':gap?'[\n'+gap+partial.join(',\n'+gap)+'\n'+mind+']':'['+partial.join(',')+']';gap=mind;return v;}
if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
return str('',{'':value});};}
if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
return reviver.call(holder,key,value);}
text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
throw new SyntaxError('JSON.parse');};}}());var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(input){var output="";var chr1,chr2,chr3,enc1,enc2,enc3,enc4;var i=0;input=Base64._utf8_encode(input);while(i<input.length){chr1=input.charCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2;enc2=((chr1&3)<<4)|(chr2>>4);enc3=((chr2&15)<<2)|(chr3>>6);enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64;}else if(isNaN(chr3)){enc4=64;}
output=output+this._keyStr.charAt(enc1)+this._keyStr.charAt(enc2)+this._keyStr.charAt(enc3)+this._keyStr.charAt(enc4);}
return output;},decode:function(input){var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(i<input.length){enc1=this._keyindexOf(input.charAt(i++));enc2=this._keyStr.indexOf(input.charAt(i++));enc3=this._keyStr.indexOf(input.charAt(i++));enc4=this._keyStr.indexOf(input.charAt(i++));chr1=(enc1<<2)|(enc2>>4);chr2=((enc2&15)<<4)|(enc3>>2);chr3=((enc3&3)<<6)|enc4;output=output+String.fromCharCode(chr1);if(enc3!=64){output=output+String.fromCharCode(chr2);}
if(enc4!=64){output=output+String.fromCharCode(chr3);}}
output=Base64._utf8_decode(output);return output;},_utf8_encode:function(string){string=string.replace(/\r\n/g,"\n");var utftext="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128){utftext+=String.fromCharCode(c);}
else if((c>127)&&(c<2048)){utftext+=String.fromCharCode((c>>6)|192);utftext+=String.fromCharCode((c&63)|128);}
else{utftext+=String.fromCharCode((c>>12)|224);utftext+=String.fromCharCode(((c>>6)&63)|128);utftext+=String.fromCharCode((c&63)|128);}}
return utftext;},_utf8_decode:function(utftext){var string="";var i=0;var c=c1=c2=0;while(i<utftext.length){c=utftext.charCodeAt(i);if(c<128){string+=String.fromCharCode(c);i++;}
else if((c>191)&&(c<224)){c2=utftext.charCodeAt(i+1);string+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2;}
else{c2=utftext.charCodeAt(i+1);c3=utftext.charCodeAt(i+2);string+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3;}}
return string;}};
