function selectOffer(offerid){changeOffer(offerid);var nextLink=$("ImageGallery").down("div.pagStandardImageGallery").down("a"),onclick=nextLink.readAttribute("onclick");eval(onclick.replace("ImageGallery.run(this","ImageGallery.runTo(nextLink").replace("'prev'",getIndexFromOffer(offerid)).replace("return false;",""));eval(Scroll.showScrollbar($("OfferDescription").up().up()))}function selectFirstOffer(){offerRateID==0&&imageSelectionChanged(1)}function imageSelectionChanged(index){var offerid=getOfferFromIndex(index);changeOffer(offerid)}function getIndexFromOffer(offerid){for(var i=1,offers=$("OfferLinks").select("a"),i=1;i<=offers.size();i++)if(offers[i-1].id=="lnkOffer"+offerid)return i;return -1}function getOfferFromIndex(index){var linkId=$("OfferLinks").select("a")[index-1].id;return parseInt(linkId.replace("lnkOffer",""))}var offerRateID=0;function changeOffer(offerid){$("OfferTitle").innerHTML=hashOfferTitles.get(offerid);$("OfferDescription").innerHTML=hashOfferDescriptions.get(offerid);$("OfferShowRatesStatic").style["visibility"]="visible";var parentImage=$("ImageGallery").down("img").up();if(parentImage.id!="OfferUrlPage"){var aOffer=new Element("a");aOffer.id="OfferUrlPage";aOffer.href=hashOfferUrl.get(offerid);var image=$("ImageGallery").down("img").remove();aOffer.appendChild(image);parentImage.appendChild(aOffer)}else parentImage.href=hashOfferUrl.get(offerid);offerRateID=offerid;$("OfferLinks").select("a").each(function(x){x.className="lnkUnderOrange11"});$("lnkOffer"+offerid).className="none"}function openOfferShowRates(){if($("SearchRatesControl").up().id=="content"){var parent=$("SearchRatesControl").up().up(),actualParent=$("SearchRatesControl").up(),control=actualParent.removeChild($("SearchRatesControl"));parent.appendChild(control)}$("SearchRatesControl").show();showWhiteFade(761);$("cloudCheckAvailability").down(0).value=offerRateID}function openFeaturedOfferShowRates(offerid){if($("SearchRatesControl").up().id=="content"){var parent=$("SearchRatesControl").up().up(),actualParent=$("SearchRatesControl").up(),control=actualParent.removeChild($("SearchRatesControl"));parent.appendChild(control)}$("SearchRatesControl").show();showWhiteFade(761);$("cloudCheckAvailability").down(0).value=offerid}function closeOfferShowRates(){$("SearchRatesControl").hide();hideWhiteFade();$("cloudCheckAvailability").down(0).value=""};
