var delay=500;var to=null;$(document).ready(function(){$(".pop_close").click(function(){$(".subhideable").fadeOut("fast")});$(".btn_login_show").click(function(){if($("#login").is(":visible")){$(".subhideable").fadeOut("fast")}else{$(".subhideable").hide();$("#login").fadeIn("fast")}});$("#bus_signup").click(function(){Recaptcha.create(RECAPTCHA_PUBLICKEY,"business_recaptcha",{theme:"white"});$(".subhideable").hide();hideall();$("#join_business").show()});$("#bus_type").val(0);$(".passwordButton").click(function(){if($("#forgot").is(":visible")){$(".subhideable").fadeOut("fast")}else{$(".subhideable").fadeOut("fast");$("#forgot").fadeIn("fast")}});$("#auth_login_form input").keypress(function(a){if(a.keyCode==13){login()}});$(".createButton").click(function(){Recaptcha.create(RECAPTCHA_PUBLICKEY,"personal_recaptcha",{theme:"white"});$("html, body").animate({scrollTop:0},"slow");$(".subhideable").fadeOut("fast");$("#create_account").fadeIn("fast")});$(".createButton_featured").click(function(){$(".subhideable").fadeOut("fast");$("#join_network").fadeIn("fast");$("html, body").animate({scrollTop:0},"slow")});$("#suemail").keypress(function(a){if(to){clearTimeout(to);to=null}if($("#suemail").val()!=""){to=setTimeout("checkemail(1)",delay)}});$("#bus_email").keypress(function(a){if(to){clearTimeout(to);to=null}if($("#bus_email").val()!=""){to=setTimeout("checkemail(2)",delay)}});$("#joinmapmy").fadeIn("fast")});function show_login(){if($("#login").is(":visible")){$(".subhideable").fadeOut("fast")}else{$(".subhideable").hide();$("#login").fadeIn("fast")}}function validateBusiness(){hideMsg(document.getElementById("form_error_msg"));if(trim($("#bus_first_name").val())==""){inlineMsg("bus_first_name",'<img width="10" src="/img/home/icon_close.gif" onclick="hideMsg(this);" id="form_err_msg_close"/>Enter your given name.',5);document.getElementById("bus_first_name").focus();return}if(trim($("#bus_last_name").val())==""){inlineMsg("bus_last_name",'<img width="10" src="/img/home/icon_close.gif" onclick="hideMsg(this);" id="form_err_msg_close"/>Enter your surname.',5);document.getElementById("bus_last_name").focus();return}em=trim($("#bus_email").val());if(em==""){inlineMsg("bus_email",'<img width="10" src="/img/home/icon_close.gif" onclick="hideMsg(this);" id="form_err_msg_close"/>Enter your email address. This will be used as your unique user name.',5);document.getElementById("bus_email").focus();return}if(em.search(/^[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}$/i)===-1){inlineMsg("bus_email",'<img width="10" src="/img/home/icon_close.gif" onclick="hideMsg(this);" id="form_err_msg_close"/>This does not seem to be a valid email address.',5);document.getElementById("bus_email").focus();return}p=trim($("#bus_password").val());if(p==""){inlineMsg("bus_password",'<img width="10" src="/img/home/icon_close.gif" onclick="hideMsg(this);" id="form_err_msg_close"/>Enter the password for your account.',5);document.getElementById("bus_password").focus();return}if(p.length<6){inlineMsg("bus_password",'<img width="10" src="/img/home/icon_close.gif" onclick="hideMsg(this);" id="form_err_msg_close"/>Password must be at least 6 characters.',5);document.getElementById("bus_password").focus();return}if(!($("#bus_dob").datepicker("getDate"))){s;inlineMsg("bus_dob",'<img width="10" src="/img/home/icon_close.gif" onclick="hideMsg(this);" id="form_err_msg_close"/>Please enter your date of birth.',5);document.getElementById("bus_dob").focus();return}if(trim($("#bus_name").val())==""){inlineMsg("bus_name",'<img width="10" src="/img/home/icon_close.gif" onclick="hideMsg(this);" id="form_err_msg_close"/>Please enter the name of your business.',5);document.getElementById("bus_name").focus();return}if($("#bus_type").val()==0){inlineMsg("bus_type",'<img width="10" src="/img/home/icon_close.gif" onclick="hideMsg(this);" id="form_err_msg_close"/>Select the type that best describes you business.',5);document.getElementById("bus_type").focus();return}if($("#bus_subtype").val()==0){inlineMsg("bus_subtype",'<img width="10" src="/img/home/icon_close.gif" onclick="hideMsg(this);" id="form_err_msg_close"/>Select the category that best describes your business.',5);document.getElementById("bus_subtype").focus();return}if(!$("#bus_mapmy_confirm").is(":checked")){inlineMsg("bus_mapmy_confirm",'<img width="10" src="/img/home/icon_close.gif" onclick="hideMsg(this);" id="form_err_msg_close"/>You must agree to our terms and conditions to be a member.',5);document.getElementById("bus_mapmy_confirm").focus();return}if(!$("#bus_google_confirm").is(":checked")){inlineMsg("bus_google_confirm",'<img width="10" src="/img/home/icon_close.gif" onclick="hideMsg(this);" id="form_err_msg_close"/>You must agree to Google\'s terms and conditions to be a member.',5);document.getElementById("bus_google_confirm").focus();return}waitElement("bus_signup_btn");$.post("/ci/welcome/checkemail",{email:$("#bus_email").val()},function(a){if(a.available){$.post("/ci/welcome/create_business_account",{print:"false",salutation:$("#bus_salutation").val(),firstname:$("#bus_first_name").val(),lastname:$("#bus_last_name").val(),email:$("#bus_email").val(),password:$("#bus_password").val(),dob:$("#bus_dob").datepicker("getDate"),referralby:$("#bus_referralby").val(),businessname:$("#bus_name").val(),bustype:$("#bus_subtype").val(),signup_site:$("#signup_site").val(),complete:1},function(b){restoreElement("bus_signup_btn");if(b.result){document.location.href="/ci/map/"}else{inlineMsg("btn_join","Could not create account at this time.  Please try again later.",4)}},"json")}else{restoreElement("bus_signup_btn");inlineMsg("bus_email",'<img width="10" src="/img/home/icon_close.gif" onclick="hideMsg(this);" id="form_err_msg_close"/>This email address is already in use, please try another.',5)}},"json")}function getSubs(){if($("#bus_type").val()!=0){$.post("/ci/welcome/getBusinessCategories/",{parent:$("#bus_type").val()},function(a){$("#bus_subtype").empty().append("<option value='0'>Select Category</option>");$.each(a.cats,function(b,c){$("#bus_subtype").append("<option value='"+c.type_id+"'>"+c.descr+"</option>")});$("#bus_subtype").val(0)},"json")}else{$("#bus_subtype").empty().append("<option value='0'>Select a type first</option>")}};