Squarespace.Cookie = {

  set: function(sName, sValue, expires, path, domain) {
    document.cookie = sName + "=" + escape(sValue) + "; expires=" + (expires == null ? new Date("January 1, 2023").toGMTString() : expires) + "; path=" + ((path == null)  ? "/" : path) + ((domain == null)  ? "" : "; domain=" + domain);
  },

  remove: function(sName, path, domain) {
    document.cookie = sName + "=" + escape(Squarespace.Cookie.get(sName)) + ";expires=" + new Date("December 31, 1975").toGMTString() + "; path=" + ((path == null) ? "/" : path) + ((domain == null)  ? "" : "; domain=" + domain);
  },

  get: function(sName) {
    var aCookie = document.cookie.split(";");
    for (var i = 0; i < aCookie.length; i++) {
      var aCrumb = aCookie[i].split("=");
      if (sName == unescape(aCrumb[0]).trim()) {
        return( unescape(aCrumb[1]) );
      }
    }
    return( null );
  }

};

Squarespace.URL = {

  loadContentBackground: function(url) {

    var el = document.createElement("iframe");

    YAHOO.util.Dom.setStyle(el, "visibility", "visible");
    YAHOO.util.Dom.setStyle(el, "height", "1px");
    YAHOO.util.Dom.setStyle(el, "width", "1px");
    YAHOO.util.Dom.setStyle(el, "opacity", "0");

    document.body.appendChild(el);

    el.src = url;

  },

  loadContent: function(targetElement, url) {

    YAHOO.util.Connect.asyncRequest("GET", url, {

      timeout : 30000,
      failure : function(o) { alert(Squarespace.Constants.ASYNC_FAIL_WARNING); },
      success : function(o) {

        var textPortion = o.responseText;
        var scriptPortion = "";

        // not robust -- one tag only

        var sidx = textPortion.indexOf("<script>");
        if (sidx != -1) {
          var seidx = textPortion.indexOf("</script>");
          scriptPortion = textPortion.substring(sidx + 8, seidx);
          textPortion = textPortion.substring(0, sidx) + textPortion.substring(seidx + 9);
        }

        // trim

        scriptPortion = scriptPortion.trim();
        textPortion = textPortion.trim();

        // do the right thing with the different content parts

        if (textPortion.length > 0) document.getElementById(targetElement).innerHTML = textPortion;
        if (scriptPortion.length > 0) eval(scriptPortion);

      }

    });

  }

};

