
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 loginBBSRequest(url) {
		createXMLHttpRequest();
		XMLHttpReq.open("GET",url, true);
     	XMLHttpReq.onreadystatechange = processloginBBSResponse;//指定响应函数
    	XMLHttpReq.send(null);  // 发送请求
	}
	// 处理身份验证返回信息函数
    function processloginBBSResponse() {

    	if (XMLHttpReq.readyState == 4) { // 判断对象状态
 document.getElementById("loading").innerHTML="" ;
        	if (XMLHttpReq.status == 200) { // 信息已经成功返回，开始处理信息
            	var res=XMLHttpReq.responseXML.getElementsByTagName("res")[0].firstChild.nodeValue;
            	
				
            	     if (res==1){

                	window.alert("用户名错误！");                
                }
                else if (res==2){

                	window.alert("密码错误！");                
                } else if (res==22){

                	window.alert("您的账号未激活，需够买E卡币！咨询热线：400-618-0111 ");                
                }else if (res==33){

                	window.alert("您的账号已被系统注销！");                
                }
          
                else if (res==0){
					window.location = 'default.jsp';             
                }
				else if(res==4){
	
				    window.location = "../index_representative.jsp";   
				}
				else if(res==3){
    				window.location = "../index_suppliers.jsp"; 
				}
				else if(res==6){
					window.location = "../admin/index.jsp";    
				}else if(res==5){
					window.location = "../index_ZJyys_ys.jsp";    
				}
				else if(res==7){
					window.location = "../index_yys_ys.jsp";    
				}
				else if(res==9){
					window.location = "../index_message.jsp";    
				}
				else if(res==10){
					window.location = "../admin/index_suppliersEditor.jsp";    
				}else if(res==11){
					window.location = "../retailSystem/indexWeb.jsp";    
				}
            } else { //页面不正常
                window.alert("您所请求的页面有异常。");
            }
        }else
		{
		 document.getElementById("loading").innerHTML="<img src='../images/loading.gif' border='0'> 请等待..." ;
		}
		
    }
	
  