﻿$(document).ready(function(){function c(a){return a.replace(/^\//,"").replace(/(index|default).[a-zA-Z]{3,4}$/,"").replace(/\/$/,"")}$.fn.clearQueue=$.fn.unpause=function(a){return this.each(function(){a=a||"fx";if(this.queue&&this.queue[a])this.queue[a].length=0})};var d=c(location.pathname);$("a[href*=#]").each(function(){var a=c(this.pathname)||d;if(d==a&&(location.hostname==this.hostname||!this.hostname)&&this.hash.replace(/#/,"")){var a=$(this.hash),b=this.hash,f=$(b).attr("name");if(b&&f){var e= a.offset().top;$(this).click(function(a){a.preventDefault();"www.walltowallsunshine.com"==window.location.host?$("html, body").animate({scrollTop:e-190},500,function(){}):$("html, body").animate({scrollTop:e},500,function(){location.hash=b})})}}});$("#cmdSubmit").click(function(){if($(".validate").valid()){if($("#recaptcha_widget").length){if(verify())return!0;reloadRecaptcha();return!1}return!0}});$("div label.required").append(' <strong><font color="#FF0000">*</font></strong> ');jQuery.validator.messages.required= "";$(".validate").validate({invalidHandler:function(a,b){b.numberOfInvalids()?$("#response").html('<span class="input-notification error png_bg">Required field(s) are empty or invalid</span>'):$("#response").empty()}});$(".datepicker").length&&$(".datepicker").datePicker({dateFormat:"dd-mm-yy"});$(".track").click(function(){var a=$(this).attr("class");$.post("/resources/vb/post-goal-complete.asp",{fClass:a},function(a){""!=a&&clicky.goal(a)});window.console&&window.console.firebug&&console.clear()}); $("#startSurvey").click(function(a){a.preventDefault();$.post("/resources/vb/post-start-survey.asp",{fContentId:$(this).attr("name")});varThis=$("h1").text();$("#content-showHide").hide();$("#survey-showHide h1").text(varThis);$("#survey-showHide").show();Cufon.refresh("h1")});$("#surveySubmit").click(function(a){if($(".validate").valid()){a.preventDefault();if($("#recaptcha_widget").length){if(verify())return $.post($("#surveyForm").attr("action"),{data:$("#surveyForm").serialize()},function(a){$("#inner-content").empty(); $("#inner-content").append(a)}),!0;reloadRecaptcha();return!1}$.post($("#surveyForm").attr("action"),{data:$("#surveyForm").serialize()},function(a){$("#inner-content").empty();$("#inner-content").append(a)});return!0}});$("#exists").length&&$("#exists").val("true")});
