itemsCount=new Array();errorMessages=new Array();window.addEvent("domready",function(){var c=new Tips($$(".amenitiesIcons"),{initialize:function(){this.fx=new Fx.Style(this.toolTip,"opacity",{duration:250,wait:false}).set(0);},onShow:function(r){this.fx.start(1);},onHide:function(r){this.fx.start(0);}});var H=new Tips($$(".removeIcon"),{initialize:function(){this.fx=new Fx.Style(this.toolTip,"opacity",{duration:500,wait:false}).set(0);},onShow:function(r){this.fx.start(1);},onHide:function(r){this.fx.start(0);}});errorMessages[0]=new Element("div",{"class":"alert"});errorMessages[0].setHTML("<p>You currently have no destinations in your trip planner.&nbsp; In order to use this feature, you must add destinations to your trip from either the <a href=\"/courses/\">golf courses</a>, <a href=\"/packages/\">hotel packages</a>, or <a href=\"/instruction/schools/\">golf schools</a> pages.&nbsp; Once you've added that, you'll be able to enjoy all these great features:</p><ul><li>Request personal information from each destination</li><li>Save your destinations</li><li>Free Google Map directions</li><li>Map only your destinations on an interactive map</li></ul><p>If you're seeing this page instead of your destinations you have saved in the Trip Planner system, make sure that you're <a href=\"/login/\">logged in</a> or that it hasn't been 5 days since you've added a destination.</p>");errorMessages[1]=new Element("p",{"class":"alert"});errorMessages[1].setText("There are no golf courses in your destinations.");errorMessages[2]=new Element("p",{"class":"alert"});errorMessages[2].setText("There are no package providers in your destinations.");errorMessages[3]=new Element("p",{"class":"alert"});errorMessages[3].setText("There are no golf instruction facilities in your destinations.");var n=$$(".course");itemsCount[0]=n.length;n=$$(".hotel");itemsCount[1]=n.length;n=$$(".school");itemsCount[2]=n.length;var p=$$(".removeMember");if(p){p.each(function(d,r){d.href=d.href.replace("&redir","&inner");d.onclick=function(){var x=d.getParent();var z=x.getElement("h3").getFirst().getText();s=s_gi(s_account);s.linkTrackVars="prop12,events";s.linkTrackEvents="scRemove";s.prop12=d.getParent().getElement("h3").getFirst().getText();s.tl(this,"d","Name of Member");var m=new Ajax(d.href,{method:"get",onComplete:responseHandler}).request();if(x.hasClass("course")){itemsCount[0]--;if(itemsCount[0]==0){x.replaceWith(errorMessages[1]);}else{x.remove();}}else{if(x.hasClass("hotel")){itemsCount[1]--;if(itemsCount[1]==0){x.replaceWith(errorMessages[2]);}else{x.remove();}}else{itemsCount[2]--;if(itemsCount[2]==0){x.replaceWith(errorMessages[3]);}else{x.remove();}}}if((itemsCount[0]==0)&&(itemsCount[1]==0)&&(itemsCount[2]==0)){$("col1-2").getChildren().each(function(v,U){if(U!=0){v.remove();}});$("col1-2").adopt(errorMessages[0]);}else{$$("#plannerList li").each(function(U){if(!U.hasClass("title")){if(U.getFirst().getText()==z){U.remove();}}});}return false;};});}var f=new Sortables($("directionsList"));var O=$("directionsList");if(O){var N=O.effect("background-color",{wait:false});$$("#plannerList li").each(function(r){r.addEvent("mousedown",function(z){z=new Event(z).stop();var d=new Element("li").setText(this.getFirst().getText()).addEvent("mouseover",function(){this.setStyles({background:"#7AAA52",color:"#ffffff"});}).addEvent("mouseout",function(){this.setStyles({background:"#101E07",color:"#7AAA52"});});d.id=this.id;var x=this.clone().setStyles(this.getCoordinates()).setStyles({"opacity":0.7,"position":"absolute"}).addEvent("emptydrop",function(){this.remove();O.removeEvents();}).inject(document.body);O.addEvents({"drop":function(){O.removeEvents();x.remove();d.inject(O);f.detach();f.initialize($("directionsList"));}});var m=x.makeDraggable({droppables:[O]});m.start(z);});});}var t=$("get-directions-button");if(t){t.addEvent("click",function(d){var r="http://www.golfholiday.com/travel/directions.cfm?id=";$("directionsList").getChildren().each(function(m){r=r+m.id.replace("location-","")+",";});r=r.substring(0,(r.length-1));window.open(r,"directionswindow");new Event(d).stop();});}var j=$("poll");if(j){var b=new SWFObject("/poll.swf","poll","180","200","8","#314f19");b.addParam("wmode","transparent");var K=readCookie("questionAnsweredGH");if(K){b.addVariable("cookieID",K);}b.write("poll");}});responseHandler=function(){$("recentTripPlanner").setHTML(this.response.text);};var Sortables=new Class({options:{handles:false,onStart:Class.empty,onComplete:Class.empty,ghost:true,snap:3,onDragStart:function(b,O){O.setStyle("opacity",0.7);b.setStyle("opacity",0.7);},onDragComplete:function(b,O){b.setStyle("opacity",1);O.remove();this.trash.remove();}},initialize:function(p,O){this.setOptions(O);this.list=$(p);this.elements=this.list.getChildren();this.handles=(this.options.handles)?$$(this.options.handles):this.elements;this.bound={"start":[],"moveGhost":this.moveGhost.bindWithEvent(this)};for(var f=0,b=this.handles.length;f<b;f++){this.bound.start[f]=this.start.bindWithEvent(this,this.elements[f]);}this.attach();if(this.options.initialize){this.options.initialize.call(this);}this.bound.move=this.move.bindWithEvent(this);this.bound.end=this.end.bind(this);},attach:function(){this.handles.each(function(O,b){O.addEvent("mousedown",this.bound.start[b]);},this);},detach:function(){this.handles.each(function(O,b){O.removeEvent("mousedown",this.bound.start[b]);},this);},start:function(f,O){this.active=O;this.coordinates=this.list.getCoordinates();if(this.options.ghost){var b=O.getPosition();this.offset=f.page.y-b.y;this.trash=new Element("div").inject(document.body);this.ghost=O.clone().inject(this.trash).setStyles({"position":"absolute","left":b.x,"top":f.page.y-this.offset});document.addListener("mousemove",this.bound.moveGhost);this.fireEvent("onDragStart",[O,this.ghost]);}document.addListener("mousemove",this.bound.move);document.addListener("mouseup",this.bound.end);this.fireEvent("onStart",O);f.stop();},moveGhost:function(b){var O=b.page.y-this.offset;O=O.limit(this.coordinates.top,this.coordinates.bottom-this.ghost.offsetHeight);this.ghost.setStyle("top",O);b.stop();},move:function(H){var O=H.page.y;this.previous=this.previous||O;var b=((this.previous-O)>0);var p=this.active.getPrevious();var f=this.active.getNext();if(p&&b&&O<p.getCoordinates().bottom){this.active.injectBefore(p);}if(f&&!b&&O>f.getCoordinates().top){this.active.injectAfter(f);}this.previous=O;},serialize:function(b){return this.list.getChildren().map(b||function(O){return this.elements.indexOf(O);},this);},end:function(b){this.previous=null;document.removeListener("mousemove",this.bound.move);document.removeListener("mouseup",this.bound.end);if(this.options.ghost){document.removeListener("mousemove",this.bound.moveGhost);this.fireEvent("onDragComplete",[this.active,this.ghost]);}this.fireEvent("onComplete",this.active);}});Sortables.implement(new Events,new Options);readCookie=function(O){var p=O+"=";var b=document.cookie.split(";");for(var f=0;f<b.length;f++){var H=b[f];while(H.charAt(0)==" "){H=H.substring(1,H.length);}if(H.indexOf(p)==0){return H.substring(p.length,H.length);}}return null;};