var SSUIHelp={overlayVisible:false,welcomeVisible:false,timedNextAction:null,objectMonitorInterval:null,currentDelay:0,delayStep:400,addedElements:[],addedTimers:[],scrollBarWidth:0,init:function(){var A=document.getElementsByTagName("body").item(0);this.overlay=document.createElement("div");this.overlay.setAttribute("id","ssuihelp_overlay");this.overlay.setAttribute("title","Click to Close");YAHOO.util.Dom.setStyle(this.overlay,"background","#000");YAHOO.util.Dom.setStyle(this.overlay,"width",YAHOO.util.Dom.getViewportWidth()+"px");YAHOO.util.Dom.setStyle(this.overlay,"height",YAHOO.util.Dom.getDocumentHeight()+"px");YAHOO.util.Dom.setStyle(this.overlay,"position","absolute");YAHOO.util.Dom.setStyle(this.overlay,"top","0");YAHOO.util.Dom.setStyle(this.overlay,"left","0");YAHOO.util.Dom.setStyle(this.overlay,"z-index","9000");YAHOO.util.Dom.setStyle(this.overlay,"display","none");YAHOO.util.Dom.setStyle(this.overlay,"cursor","pointer");YAHOO.util.Dom.setStyle(this.overlay,"opacity","0");A.appendChild(this.overlay);YAHOO.util.Event.addListener(this.overlay,"click",this.close);if(safari){this.scrollBarWidth=15;}},close:function(){var C=document.getElementById("noticeHelpIcon");var A=document.getElementsByTagName("body").item(0);if(SSUIHelp.overlayVisible){var E;if(SSUIHelp.welcomeVisible){E=new YAHOO.util.Anim("ssuihelp_overlay",{opacity:{to:0.1}},0.5,YAHOO.util.Easing.easeOutStrong);}else{E=new YAHOO.util.Anim("ssuihelp_overlay",(C!=null?{opacity:{to:0.1},left:{to:YAHOO.util.Dom.getX(C)},top:{to:YAHOO.util.Dom.getY(C)},height:{to:C.offsetHeight},width:{to:C.offsetWidth}}:{opacity:{to:0.1}}),0.4,YAHOO.util.Easing.easeOutStrong);}E.onComplete.subscribe(function(){YAHOO.util.Dom.setStyle("ssuihelp_overlay","display","none");});E.animate();var F=document.getElementById("ssuihelp_title");if(F){A.removeChild(F);}SSUIHelp.overlayVisible=false;if(SSUIHelp.objectMonitorInterval){window.clearInterval(SSUIHelp.objectMonitorInterval);SSUIHelp.objectMonitorInterval=null;}var D=document.getElementsByTagName("object");for(var B=0;B<D.length;++B){D[B].style.visibility="visible";}for(var B=0;B<SSUIHelp.addedElements.length;++B){A.removeChild(SSUIHelp.addedElements[B]);}for(var B=0;B<SSUIHelp.addedTimers.length;++B){window.clearTimeout(SSUIHelp.addedTimers[B]);}SSUIHelp.addedElements=[];SSUIHelp.addedTimers=[];SSUIHelp.currentDelay=0;if(SSUIHelp.welcomeVisible){SSUIHelp.welcomeVisible=false;SSUIHelp.timedNextAction=window.setTimeout(function(){showPageHelp();},2500);}}},findElementWithText:function(B,C,E){if(E!=null){E=E.toLowerCase();}var D;if(C==null){D=document.getElementsByTagName(B);}else{D=YAHOO.util.Dom.getElementsByClassName(C,B);}for(var A=0;A<D.length;++A){if(E==null||D[A].innerHTML.toLowerCase().indexOf(E)!=-1||(D[A].tagName.toLowerCase()=="a"&&D[A].href.toLowerCase().indexOf(E)!=-1)||(D[A].tagName.toLowerCase()=="input"&&D[A].value.toLowerCase().indexOf(E)!=-1)){return(D[A]);}}return(null);},show:function(C,F,E,B,A,D){window.clearTimeout(SSUIHelp.timedNextAction);if(typeof (C)=="string"){C=document.getElementById(C);}if(C!=null){SSUIHelp.addedTimers.push(window.setTimeout(function(){SSUIHelp._show(C,F,E,B,A,D);},SSUIHelp.currentDelay));SSUIHelp.currentDelay+=SSUIHelp.delayStep;return(1);}else{return(0);}},hasFixedPositionAncestor:function(A){var B=A;while(B!=null&&B.tagName.toLowerCase()!="body"){if(YAHOO.util.Dom.getStyle(B,"position")=="fixed"){return(true);}B=B.parentNode;}return(false);},_show:function(H,R,K,C,N,F){this.showOverlay(0.75);var A=4;var P=14;var Q,O;Q=parseInt(parseInt(H.offsetWidth)/2);O=parseInt(parseInt(H.offsetHeight)/2);if(F){if(C=="top"||C=="bottom"){Q+=F;}else{O+=F;}}var J=YAHOO.util.Dom.getXY(H);var D=this.hasFixedPositionAncestor(H);var G;if(C=="top"){G=[J[0]+Q,J[1]+O-(N+O)];}if(C=="bottom"){G=[J[0]+Q,J[1]+O];}if(C=="right"){G=[J[0]+(Q*1.5),J[1]+O];}var I=document.getElementsByTagName("body").item(0);var M=document.createElement("div");YAHOO.util.Dom.setStyle(M,"position",(D&&!ie?"fixed":"absolute"));YAHOO.util.Dom.setStyle(M,"display","block");YAHOO.util.Dom.setStyle(M,"cursor","pointer");YAHOO.util.Dom.setStyle(M,"opacity","0");YAHOO.util.Dom.setStyle(M,"background-color","#ccc");if(C=="top"||C=="bottom"){YAHOO.util.Dom.setStyle(M,"height",N+"px");YAHOO.util.Dom.setStyle(M,"width",A+"px");}else{YAHOO.util.Dom.setStyle(M,"height",A+"px");YAHOO.util.Dom.setStyle(M,"width",N+"px");}YAHOO.util.Dom.setStyle(M,"z-index","10000");I.appendChild(M);SSUIHelp.addedElements.push(M);if(C=="top"){YAHOO.util.Dom.setXY(M,[G[0]-(A/2),G[1]-(P/2)]);}else{if(C=="bottom"){YAHOO.util.Dom.setXY(M,[G[0]-(A/2),G[1]+(P/2)]);}else{if(C=="right"){YAHOO.util.Dom.setXY(M,[G[0]+(P/2),G[1]-(A/2)]);}}}var B=document.createElement("img");B.setAttribute("src","/universal/images/help-overlay-circle.png");YAHOO.util.Dom.setStyle(B,"position",(D&&!ie?"fixed":"absolute"));YAHOO.util.Dom.setStyle(B,"display","block");YAHOO.util.Dom.setStyle(B,"cursor","pointer");YAHOO.util.Dom.setStyle(B,"opacity","0");YAHOO.util.Dom.setStyle(B,"height",P+"px");YAHOO.util.Dom.setStyle(B,"width",P+"px");YAHOO.util.Dom.setStyle(B,"z-index","10000");I.appendChild(B);SSUIHelp.addedElements.push(B);if(C=="top"){YAHOO.util.Dom.setXY(B,[G[0]-(P/2),G[1]-(P/2)+N]);}else{if(C=="bottom"){YAHOO.util.Dom.setXY(B,[G[0]-(P/2),G[1]-(P/2)]);}else{if(C=="right"){YAHOO.util.Dom.setXY(B,[G[0]-(P/2),G[1]-(P/2)]);}}}var L=document.createElement("div");YAHOO.util.Dom.setStyle(L,"position",(D&&!ie?"fixed":"absolute"));YAHOO.util.Dom.setStyle(L,"display","block");YAHOO.util.Dom.setStyle(L,"cursor","pointer");YAHOO.util.Dom.setStyle(L,"opacity","0");YAHOO.util.Dom.setStyle(L,"color","#fff");YAHOO.util.Dom.setStyle(L,"z-index","10000");YAHOO.util.Dom.setStyle(L,"width","350px");I.appendChild(L);L.innerHTML='<div style="font-family: Arial; font-size: 24px; line-height: 34px; padding-bottom: 4px;">'+R+'</div><div style="font-family: Arial; font-size: 15px; line-height: 18px; color: #F4F4F4;">'+K+"</div>";var E;if(C=="top"){E=[J[0]+Q+16,J[1]-N];}if(C=="bottom"){E=[J[0]+Q+16,J[1]+N+O-parseInt(L.offsetHeight)];}if(C=="right"){E=[J[0]+(Q*1.5)+16+N,J[1]+O-16];}if(C=="top"){YAHOO.util.Dom.setXY(L,[E[0],E[1]-(P/2)]);}else{if(C=="bottom"){YAHOO.util.Dom.setXY(L,[E[0],E[1]+(P/2)]);}else{YAHOO.util.Dom.setXY(L,[E[0]+(P/2),E[1]]);}}SSUIHelp.addedElements.push(L);YAHOO.util.Event.addListener(M,"click",this.close);YAHOO.util.Event.addListener(B,"click",this.close);YAHOO.util.Event.addListener(L,"click",this.close);new YAHOO.util.Anim(M,{opacity:{to:1}},0.2).animate();new YAHOO.util.Anim(B,{opacity:{to:1}},0.2).animate();new YAHOO.util.Anim(L,{opacity:{to:1}},0.2).animate();},showCenterMessage:function(B,A){SSUIHelp.addedTimers.push(window.setTimeout(function(){SSUIHelp._showCenterMessage(B,A);},SSUIHelp.currentDelay));},_showCenterMessage:function(D,C){var A=document.getElementsByTagName("body").item(0);var B=document.createElement("div");B.setAttribute("id","ssuihelp_centermsg");YAHOO.util.Dom.setStyle(B,"position","absolute");YAHOO.util.Dom.setStyle(B,"display","block");YAHOO.util.Dom.setStyle(B,"cursor","pointer");YAHOO.util.Dom.setStyle(B,"opacity","0");YAHOO.util.Dom.setStyle(B,"color","#fff");YAHOO.util.Dom.setStyle(B,"z-index","10000");YAHOO.util.Dom.setStyle(B,"width","480px");A.appendChild(B);B.innerHTML='<div style="font-family: Arial; font-size: 30px; line-height: 34px; padding-bottom: 4px;">'+D+'</div><div style="font-family: Arial; font-size: 15px; line-height: 18px; color: #F4F4F4;">'+C+"</div>";SSUIHelp.addedElements.push(B);YAHOO.util.Event.addListener(B,"click",this.close);this.reposition();new YAHOO.util.Anim(B,{opacity:{to:1}},0.2).animate();},showWelcomeScreen:function(){this.showOverlay(0.9,true);this.welcomeVisible=true;this.showCenterMessage("Welcome to Your New Website",'<ul style="margin-bottom: 0;"><li style="padding-top: 1em;">We\'ve already set your site up and logged you in.</li><li style="padding-top: 1em;">You\'re currently in help mode, which will present you with more information about how your new site works.</li><li style="padding-top: 1em;">When you\'re finished editing, click logout in the top bar.  You\'ll be presented with your site as your visitors will see it.</li></ul><br/><strong><a style="color: #fff;" href="javascript:SSUIHelp.close();">Click here to continue &raquo</a></strong>');},hideObjects:function(){var B=document.getElementsByTagName("object");for(var A=0;A<B.length;++A){if(B[A].style.visibility!="hidden"){B[A].style.visibility="hidden";}}},showOverlay:function(C,B){if(!SSUIHelp.overlayVisible){SSUIHelp.overlayVisible=true;SSUIHelp.hideObjects();this.objectMonitorInterval=window.setInterval(function(){SSUIHelp.hideObjects();},200);var A=document.getElementsByTagName("body").item(0);var D=document.getElementById("noticeHelpIcon");YAHOO.util.Dom.setStyle("ssuihelp_overlay","position","absolute");YAHOO.util.Dom.setStyle("ssuihelp_overlay","opacity","0");YAHOO.util.Dom.setStyle("ssuihelp_overlay","display","block");var E;if(B){YAHOO.util.Dom.setStyle("ssuihelp_overlay","height",YAHOO.util.Dom.getViewportHeight()+"px");YAHOO.util.Dom.setStyle("ssuihelp_overlay","width",YAHOO.util.Dom.getViewportWidth()+"px");YAHOO.util.Dom.setStyle("ssuihelp_overlay","top",0+"px");YAHOO.util.Dom.setStyle("ssuihelp_overlay","left",0+"px");SSUIHelp.overlayAnimation=new YAHOO.util.Anim("ssuihelp_overlay",{opacity:{to:C}},0.4,YAHOO.util.Easing.easeOutStrong);}else{SSUIHelp.overlayAnimation=new YAHOO.util.Anim("ssuihelp_overlay",{opacity:{to:C},left:{from:(YAHOO.util.Dom.getViewportWidth()-D.offsetWidth),to:0},top:{from:0,to:YAHOO.util.Dom.getDocumentScrollTop()},height:{from:D.offsetHeight,to:YAHOO.util.Dom.getViewportHeight()},width:{from:D.offsetWidth-SSUIHelp.scrollBarWidth,to:YAHOO.util.Dom.getViewportWidth()-SSUIHelp.scrollBarWidth}},0.4,YAHOO.util.Easing.easeOutStrong);}SSUIHelp.overlayAnimation.onComplete.subscribe(function(){if(document.getElementById("ssuihelp_title")==null&&SSUIHelp.overlayVisible){var F=document.getElementsByTagName("body").item(0);var G=document.createElement("div");G.setAttribute("id","ssuihelp_title");YAHOO.util.Dom.setStyle(G,"position","absolute");YAHOO.util.Dom.setStyle(G,"cursor","pointer");YAHOO.util.Dom.setStyle(G,"display","block");YAHOO.util.Dom.setStyle(G,"opacity","0");YAHOO.util.Dom.setStyle(G,"color","#fff");YAHOO.util.Dom.setStyle(G,"z-index","10000");YAHOO.util.Dom.setStyle(G,"height","40px");YAHOO.util.Dom.setStyle(G,"width","300px");F.appendChild(G);G.innerHTML='<div style="font-family: Arial; font-size: 15px; font-weight: bold; line-height: 18px; color: #d0d0d0;">Squarespace Help Mode</div><div style="font-family: Arial; font-size: 13px; line-height: 18px; color: #d0d0d0;">Click anywhere on the screen to exit help mode.</div>';SSUIHelp.reposition();new YAHOO.util.Anim(G,{opacity:{to:1}},0.2).animate();YAHOO.util.Event.addListener(G,"click",this.close);}});SSUIHelp.overlayAnimation.animate();}},reposition:function(){if(this.overlayVisible){if(SSUIHelp.overlayAnimation!=null&&!SSUIHelp.overlayAnimation.isAnimated()){YAHOO.util.Dom.setStyle("ssuihelp_overlay","top","0px");YAHOO.util.Dom.setStyle("ssuihelp_overlay","height",YAHOO.util.Dom.getDocumentHeight()+"px");YAHOO.util.Dom.setStyle("ssuihelp_overlay","width",(YAHOO.util.Dom.getViewportWidth()-SSUIHelp.scrollBarWidth)+"px");}window.setTimeout(function(){YAHOO.util.Dom.setXY("ssuihelp_title",[20,((YAHOO.util.Dom.getViewportHeight()+YAHOO.util.Dom.getDocumentScrollTop())-60)]);},100);var A=document.getElementById("ssuihelp_centermsg");if(A!=null){YAHOO.util.Dom.setXY(A,[(YAHOO.util.Dom.getViewportWidth()/2)-(A.offsetWidth/2)+YAHOO.util.Dom.getDocumentScrollLeft(),(YAHOO.util.Dom.getViewportHeight()/2)-(A.offsetHeight/2)+YAHOO.util.Dom.getDocumentScrollTop()]);}}}};YAHOO.util.Event.addListener(window,"resize",function(){SSUIHelp.reposition();});YAHOO.util.Event.addListener(window,"scroll",function(){SSUIHelp.reposition();});YAHOO.util.Event.addListener(window,"load",function(){SSUIHelp.init();if(Squarespace.Cookie.get("SS_AUTOHELP_EXTERNAL")!=null){delCookie("SS_AUTOHELP_EXTERNAL");Squarespace.URL.loadContentBackground("/display/service/GoogleConversion?event=signup");SSUIHelp.showWelcomeScreen();}else{if(Squarespace.Cookie.get("SS_AUTOHELP_INTERNAL")!=null&&document.location.href.indexOf("/configuration/Home")!=-1){delCookie("SS_AUTOHELP_INTERNAL");showPageHelp();}else{if(Squarespace.Cookie.get("SS_AUTOHELP_INTERNAL_ARCHITECTURE")!=null&&document.location.href.indexOf("/configuration/Modules")!=-1){delCookie("SS_AUTOHELP_INTERNAL_ARCHITECTURE");showPageHelp();}}}});function showPageHelp(){var A=0;if(document.location.href.indexOf("/configuration/")!=-1){A+=SSUIHelp.show("statSummary","Track Your Progress","Our integrated statistics system lets you see how many visitors come to your website.","top",120);if(document.location.href.indexOf("configuration/Home")!=-1){A+=SSUIHelp.show("structureLink","Add / Remove Pages",'<ul style="margin-bottom: 0;"><li>Use <strong>Structure & Style</strong> to add and remove pages from your website.</li><li>Use the <strong>Appearance</strong> area to change the way your website looks.</li></ul>',"bottom",160);}A+=SSUIHelp.show(SSUIHelp.findElementWithText("a",null,"eturn to Website"),"View / Edit Website","To edit content, return to the front of your website.","bottom",100);A+=SSUIHelp.show("siteStructureHeading","Site Components","Your site is composed the pages displayed in this column.","top",120,-175);A+=SSUIHelp.show(SSUIHelp.findElementWithText("div","previewSnip",null),"Preview Area","This column displays a preview of how these components will appear in your navigation area.","bottom",120);A+=SSUIHelp.show(SSUIHelp.findElementWithText("a",null,"configure"),"Configure","Click this link to change the way a component on your site works.","top",120);A+=SSUIHelp.show(SSUIHelp.findElementWithText("td","moduleGripC",null),"Drag/Drop Ordering","Drag components using the gray grip on the left to change ordering.","bottom",120);A+=SSUIHelp.show("currentLayoutPreview","Current Layout","A layout is a set of visual appearances for your website.","top",120);A+=SSUIHelp.show(SSUIHelp.findElementWithText("iframe","stylePreviewCubeContainer",null),"Current Visual Style","A style defines the fonts and colors that are used on your website.","top",120);A+=SSUIHelp.show("memberAccountList","Member Accounts","Everyone with a login to your website has a member account.  Your account is displayed in this list as well.  Click to edit it.","top",140);A+=SSUIHelp.show("addAccountButton","Add an Account","Set up a new user account on your website.","top",100);A+=SSUIHelp.show("basicsLink","Basic Configuration","Modify your site title, header, and footer.","top",180);A+=SSUIHelp.show("searchIndexingLink","Search Engines","Change properties that relate to how search engines see your site.","bottom",120);A+=SSUIHelp.show("localeLink","Time Zone / Location","Set your time zone and physical location.","top",100);A+=SSUIHelp.show("virtualHost","Add a Custom Domain","Enter your custom domains to use with Squarespace here.","top",120);A+=SSUIHelp.show("publicAudienceLink","Public Audience","This group of people represents anonymous users that visit your site.","top",120);A+=SSUIHelp.show("addAudienceButton","Add an Audience","You can also set up new groups of users on your site with special permissions.","top",120);A+=SSUIHelp.show(SSUIHelp.findElementWithText("td","audienceSectionHeading","Page/Widget"),"Site Components","This column contains a list of all of the pages you've set up on your website.","top",200);A+=SSUIHelp.show(SSUIHelp.findElementWithText("td","audienceSectionHeading","The Public"),"Audience Permissions","This column controls what permissions members of a particular audience have on various parts of your site.","top",100);A+=SSUIHelp.show("generalStorageFileList","File List","General storage contains the resource files for your website.  Use the button below to add more files.","top",100);A+=SSUIHelp.show("uploadFilesButton","Add Files","Click here to upload more files to your website.","top",100);A+=SSUIHelp.show("moderatedCommentsFilterLink","Moderated Comments","Show comments on your website that are awaiting your moderation before they can appear.","top",200);A+=SSUIHelp.show("allCommentsFilterLink","View All Comments","Show a list of all recent discussion activity on yout website.","top",100);A+=SSUIHelp.show(SSUIHelp.findElementWithText("input",null,"create a new style"),"Create Your Own","Using one of our appearances as a starting point, creating a style lets you customize your own fonts and colors.","top",140);}else{A+=SSUIHelp.show(SSUIHelp.findElementWithText("input","singlelinetext-medium",null),"Edit / Arrange Form Field",'<ul style="margin-bottom: 0;"><li>Click on a form field to edit text.</li><li>Drag and drop a field to change the order.</li></ul>',"top",100);A+=SSUIHelp.show(SSUIHelp.findElementWithText("a",null,"upload new pictures"),"Add More Pictures","Add new pictures to this photo gallery.","bottom",80);A+=SSUIHelp.show(SSUIHelp.findElementWithText("a",null,"create a new picture gallery"),"Create a New Gallery","Create a new gallery to add pictures to this page.","bottom",120);A+=SSUIHelp.show(SSUIHelp.findElementWithText("a",null,"create a new journal entry"),"Create a New Entry","Start writing a new journal entry.","top",80);A+=SSUIHelp.show(SSUIHelp.findElementWithText("a",null,"doConfirmRemoveEntry"),"Remove Entry","Remove this entry from your website.","bottom",80);A+=SSUIHelp.show(SSUIHelp.findElementWithText("a",null,"edit page"),"Edit Page","To change your website content, click on the editing strip near the content you would like to change.","bottom",120);A+=SSUIHelp.show(SSUIHelp.findElementWithText("div","thumbnail-container-with-description",null),"Drag/Drop Ordering","To move this image to a new location, simply click and drag.","bottom",120);A+=SSUIHelp.show(SSUIHelp.findElementWithText("a","siteNoticeAreaLink","onfigure"),"Administration Area",'<ul style="margin-bottom: 0;"><li><strong>Click to add or remove website pages.</strong></li><li>Change your website design.</li><li>Manage other site functions.</li></ul>',"bottom",140);A+=SSUIHelp.show(SSUIHelp.findElementWithText("a","siteNoticeAreaLink","ogout"),"Sign Out / View Site","Exit administrative mode and view your site as your visitors would see it.","right",200);}if(A==1){SSUIHelp.showCenterMessage("No additional page help available.",'We do not have additional overlay help configured for this page.  Please contact support and let us know what you need.<br/><br/><strong><a style="color: #fff;" href="/display/configuration/OpenTicket">Click here to open a ticket &raquo</a></strong>');}};

