function login(e){Event.stop(e);var username=String(this.username.value).replace(/^ *(.*) *$/,'$1');var password=String(this.password.value).replace(/^ *(.*) *$/,'$1');if(username==''){alert('نام کابري خود را وارد نماييد');return false;}
if(password==''){alert('کلمه عبور خود را وارد نماييد');return false;}
var postData='username='+encodeURIComponent(username)+'&password='+encodeURIComponent(password)+(this.remember_pass.checked===true?'&remeber_pass=true':'')+(($('login_sec_img')&&$('login_sec_img').parentNode.style.display!='none')?'&sec_code='+encodeURIComponent(this.login_sec.value):'');Shadow.show(function(){var ajax=new Ajax('ajaxserver.php?'+this.action.split('?')[1],{evalScripts:true,data:postData});ajax.addEvent('onComplete',function(data){try{eval(data);}catch(e){}
if(typeof(data)!='undefined'&&data['status']==0){if(data&&data['result']&&data['result']=='ONLINE'){member_ID=data['id'];refreshLogin(this);}
loginChack(data);}}.bind(this));ajax.request();}.bind(this));}
function loginChack(result,form){var status=result['result']||null;switch(status){case'ONLINE':return true;break;case'WRONGPASS':alert('نام کاربری و رمز عبور مطابقت ندارد');break;case'WRONGSEC':alert('کد امنیتی مطابقت ندارد');break;}
Shadow.hide();if(result['showsec']=='y'){with($('login_sec_img')){innerHTML=result['sec_img'];parentNode.style.display='';parentNode.nextSibling.style.display='';}}}
function refreshLogin(form){var _cp=form._cp.value;simpleLoad('login_box',form._lb.value,null,function(){simpleLoad('main_area',_cp,null,function(){Shadow.hide();});});}
function focusLoginfield(obj,n){}
Event.onReady(function(){Event.observe('login_form','submit',login.bindAsEventListener($('login_form')));});