jQuery(document).ready(function($){$("#LoginWithAjax_Form").submit(function(event){event.preventDefault();if($("#LoginWithAjax").length>0){$('<div class="LoginWithAjax_Loading" id="LoginWithAjax_Loading"></div>').prependTo("#LoginWithAjax");}else{$('<div class="LoginWithAjax_Loading" id="LoginWithAjax_Loading"></div>').prependTo("#login-with-ajax");}url=$("#LoginWithAjax_Form").attr("action");url+=(url.match(/\?/)!=null)?"&callback=?":"?callback=?";url+="&log="+encodeURIComponent($("#lwa_user_login")).attr("value");url+="&pwd="+encodeURIComponent($("#lwa_user_pass")).attr("value");url+="&login-with-ajax=login";$.getJSON(url,function(data,status){$("#LoginWithAjax_Loading").remove();if(data.result===true||data.result===false){if(data.result===true){if($("#LoginWithAjax_Status").length>0){$("#LoginWithAjax_Status").attr("class","confirm").html(data.message);}else{$('<span id="LoginWithAjax_Status" class="confirm">'+data.message+"</span>").prependTo("#login-with-ajax");}if(data.redirect==null){window.location.reload();}else{window.location=data.redirect;}}else{if($("#LoginWithAjax_Status").length>0){$("#LoginWithAjax_Status").attr("class","invalid").html(data.error);}else{$('<span id="LoginWithAjax_Status" class="invalid">'+data.error+"</span>").prependTo("#login-with-ajax");}$("#LoginWithAjax_Status").click(function(event){event.preventDefault();$("#LoginWithAjax_Remember").show("slow");});}}else{if($("#LoginWithAjax_Status").length>0){$("#LoginWithAjax_Status").attr("class","invalid").html("An error has occured. Please try again."+status);}else{$('<span id="LoginWithAjax_Status" class="invalid">An error has occured. Please try again.</span>').prependTo("#login-with-ajax");}}});});$("#LoginWithAjax_Remember").submit(function(event){event.preventDefault();$('<div id="LoginWithAjax_Loading"></div>').prependTo("#LoginWithAjax");url=$("#LoginWithAjax_Remember").attr("action");url+=(url.match(/\?/)!=null)?"&callback=?":"?callback=?";url+="&user_login="+$("#lwa_user_remember").attr("value");url+="&login-with-ajax=remember";$.getJSON(url,function(data,status){$("#LoginWithAjax_Loading").remove();if(data.result===true||data.result===false){if(data.result=="1"){if($("#LoginWithAjax_Status").length>0){$("#LoginWithAjax_Status").attr("class","confirm").html("We have sent you an email");}else{$('<span id="LoginWithAjax_Status" class="confirm">We have sent you an email</span>').prependTo("#login-with-ajax");}}else{if($("#LoginWithAjax_Status").length>0){$("#LoginWithAjax_Status").attr("class","invalid").html(data.error);}else{$('<span id="LoginWithAjax_Status" class="invalid">'+data.error+"</span>").prependTo("#login-with-ajax");}}}else{if($("#LoginWithAjax_Status").length>0){$("#LoginWithAjax_Status").attr("class","invalid").html("An error has occured. Please try again."+status);}else{$('<span id="LoginWithAjax_Status" class="invalid">An error has occured. Please try again.</span>').prependTo("#login-with-ajax");}}});});$("#LoginWithAjax_Remember").hide();$("#LoginWithAjax_Links_Remember").click(function(event){event.preventDefault();$("#LoginWithAjax_Remember").show("slow");});$("#LoginWithAjax_Links_Remember_Cancel").click(function(event){event.preventDefault();$("#LoginWithAjax_Remember").hide("slow");});});