//关闭弹出登陆窗口
function alertInfo(){
		window.location='/wg/EService/info.jsp';
}
function closePropmtBox(PID,ID){

 // document.getElementById("dvCate").style.display="none";
 // document.getElementById("username2").value="";
 // document.getElementById("password2").value="";
//  var obj=document.getElementById("fdiv");
 // var ccmp=document.getElementById("ccmp");
 // document.body.removeChild(obj);
 // if(ccmp!=null &&ccmp.value=='1'){
 //	return false;
  //}else {
  	//ID取前四位以得到E-Service模块
 //	 window.location.href="http://www.schneider-electric.cn/china/cn/home.page?p_message=&";
 //win=window.open("ss.jsp","","");
 //	win.close();
   //  window.parent.close();
// setTimeout("window.close();",0);
 	 //return true;
 //}
  var MainWindow=window.open('http://www.schneider-electric.cn/china/cn/home.page?p_message=&','','toolbar=no,scrollbars=no,resizable=yes,statusbars=no');
    window.open('','_parent','');
    MainWindow.close();
    window.close();
}
//建立XMLHttpRequest对象
function createXMLHttpRequest(){
	if(window.ActiveXObject){
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}else if(window.XMLHttpRequest){
		xmlHttp=new XMLHttpRequest();
	}
	return xmlHttp;
}
///打开弹出登陆窗口
function openWin(type){
				
				var p=40;
				var f = document.createElement('DIV');
				f.style.textAlign = "center";
				f.style.position = "absolute";
				f.style.filter = "alpha(opacity="+p+")";
				f.style.opacity = (p / 100);
				f.style.MozOpacity = (p / 100);
				f.style.KhtmlOpacity = (p / 100);
				f.style.width  = document.body.scrollWidth;
				f.style.height = document.body.scrollHeight;
				f.style.margin = "0px";
				f.style.backgroundColor ='white';
				f.style.top=0;
				f.style.left=0;
				f.style.ZINDEX=100;
				f.style.overflow = 'hidden';				
				
				if(type=="1"){								
					document.getElementById("ccmplogin").style.display="";
					document.getElementById("rrlogin").style.display="none";
								
				}else if(type=="0"){									
					document.getElementById("ccmplogin").style.display="none";
					document.getElementById("rrlogin").style.display="";
				}
				f.innerHTML = "<iframe   style='position:absolute;z-index:-1;width:100%;height:100%;top:0;left:0;scrolling:no;' frameborder='0' src='about:blank'></iframe>" ;
				
				f.setAttribute('id','fdiv');
				document.body.appendChild(f);
				var obj=document.getElementById("dvCate");
				obj.style.display="";
				/////对登陆窗口的位置进行定位操作，在浏览器窗口的中间
				var clientWindow=getViewportInfo();
				var openWin=document.getElementById("dvCate");
				var wid=(clientWindow.w-300)/2;
				var heig=(clientWindow.h-220)/2;
				openWin.style.left=wid+"px";
				openWin.style.top=heig+"px";
				document.getElementById("username2").focus();
			}
			
			//////////////////////////////
			function getViewportInfo() {
				var w = (window.innerWidth) ? window.innerWidth : (document.documentElement && document.documentElement.clientWidth) ? document.documentElement.clientWidth : document.body.offsetWidth;
				var h = (window.innerHeight) ? window.innerHeight : (document.documentElement && document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.body.offsetHeight;
				return {w:w,h:h};
			}
			
			////////////////////////////////
			function keyEnter2(){
				if(event.keyCode==13){
					doLogin2();
				}
			}
			/////////////////
			function keyEnter3(){
				if(event.keyCode==13){
					document.getElementById("password2").focus();
				}
			}

			var xmlHttp=null;
			
			function doLogin2(){
			    var url="/servlet/LoginServlet?timeStamp="+new Date().getTime();
			    var queryString="name="+document.getElementById("username2").value+"&pwd="+document.getElementById("password2").value;
			    xmlHttp=createXMLHttpRequest();
				xmlHttp.open("POST",url,true);
				xmlHttp.onreadystatechange=handleStateChange;
				xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
				xmlHttp.send(queryString);
			}
			
			function handleStateChange(){
				if(xmlHttp.readyState==4){
					if(xmlHttp.status==200){
                       displayResult();
					}
				}
			}
			
			function displayResult(){
				if(xmlHttp.responseText=="0"){
					alert("用户名或密码错误，请您重新登陆！");
					document.getElementById("username2").value="";
					document.getElementById("password2").value="";
					document.getElementById("username2").focus();
				}else if(xmlHttp.responseText=="1"){
					//alert("登陆成功！");
					
					window.location.reload();
				}else{
					alert("系统错误，请您重新登陆！");
					closePropmtBox();
				}
			}
