var $j;
function fs_register_init(){$j("input").each(function(){$j(this).addClass($j(this).attr("type"));});$j("#first-name").focus(function(){fs_util_focus(this);}).blur(function(){fs_util_blur(this);});$j("#last-name").focus(function(){fs_util_focus(this);}).blur(function(){fs_util_blur(this);});$j("#email-1").focus(function(){fs_util_focus(this);}).blur(function(){fs_util_blur(this);});$j("#email-2").focus(function(){fs_util_focus(this);}).blur(function(){fs_util_blur(this);});$j("#button-signup").click(function(){fs_register_process();});}
function fs_register_process(){var e;var d;var b;var g;var c;var a;var f=new Array();e=$j.trim($j("#first-name").val());d=$j.trim($j("#last-name").val());b=$j.trim($j("#email-1").val());g=$j.trim($j("#email-2").val());c=$j.trim($j("#password-1").val());a=$j.trim($j("#password-2").val());if(e==$j("#first-name").attr("title")){e="";}if(d==$j("#last-name").attr("title")){d="";}if(b==$j("#email-1").attr("title")){b="";}if(g==$j("#email-2").attr("title")){g="";}if(b==""||g==""){f.push("<li>both email addresses must be supplied</li>");}else{if(b!=g){f.push("<li>both email addresses must match</li>");}}if(c==""||a==""){f.push("<li>both passwords must be supplied</li>");}else{if(c!=a){f.push("<li>both passwords must match</li>");}}if(f.length>0){$j("#messages").html("<ul>"+f.join("")+"</ul>");$j("#messages").show();return;}fs_getJSON("../app/helper/post-register.php",{first_name:e,last_name:d,email:b,password:c},"html",function(i,h){if(i=="success"){$j("#messages").html("Thank you, your registration is complete. You will receive an activation email shortly.");$j("#messages").show();$j("form").hide();}else{$j("#messages").html(i);$j("#messages").show();}},function(i,h,j){$j("#messages").html("There was a problem with your registration, please try again in a minute.");$j("#messages").show();});}
function fs_util_blur(a){if($j(a).val()==""){$j(a).val($j(a).attr("title"));$j(a).addClass("placeholder");}}
function fs_util_focus(a){if($j(a).val()==$j(a).attr("title")){$j(a).val("");$j(a).removeClass("placeholder");}}
function fs_getJSON(c,d,f,e,a){var b={};b.type=d.Method||"POST";b.url=c;b.processData=true;b.cache=false;b.data=d;b.dataType=f;b.success=e;if(a){b.error=a;}$j.ajax(b);}