var eform;
function val_login(form) {
msgbox.reference=form;
eform = new jforms(form);
with (eform) {
disable();
// Email Checker
	if(!isMail(email)) {
		msgbox.show(err.text,err.icon,"Login Message",'action=Close|modal',err.callback);
	} else if (isEmpty(pwd)) {
		msgbox.show("Please enter your password",err.icon,"Login Message",'action=Continue|',err.callback);
	} else {	
//post ajax request

msgbox.show("<img src='images/circle.gif' align=absmiddle>&nbsp; Please wait...","","","modal=true|title=false|buttons=false")
msgbox.textbox.style.cssText+=";width:200px;height:50px;border:10px solid #7f7f60;text-align:center;";

post(function(){
	if(isReady()) {
	//post complete
	 switch(parseInt(json.error)) {
	 case 0:
	 hide();	 
	 var url=urldecode(json.url);
	 setTimeout(function() {location.href=url},1);
	 break;
	 case 1:
	 msgbox.show(json.msg,"information","Login Message",'action=Thank You|');
	 enable();
	 break;
	 default:
	 alert('Error:\n'+responseText);
	 enable();
	 msgbox.hide();
	 break;
	}	 
	} else if(isNav()) {
	//post incomplete
	  msgbox.show(json.msg,json.icon,json.title,"action=Close|",json.callback);
	}
	},"json"
  );
 }
}


return false;
}