Function.prototype.bind = function(object, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) {
  var __method = this;
  return function() {
    __method.apply(object, [arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10]);
  };

};

Function.prototype.bindEventListener = function(object, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) {
  var __method = this;
  return function(event) {
    return __method.call(object, event || window.event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
  }
}

Squarespace.HelpTip = Class.create({

  initialize: function(context, title, text, properties) {

    this.loadProperties({
      className : "helptip-container",
      showDelay : 500,
      hideDelay : 30
    }, properties);


    this.context = context;
    this.title = title;
    this.text = text;
    this.activeAnimation = null;
    this.lagTimer = null;
    this.visible = false;
    this.tipVisible = false;

    YAHOO.util.Event.onDOMReady(this.attachToContext.bind(this));

  },

  loadProperties: function(defaults, user) {

    this.properties = defaults;
    for (key in user) {
      this.properties[key] = user[key];
    }

  },

  attachToContext: function() {

    this.container = document.createElement("div");
    this.container.className = this.properties.className;
    this.container.innerHTML = "<div class=\"helptip-title\">" + this.title + "</div><div class=\"helptip-text\">" + this.text + "</div>";
    document.body.appendChild(this.container);

    var targets = [];

    if (this.context.startsWith("class:")) {

      targets = YAHOO.util.Dom.getElementsByClassName(this.context.substring(6));

    } else if (this.context.indexOf("[") != -1) {

      var selBegin = this.context.indexOf("[");
      var root = this.context.substring(0, selBegin);
      var sels = this.context.substring(selBegin + 1, this.context.indexOf("]")).split("|");

      for (var i = 0; i < sels.length; ++i) {
        var target = document.getElementById(root + sels[i]);
        if (target) {
          targets.push(target);
        }
      }

    } else {

      var target = document.getElementById(this.context);
      if (target) {
        targets.push(target);
      }

    }

    YAHOO.util.Dom.setStyle(targets, "cursor", "help");
    YAHOO.util.Event.addListener(targets, "mouseover", this.timedShow.bindEventListener(this));
    YAHOO.util.Event.addListener(targets, "mouseout",  this.timedHide.bindEventListener(this));
    YAHOO.util.Event.addListener(targets, "mousemove", this.move.bindEventListener(this));
    YAHOO.util.Event.addListener(targets, "click",     this.show.bind(this));

  },

  timedShow: function(ev) {

    this.clearTimers();
    this.lagTimer = window.setTimeout(this.show.bind(this), this.properties.showDelay);

  },

  show: function(_x, _y) {

    if (!this.tipVisible) {

      this.clearTimers();

      if (this.activeAnimation) {
        this.activeAnimation.stop();
      }

      YAHOO.util.Dom.setStyle(this.container, "opacity", "0");
      YAHOO.util.Dom.setStyle(this.container, "display", "block");
      var xy = this.move();

      this.activeAnimation = new YAHOO.util.Anim(this.container, { opacity: {from: 0, to: 1}, top: {from: xy[1]-15, to: xy[1]} }, .4, YAHOO.util.Easing.easeOutStrong);
      this.activeAnimation.onComplete.subscribe(function(t, a, o) {
        o.tipVisible = true;
        o.move();
      }, this);
      this.activeAnimation.animate();

    }

  },

  clearTimers: function() {

    if (this.lagTimer) { window.clearTimeout(this.lagTimer); this.lagTimer = null; }

  },

  move: function(ev) {

    var x = this.lastX, y = this.lastY;

    if (ev) {
      this.lastX = x = YAHOO.util.Event.getPageX(ev);
      this.lastY = y = YAHOO.util.Event.getPageY(ev);
    }

    if ((x + this.container.offsetWidth + 30) > YAHOO.util.Dom.getViewportWidth()) {
      x -= this.container.offsetWidth + 15;
    } else {
      x += 15;
    }

    if ((y + this.container.offsetHeight + 30) > YAHOO.util.Dom.getViewportHeight()) {
      y -= this.container.offsetHeight + 15;
    } else {
      y += 15;
    }

    if (this.tipVisible) {
      YAHOO.util.Dom.setXY(this.container, [x, y]);
    } else {
      YAHOO.util.Dom.setX(this.container, x);
    }

    return( [x, y] );

  },

  timedHide: function(ev) {

    this.clearTimers();
    this.lagTimer = window.setTimeout(this.hide.bind(this), this.properties.hideDelay);

  },

  hide: function() {

    if (this.activeAnimation) {
      this.activeAnimation.stop();
    }

    this.activeAnimation = new YAHOO.util.Anim(this.container, { opacity: {to: 0}, top: {by: 15} }, .4, YAHOO.util.Easing.easeOutStrong);
    this.activeAnimation.onComplete.subscribe(function(t, a, o) {
      YAHOO.util.Dom.setStyle(this.getEl(), "display", "none");
      o.tipVisible = false;
    }, this);
    this.activeAnimation.animate();

  }


});


