

// Filename: /javascript/shared/shortlist.js
// Was: 3280, now: 1361, compression: 59%

var ShortList=new Class({Implements:[Events,Options],options:{onHotelAdded:$empty,onHotelRemoved:$empty,onShortlistFull:$empty,onHotelExists:$empty,onShortlistCleared:$empty,localhostString:"localhost"},initialize:function(options){this.setOptions(options);},CookieName:"ShortListHotels",Get:function(){return Cookie.get(this.CookieName)?Cookie.get(this.CookieName).split("|"):[];},Set:function(hotels){var options={duration:356,path:"/"};if(!String(location.host).match(this.options.localhostString)){options.domain=location.host.replace(/www|ecom\d/,"");}
Cookie.set(this.CookieName,hotels.join("|"),options);},Count:function(){return this.Get().length;},Add:function(id){var hotels=this.Get();if(hotels.length>=12){this.fireEvent("onShortlistFull",id);return false;}
else{if(this.Contains(id)){this.fireEvent("onHotelExists",id);return false;}
hotels.push(id);this.Set(hotels);this.fireEvent("hotelAdded",id);}
return true;},Remove:function(id){if(this.Contains(id)){this.Set(this.Get().remove(String(id)));this.fireEvent("hotelRemoved",id);return true;}
return false;},RemoveAll:function(){var hotel_list=this.Get().join("|");this.Set([]);this.fireEvent("shortlistCleared",hotel_list);return true;},Contains:function(id){return this.Get().contains(String(id));},Serialize:function(){return this.Get().join(',');}});function AssertJSLoadedOk(){return true;}
