function checkLogin(u){
   var username=$('logusername');
   var password=$('logpassword');

   var url="/member.do?method=login";
   if(username.value=="") {
   		username.focus();
   		alert("用户名不能为空");
   		return false;
   }
   if(password.value=="") {
   		password.focus();
   		alert("密码不能为空");
   		return false;
   }
   var mark=document.getElementById("mark");
   var markValue="";
   if(mark!=null){
       if(mark.checked){
         markValue="1";       
       }else{
         markValue="0";
       }
   }else{
      markValue="0";
   }
	 var pars='username='+username.value+'&password='+password.value+'&mark='+markValue;	 
	 
//	  alert(pars);
 	 new Ajax.Request( url, { method: 'post',parameters: pars,onComplete: function(response){
// 	   alert(response.responseText);
		if(response.responseText.match("false")){
				    alert("用户名和密码错误,请重新输入!");
					return false;					
			}else{
			     if(response.responseText.match("true")){
			    	 if(u!=null){
			    		 window.opener.location.href=u;
			    		 window.close();
			    	 }else{
			    		 document.location.href="/member.do?method=index";  
			    	 }
			     }else{			     
			        document.location.href=response.responseText;			     
			     }
				}
			}
		}				
	);	
}
function checkLoginFrame(u){
	   var username=$('logusername');
	   var password=$('logpassword');

	   var url="/member.do?method=login";
	   if(username.value=="") {
	   		username.focus();
	   		alert("用户名不能为空");
	   		return false;
	   }
	   if(password.value=="") {
	   		password.focus();
	   		alert("密码不能为空");
	   		return false;
	   }
	   var mark=document.getElementById("mark");
	   var markValue="";
	   if(mark!=null){
	       if(mark.checked){
	         markValue="1";       
	       }else{
	         markValue="0";
	       }
	   }else{
	      markValue="0";
	   }
		 var pars='username='+username.value+'&password='+password.value+'&mark='+markValue;	 
		 
//		  alert(pars);
	 	 new Ajax.Request( url, { method: 'post',parameters: pars,onComplete: function(response){
//	 	   alert(response.responseText);
			if(response.responseText.match("false")){
					    alert("用户名和密码错误,请重新输入!");
						return false;					
				}else{
				     if(response.responseText.match("true")){
				    	 if(u!=null){
				    		
				    		 window.opener.parent.location.href=u;
				    		 window.close();
				    	 }else{
				    		 document.location.href="/member.do?method=index";  
				    	 }
				     }else{			     
				        document.location.href=response.responseText;			     
				     }
					}
				}
			}				
		);	
	}


function checkBBSLogin(){
   var username=$('logusername');
   var password=$('logpassword');
 //alert(username.value);

   var url="member.do?method=login";
   if(username.value=="") {
   		username.focus();
   		alert("用户名不能为空");
   		return false;
   }
   if(password.value=="") {
   		password.focus();
   		alert("密码不能为空");
   		return false;
   }
   var mark=document.getElementById("mark");
   var markValue="";
   if(mark!=null){
       if(mark.checked){
         markValue="1";       
       }else{
         markValue="0";
       }
   }else{
      markValue="0";
   }
	 var pars='username='+username.value+'&password='+password.value+'&mark='+markValue;	 
	 // alert(pars);
 	 new Ajax.Request( url, { method: 'post',parameters: pars,onComplete: function(response){
 	   //alert(response.responseText);
		if(response.responseText.match("false")){
				    alert("用户名和密码错误,请重新输入!");
					return false;					
			}else{
			     if(response.responseText.match("true")){
			        document.location.href="../../member.do?method=index";
			     }else{			     
			        document.location.href=response.responseText;			     
			     }
			     
				 ;
				}
			}
		}				
	);	
}






function clearChkInput(o,str){
	if(o.value==str){
	   o.value="";   
	}
}
