String.prototype.Trim=function(){
	return this.replace(/^\s+|\s+$/g,"");
}
			   
			  function checklog(){
			  		var con=document.getElementById('content').value;
			  		if(con.Trim()==""){
						alert("评论不能为空！");
						document.getElementById('content').focus();
						return ;
					}	else {
					document.getElementById('reviewForm').submit()
					}				  		
			    }	
		
			var XMLHttpReq;
			 	//创建XMLHttpRequest对象       
			    function createXMLHttpRequest() {
					if(window.XMLHttpRequest) { //Mozilla 浏览器
						XMLHttpReq = new XMLHttpRequest();
					}
					else if (window.ActiveXObject) { // IE浏览器
						try {
							XMLHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
						} catch (e) {
							try {
								XMLHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
							} catch (e) {}
						}
					}
				}
				//发送请求函数
				function sendRequest(url) {
					//alert(url);
					createXMLHttpRequest();			
					XMLHttpReq.open("POST", url, true);
					XMLHttpReq.setRequestHeader( "Content-Type", "text/html;charset=UTF-8" );	
					XMLHttpReq.onreadystatechange = processResponse;//指定响应函数
					XMLHttpReq.send(null);  // 发送请求
				}
				// 处理返回信息函数
			    function processResponse() {
			    	if (XMLHttpReq.readyState == 4) { // 判断对象状态
			        	if (XMLHttpReq.status == 200) { // 信息已经成功返回，开始处理信息
			            	var str=XMLHttpReq.responseText;
			            	var con;
			            	if(str==1){
			            	 document.getElementById('notLogin').style.display="none"; 			            	 	
			            	 alert("登录成功！");			            	              	            
							}else if(str==0){
			            	 alert("用户名或密码不正确，请重新输入！");
			            	}          
			            } else { //页面不正常
			               //window.alert("您所请求的页面有异常。");
			            }
			        }
			    }
			
			    
			  function login(){
			  		if(checkform()==true){
			  			var userName=document.getElementById('userName').value;
			  			var pwd=document.getElementById('pwd').value;
			  			var u="foreground/reviewLogin.do?userName="+userName+"&pwd="+pwd;
			  			sendRequest(u);
			  		}else{
			  			return false;
			  		}			    	
			    }	
			
				function checkform(){						
					var userName=document.getElementById('userName').value;
					var pwd=document.getElementById('pwd').value;
					if(userName.Trim()==""||(pwd.Trim()=="")){
						alert("用户名,密码不能为空！");
						return false;
					}else {
					return true;
					}					
				}