var ajax_login=new Object();ajax_login=(function(){return{get_ie_info:function(){var a=false;var b=false;if(/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)){a=true}var c=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(c.exec(navigator.userAgent)!=null){b=parseFloat(RegExp.$1)}return[a,b]},ie6_resize:function(){var b=document.documentElement.clientWidth;var a=document.documentElement.clientHeight;document.getElementById("overlay_page").style.width=(b+document.documentElement.scrollLeft)+"px";document.getElementById("overlay_page").style.height=(a+document.documentElement.scrollTop)+"px"},submit_ajax_login:function(d){var c=null;var b;if(d.data){c=d.data.on_edit_page;b=d.data.after_login_action}var f="";var e=document.getElementById("login_username").value;var a=document.getElementById("login_password").value;if(e==""||a==""){return false}$("#login_form").unbind();document.getElementById("ajax_login_busy").style.display="block";if(document.getElementById("login_remember").checked){f="1"}$.ajax({url:"/login/phps/ajax_login.php",type:"POST",data:"username="+e+"&password="+a+"&remember="+f,dataType:"json",error:function(){$("#login_form").bind("submit",{on_edit_page:c},ajax_login.submit_ajax_login);$("#login_msg").text("An error occurred.").slideDown();document.getElementById("ajax_login_busy").style.display="none"},success:function(g){switch(g.result){case"good":$("#login_username,#login_password").unbind();if(c){switch(b){case"save":page_save();break;default:ajax_login.stop_edit_overlay();break}}else{window.location.reload()}break;case"banned":$("#login_form").bind("submit",{on_edit_page:c},ajax_login.submit_ajax_login);$("#login_msg").text("You have been banned.").slideDown();document.getElementById("ajax_login_busy").style.display="none";break;default:$("#login_form").bind("submit",{on_edit_page:c},ajax_login.submit_ajax_login);$("#login_msg").text("Incorrect login").slideDown();document.getElementById("ajax_login_busy").style.display="none";break}}});return false},stop_edit_overlay:function(){var c=ajax_login.get_ie_info();var a=c[0];var b=c[1];if(a){if(b<=6){$(window).unbind()}document.getElementById("overlay_page").style.display="none";document.getElementById("overlay_login_cont").style.display="none";document.getElementById("overlay_page").className=""}else{$("#overlay_login_cont,#overlay_page").fadeOut("normal",function(){if(this.id=="overlay_page"){this.className=""}})}},toggle_login:function(b){var a=this.get_ie_info();if(b){$("#overlay_login_cont").click(function(c){if(c.target.id=="overlay_login_cont"){ajax_login.toggle_login(0)}});document.getElementById("login_msg").style.display="none";if(a[0]&&a[1]<=6){this.ie6_resize()}if(a[0]){if(a[1]<=6){$(window).resize(this.ie6_resize).scroll(this.ie6_resize)}document.getElementById("overlay_page").style.display="block"}else{$("#overlay_page").fadeIn("normal")}$("#login_form").bind("submit",ajax_login.submit_ajax_login);$("#overlay_login_cont").fadeIn("normal",function(){$("#login_username,#login_password").focus(function(){$(this).addClass("input_active").removeClass("input_inactive")}).blur(function(){$(this).removeClass("input_active").addClass("input_inactive")});$("#login_username").focus()})}else{$("#overlay_login_cont").unbind();if(a[0]){if(a[1]<=6){$(window).unbind()}document.getElementById("overlay_page").style.display="none";document.getElementById("overlay_login_cont").style.display="none"}else{$("#overlay_login_cont,#overlay_page").fadeOut("normal")}}return false}}})();if(typeof(window.myBar)!="undefined"){myBar.loadNext()};
