jQuery(document).ready(function($){$('#LoginWithAjax_Form').submit(function(event){event.preventDefault();$('
').prependTo('#LoginWithAjax');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+="&rememberme="+encodeURIComponent($("#lwa_rememberme").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{$(''+data.message+'').prependTo('#login-with-ajax');} if(data.widget!=null){$.get(data.widget,function(widget_result){$('#LoginWithAjax').replaceWith(widget_result);$('#LoginWithAjax_Title').replaceWith($('#LoginWithAjax_Title_Substitute').text());});}else{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{$(''+data.error+'').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{$('An error has occured. Please try again.').prependTo('#login-with-ajax');}}});});$('#LoginWithAjax_Remember').submit(function(event){event.preventDefault();$('
').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(data.message);}else{$(''+data.message+'').prependTo('#login-with-ajax');}}else{if($('#LoginWithAjax_Status').length>0){$('#LoginWithAjax_Status').attr('class','invalid').html(data.error);}else{$(''+data.error+'').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{$('An error has occured. Please try again.').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');});});