var $j;
function fs_login_init(){$j("input").each(function(){$j(this).addClass($j(this).attr("type"));});$j("#email").focus(function(){fs_util_focus(this);}).blur(function(){fs_util_blur(this);});$j("#password").focus(function(){fs_util_focus(this);}).blur(function(){fs_util_blur(this);});$j("#forgot-password").click(function(){fs_login_forgot();return false;});$j("#activate-account").click(function(){fs_login_activate();return false;});$j("#button-login").click(function(){fs_login_process();});}
function fs_login_process(){var b;var a;var c=new Array();b=$j.trim($j("#email").val());a=$j.trim($j("#password").val());if(b==$j("#email").attr("title")){b="";}if(a==$j("#password").attr("title")){a="";}if(b==""){c.push("<li>Email addresses is required</li>");}if(a==""){c.push("<li>Password is required</li>");}if(c.length>0){$j("#messages").html("<ul>"+c.join("")+"</ul>");$j("#messages").show();return;}fs_getJSON("../app/helper/post-login.php",{email:b,password:a},"html",function(e,d){if(e=="success"){window.location.href="../myflyspy/";}else{$j("#messages").html(e);$j("#messages").show();}},function(e,d,f){$j("#messages").html("There was a problem logging in, please try again in a minute.");$j("#messages").show();});}
function fs_login_forgot(){var a;var b=new Array();a=$j.trim($j("#email").val());if(a==$j("#email").attr("title")){a="";}if(a==""){b.push("<li>Email addresses is required</li>");}if(b.length>0){$j("#messages").html("<ul>"+b.join("")+"</ul>");$j("#messages").show();return;}fs_getJSON("../app/helper/post-login.php",{email:a,forgot:1},"html",function(d,c){if(d=="success"){$j("#messages").html("Thank you, your password has been emailed to you");$j("#messages").show();$j("#messages").fadeOut(10000);}else{$j("#messages").html(d);$j("#messages").show();}},function(d,c,e){$j("#messages").html("There was a problem emailing your password to you, please try again in a minute.");$j("#messages").show();});}
function fs_login_activate(){var a;var b=new Array();a=$j.trim($j("#email").val());if(a==$j("#email").attr("title")){a="";}if(a==""){b.push("<li>Email addresses is required</li>");}if(b.length>0){$j("#messages").html("<ul>"+b.join("")+"</ul>");$j("#messages").show();return;}fs_getJSON("../app/helper/post-login.php",{email:a,activate:1},"html",function(d,c){if(d=="success"){$j("#messages").html("Thank you, an account activation email has been sent to you");$j("#messages").show();$j("#messages").fadeOut(10000);}else{$j("#messages").html(d);$j("#messages").show();}},function(d,c,e){$j("#messages").html("There was a problem activating your account, 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);}