String.prototype.capitalize=function(){return this.replace(/(^|\s)([a-z])/g,function(a,c,b){return c+b.toUpperCase()})};$(document).ready(function(){$("a.external").live("click",function(a){if(typeof _gaq=="object"){_gaq.push(["_trackEvent","General","ExternalWebsite",$(this).attr("href"),"click"])}});$(".salon-toolbar-contact").click(function(){if(typeof _gaq=="object"){_gaq.push(["_trackEvent","SalonToolbar","ContactSalon",$("h1").html()])}$("#YoursayReview").addClass("ui-helper-hidden");$("#YoursayUpdate").addClass("ui-helper-hidden");$("#YoursayMessage").toggleClass("ui-helper-hidden")});$(".salon-toolbar-review").click(function(){if(typeof _gaq=="object"){_gaq.push(["_trackEvent","SalonToolbar","ReviewSalon",$("h1").html()])}$("#YoursayMessage").addClass("ui-helper-hidden");$("#YoursayUpdate").addClass("ui-helper-hidden");$("#YoursayReview").toggleClass("ui-helper-hidden")});$(".salon-toolbar-update").click(function(){if(typeof _gaq=="object"){_gaq.push(["_trackEvent","SalonToolbar","UpdateSalon",$("h1").html()])}$("#YoursayMessage").addClass("ui-helper-hidden");$("#YoursayReview").addClass("ui-helper-hidden");$("#YoursayUpdate").toggleClass("ui-helper-hidden")});$("#InvalidNumber").click(function(){if(typeof _gaq=="object"){_gaq.push(["_trackEvent","SalonToolbar","InvalidNumber",$("h1").html()])}$.post("/yoursay/invalid_number",{id:$(this).attr("rel")},function(a){$("#VerifyInvalidNumber").html("<strong>Thank you</strong> for letting us know. We will re-verify this listing and update our directory.")});return false});$("#YoursayMessageButton").click(function(){var b,d,a=false,c=/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;$(".error").hide();$("#YoursayMessageThankyou").remove();$("#MessageEmail").parent("div").removeClass("highlight");$("#MessageName").parent("div").removeClass("highlight");$("#MessageSubject").parent("div").removeClass("highlight");$("#MessageMessage").parent("div").removeClass("highlight");b=$("#MessageEmail").val();if(b==""){$("#MessageEmail").parent("div").addClass("highlight");a=true}else{if(!c.test(b)){$("#MessageEmail").after('<p class="error">Please enter a valid email address.</p>');$("#MessageEmail").parent("div").addClass("highlight");a=true}}d=$("#MessageName").val().capitalize();if(d==""){$("#MessageName").parent("div").addClass("highlight");a=true}b=$("#MessageSubject").val();if(b==""){$("#MessageSubject").parent("div").addClass("highlight");a=true}b=$("#MessageMessage").val();if(b==""){$("#MessageMessage").parent("div").addClass("highlight");a=true}if(a){$(".error").show()}else{$(this).hide();$(this).after('<p id="YoursayLoading"><img src="/img/loading.gif" alt="Processing..." /></p>');$.post("/yoursay/contact_salon",$("#YoursayMessageForm").serialize(),function(e){$("#YoursayMessageForm").hide("fast");$("#YoursayLoading").remove();$("#YoursayMessageButton").show();if(e=="OK"){$("#YoursayMessageForm").before('<div id="YoursayMessageThankyou" class="FormThankyou"><h2>Thank you '+d+"</h2><p>Your message has been sent.</p></div>");$("#YoursayMessageForm .resetFields").val("");if(typeof _gaq=="object"){_gaq.push(["_trackEvent","SalonAction","ContactSalon",$("h1").html()])}}else{$("#YoursayMessageForm").before('<div id="YoursayMessageThankyou" class="FormThankyou"><h2>Error</h2><p>Thank you '+d+" however there has been an error sending your message to the salon.</p><p>["+e+"]</p></div>");$("#YoursayMessageForm").show("slow")}})}return false});$("#YoursayButton").click(function(){var b,d,a=false,c=/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;$(".error").hide();$("#YoursayThankyou").remove();$("#ContactEmail").parent("div").removeClass("highlight");$("#ContactName").parent("div").removeClass("highlight");$("#SalonProfileDescription").parent("div").removeClass("highlight");$("#SalonProfileName").parent("div").removeClass("highlight");$("#SalonProfileSource").parent("div").removeClass("highlight");b=$("#ContactEmail").val();if(b==""){$("#ContactEmail").parent("div").addClass("highlight");a=true}else{if(!c.test(b)){$("#ContactEmail").after('<p class="error">Please enter a valid email address.</p>');$("#ContactEmail").parent("div").addClass("highlight");a=true}}d=$("#ContactName").val().capitalize();if(d==""){$("#ContactName").parent("div").addClass("highlight");a=true}b=$("#SalonProfileName").val();if(b==""){$("#SalonProfileName").parent("div").addClass("highlight");a=true}b=$("#SalonProfileDescription").val();if(b==""){$("#SalonProfileDescription").parent("div").addClass("highlight");a=true}if(a){$(".error").show()}else{if(!confirm("Your review will be posted on this web page for other visitors to read.  Are you sure you want to post a review of this salon?")){$("#YoursayReview").addClass("ui-helper-hidden");return false}$(this).hide();$(this).after('<p id="YoursayLoading"><img src="/img/loading.gif" alt="Processing..." /></p>');$.post("/yoursay/yoursay",$("#SalonProfileYoursayForm").serialize(),function(e){$("#SalonProfileYoursayForm").hide("fast");$("#YoursayLoading").remove();$("#YoursayButton").show();if(e=="OK"){$("#SalonProfileYoursayForm").before('<div id="YoursayThankyou" class="FormThankyou"><h2>Thank you '+d+"</h2><p>Your review has been saved.</p></div>");$("#SalonProfileYoursayForm .resetFields").val("");if(typeof _gaq=="object"){_gaq.push(["_trackEvent","SalonAction","ReviewSalon",$("h1").html()])}}else{$("#SalonProfileYoursayForm").before('<div id="YoursayThankyou" class="FormThankyou"><h2>Error</h2><p>Thank you '+d+" however there has been an error saving your review.  Please retry.</p><p>["+e+"]</p></div>")}$("#SalonProfileYoursayForm").show("slow")})}return false});$("#YoursayRegisterButton").click(function(){var b,d,a=false,c=/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;$(".error").hide();$("#YoursayThankyou").remove();$("#SalonEmail").parent("div").removeClass("highlight");$("#SalonOwnerName").parent("div").removeClass("highlight");$("#SalonPhoneAlternate").parent("div").removeClass("highlight");b=$("#SalonEmail").val();if(b==""){$("#SalonEmail").parent("div").addClass("highlight");a=true}else{if(!c.test(b)){$("#SalonEmail").after('<p class="error">Please enter a valid email address.</p>');$("#SalonEmail").parent("div").addClass("highlight");a=true}}d=$("#SalonOwnerName").val().capitalize();if(d==""){$("#SalonOwnerName").parent("div").addClass("highlight");a=true}b=$("#SalonPhoneAlternate").val();if(b==""){$("#SalonPhoneAlternate").parent("div").addClass("highlight");a=true}if(a){$(".error").show()}else{$(this).hide();$(this).after('<p id="YoursayLoading"><img src="/img/loading.gif" alt="Processing..." /></p>');$.post("/yoursay/register",$("#YoursayRegisterForm").serialize(),function(e){$("#YoursayLoading").remove();if(e!="OK"){$("#YoursayRegisterForm").before('<div id="YoursayThankyou" class="FormThankyou"><h2>Error</h2><p>Thank you '+d+", however there was an error.  We will contact you to complete your registration.</p><p>["+e+"]</p></div>");$("#YoursayRegisterButton").show()}else{$("#YoursayRegisterForm").hide("fast");$("#YoursayRegisterForm").before('<div id="YoursayThankyou" class="FormThankyou"><h2>Thank you '+d+'</h2><p>Please check your email for a welcome message and links to update your listing.<br/>You may need to check your junk mail folder.  Please <a href="/contact">let us know</a> if you do not receive the email.</p></div>');$("#YoursayRegisterForm .resetFields").val("");if(typeof _gaq=="object"){_gaq.push(["_trackEvent","SalonAction","RegisterSalon",$("h1").html()])}}})}return false});$("#YoursayUpdateCancelButton").click(function(){$(".error").hide();$("#SalonEmailAddress").parent("div").removeClass("highlight");$("#SalonToken").parent("div").removeClass("highlight");$("#SalonAltName").parent("div").removeClass("highlight");$("#YoursayLoading").remove();$("#YoursayUpdateButton").show();$("#YoursayUpdateForm .resetFields").val("");$("#YoursayUpdate").addClass("ui-helper-hidden")});$("#YoursayUpdateButton").click(function(){var b,d,a=false,c=/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;$(".error").hide();$("#YoursayThankyou").remove();$("#SalonEmailAddress").parent("div").removeClass("highlight");$("#SalonToken").parent("div").removeClass("highlight");$("#SalonAltName").parent("div").removeClass("highlight");b=$("#SalonToken").val();if(b!=""){$("#YoursayUpdateForm").hide("fast");$.post("/yoursay/check_token",$("#YoursayUpdateForm").serialize(),function(e){$("#YoursayLoading").remove();if(e!="OK"){$("#SalonToken").val("");$("#YoursayUpdateForm").before('<div id="YoursayThankyou" class="FormThankyou"><h2>Error</h2><p>Invalid password. Please retry.</p><p>['+e+"]</p></div>");$("#YoursayUpdateForm").show("slow")}else{if(typeof _gaq=="object"){_gaq.push(["_trackEvent","SalonAction","UpdateSalon",$("h1").html()])}document.location="http://www.sassable.com/yoursay/profile"}});return}b=$("#SalonEmailAddress").val();if(b==""){$("#SalonEmailAddress").parent("div").addClass("highlight");a=true}else{if(!c.test(b)){$("#SalonEmailAddress").after('<p class="error">Please enter a valid email address.</p>');$("#SalonEmailAddress").parent("div").addClass("highlight");a=true}}d=$("#SalonAltName").val().capitalize();if(d==""){$("#SalonAltName").parent("div").addClass("highlight");a=true}if(a){$(".error").show()}else{$(this).hide();$(this).after('<p id="YoursayLoading"><img src="/img/loading.gif" alt="Processing..." /></p>');$.post("/yoursay/send_token",$("#YoursayUpdateForm").serialize(),function(e){$("#YoursayLoading").remove();if(e!="OK"){$("#YoursayUpdateForm").before('<div id="YoursayThankyou" class="FormThankyou"><h2>Error</h2><p>Thank you '+d+", however there was an error emailing your password.</p><p>["+e+"]</p></div>");$("#YoursayUpdateButton").show();$("#YoursayUpdateForm").show("slow")}else{$("#YoursayUpdateForm").hide("fast");$("#YoursayUpdateForm .resetFields").val("");$("#YoursayUpdateForm").before('<div id="YoursayThankyou" class="FormThankyou"><h2>Thank you '+d+'</h2><p>Please check your email for the password to update your listing.<br/>You may need to check your junk mail folder.  Please <a href="/contact">let us know</a> if you do not receive the email.</p></div>')}})}return false});if($("#SelectSuburb").length){$("#SelectSuburb").change(function(){window.location=$("#SelectSuburb option:selected").val()})}if($("#button-hair").length){$("#button-hair").click(function(){$(".buttonset-multi button").addClass("button-secondary");$(this).removeClass("button-secondary");$(".ind-beauty").addClass("ui-helper-hidden");$(".ind-hair").removeClass("ui-helper-hidden")});$("#button-beauty").click(function(){$(".buttonset-multi button").addClass("button-secondary");$(this).removeClass("button-secondary");$(".ind-hair").addClass("ui-helper-hidden");$(".ind-beauty").removeClass("ui-helper-hidden")});$("#button-all").click(function(){$(".buttonset-multi button").addClass("button-secondary");$(this).removeClass("button-secondary");$(".ind-beauty").removeClass("ui-helper-hidden");$(".ind-hair").removeClass("ui-helper-hidden")})}if($("#salon-finder-location").length){$.get("/yoursay/location",null,function(a){$("#salon-finder-location").html(a)})}$("#questions h3").prepend('<span class="ui-button ui-icon ui-icon-triangle-1-e"></span>').click(function(){$(this).next().slideToggle("slow");return false}).next().hide()});
