/*<!-- mp_trans_disable_start -->*/ 
var ProductSelector=new Base;ProductSelector.extend({productSelectorUrl:"",originCountry:"",destinationCountries:[],init:function()
{Event.observe(window,'load',this.windowOnLoad.bindAsEventListener(this));},windowOnLoad:function(event)
{var origin=$("originCountry");var destinations=$$("#regionsAndCountries .destinationCountry");var showProductOptionsButton=$("showProductOptionsButton");var resetProductOptionsButton=$("resetProductOptionsButton");if(origin&&destinations.length>0){Event.observe(origin,"change",this.originCountryOnChange.bindAsEventListener(this));for(var i=0;i<destinations.length;i++){Event.observe(destinations[i],"click",this.destinationCountryOnClick.bindAsEventListener(this));}
Event.observe(showProductOptionsButton,"click",this.showProductOptionsOnClick.bindAsEventListener(this));Event.observe(resetProductOptionsButton,"click",this.resetProductOptionsOnClick.bindAsEventListener(this));}
Element.hide("itinerarySpinner");Element.hide("productOptionsSpinner");Element.hide("productOptionsContainer");Element.hide("itineraryContainer");this.renderItinerary();},originCountryOnChange:function(event)
{this.renderItinerary();},destinationCountryOnClick:function(event)
{this.renderItinerary();},showProductOptionsOnClick:function(event)
{pageTracker._trackEvent('product selector','show product options','');this.renderProductOptions();},resetProductOptionsOnClick:function(event)
{this.removeAllDestinationCountries()
this.renderItinerary();},itineraryDestinationCountryOnClick:function(event){var checkbox=Event.element(event);var countryCode=checkbox.value;this.removeItineraryDestinationCountry(countryCode);},getDestinationCountries:function(){var destinationElems=$$("#regionsAndCountries .destinationCountry");var destinations=[];for(var i=0;i<destinationElems.length;i++)
{var dest=destinationElems[i];if(dest.type=="checkbox"&&dest.checked)
{destinations.push(dest.value);}}
return destinations;},renderItinerary:function()
{Element.hide("itineraryContainer");Element.hide("productOptionsContainer");this.originCountry=$F("originCountry");this.destinationCountries=this.getDestinationCountries();if(!this.hasSelectedOriginAndDestinations())
{return;}
Element.show("itinerarySpinner");var formData=this.serialiseChoices();new Ajax.Request(this.productSelectorUrl+"?action=renderItinerary&"+formData,{method:"get",onSuccess:function(response)
{ProductSelector.renderItineraryComplete(response.responseText);}});},renderItineraryComplete:function(itineraryHtml)
{Element.hide("itinerarySpinner");$("itinerary").update(itineraryHtml);var itineraryDestinations=$$(".itineraryDestinationCountry");for(var i=0;i<itineraryDestinations.length;i++){Event.observe(itineraryDestinations[i],"click",ProductSelector.itineraryDestinationCountryOnClick.bindAsEventListener(ProductSelector));}
if(ProductSelector.hasSelectedOriginAndDestinations())
{Element.show("itineraryContainer");Element.show("showProductOptionsButton");}},renderProductOptions:function()
{Element.hide("productOptionsContainer");Element.show("productOptionsSpinner");var formData=this.serialiseChoices();new Ajax.Request(this.productSelectorUrl+"?action=renderProductOptions&"+formData,{method:"get",onSuccess:function(response)
{ProductSelector.renderProductOptionsComplete(response.responseText);}});},renderProductOptionsComplete:function(productOptionsHtml)
{$("productOptions").update(productOptionsHtml);Element.hide("productOptionsSpinner");Element.show("productOptionsContainer");},removeAllDestinationCountries:function(){var destinationElems=$$("#regionsAndCountries .destinationCountry");for(var i=0;i<destinationElems.length;i++)
{var dest=destinationElems[i];if(dest.type=="checkbox"&&dest.checked)
{dest.checked=false;}}},removeItineraryDestinationCountry:function(countryCode)
{var checkbox=$("dc_"+countryCode);if(checkbox)
{checkbox.checked=false;}
this.renderItinerary();},hasSelectedOriginAndDestinations:function()
{return ProductSelector.originCountry.length>0&&ProductSelector.destinationCountries.length>0},serialiseChoices:function()
{var out="";var destList="";for(var i=0;i<this.destinationCountries.length;i++){if(destList.length>0)
{destList=destList+",";}
destList=destList+this.destinationCountries[i];}
out=out+"oc="+this.originCountry;out=out+"&dc="+destList;return out;}});function tabClick(oLink)
{var oTab=document.getElementById(sCurrentTab);var oTabContent=document.getElementById(sCurrentTab+'content');oTab.parentNode.className="tabInactive";oTabContent.className="tabContentInactive";sCurrentTab=oLink.id;var oTab=document.getElementById(sCurrentTab);var oTabContent=document.getElementById(sCurrentTab+'content');oTab.parentNode.className="tabActive";oTabContent.className="tabContentActive";return false;}
 /*<!-- mp_trans_disable_end -->*/