var alternateFrame=null; 
var alternateWin=null;

 
function alternateWindow(){
this.win=null; 
this.pBody=null; 
this.pBg=null;
this.type="alert"; 
}
 
function showAlert(){
alternateWin=new alternateWindow();
var pBody = alternateWin.init();
alternateWin.initAlertBody(pBody);
}

 
function subb(){
var usr=document.getElementById('popframe').contentWindow.document.getElementById('usr').value;
var pass=document.getElementById('popframe').contentWindow.document.getElementById('pass').value;
if(usr.length==0){
alert("用户名不能为空！\r\r请重新填写！");
document.getElementById('popframe').contentWindow.document.getElementById('usr').focus();
return false;
}
if(pass.length==0){
alert("密码不能为空！\n\n请重新填写！");
document.getElementById('popframe').contentWindow.document.getElementById('pass').focus();
return false;
}
parent.alternateWin.closeWin();
}
 
function showConfirm(info,ok_func,notok_func,ok_str,not_okstr){
alternateWin=new alternateWindow();
var pBody = alternateWin.init();
alternateWin.initConfirmBody(pBody,info,ok_func,notok_func,ok_str,not_okstr);
alternateWin.type="confirm";
}
 
alternateWindow.prototype.init=function() {
if(alternateFrame==null){
alternateFrame=document.createElement("<iframe allowTransparency='true'   id='popframe' frameborder=0 marginheight=0 src='about:blank' marginwidth=0 hspace=0 vspace=0 scrolling=no></iframe>")
alternateFrame.style.position="absolute";
document.body.appendChild(alternateFrame);
}else{
alternateFrame.style.visibility="visible";
}
alternateFrame.style.width= document.body.scrollWidth;
alternateFrame.style.height=document.body.scrollHeight;
alternateFrame.style.left=document.body.scrollLeft;
alternateFrame.style.top=document.body.scrollTop;
alternateFrame.name=alternateFrame.uniqueID;

this.win=window.frames[alternateFrame.name];
this.win.document.write("<body leftmargin=0   topmargin=0 oncontextmenu='self.event.returnValue=false'><div id=popbg></div><div id=popbody></div><div></div></body>");
this.win.document.body.style.backgroundColor="transparent";
document.body.style.overflow="hidden";
this.pBody=this.win.document.body.children[1];
this.pBg=this.win.document.body.children[0];
this.hideAllSelect();
this.initBg();

return this.pBody;
}

 
alternateWindow.prototype.initBg=function(){
with(this.pBg.style){
position="absolute";
left="0";
top="0";
width="100%";
height="100%";
visibility="hidden";
backgroundColor="#333333";
filter="blendTrans(duration=1) alpha(opacity=30)";
}
this.pBg.filters.blendTrans.apply();
this.pBg.style.visibility="visible";
this.pBg.filters.blendTrans.play();
}
 
alternateWindow.prototype.initAlertBody=function(obj){
with(obj.style){
position="absolute";
width="300";
height="170";
backgroundColor="#ffffff";
}
obj.style.left=window.document.body.clientWidth/2-190;
obj.style.top=200;
var str;
var str="<form action='http://www.263xmail.com/xmweb' name='tj' onsubmit='return parent.subb()' target='_blank' style='margin: 0 0 0 0'>";
 str+=" <input type='hidden' name='chr' value='gb' ><input type='hidden' name='func' value='login' >";
str +="<table border=0 cellpadding=0 cellspacing=0 bgcolor=#000000 width='100%' height='100%'><tr height=30>";
str+="<td align=left style='color:#000000;font-size:14px;font-weight:bold' bgcolor=#9999ff>企业邮箱登录</td></tr>";
str+="<tr><td><table border=0 cellpadding=0 cellspacing=0 bgcolor=#000000 width=100% height=100%><tr><td align=right bgcolor=#efefff style='font-size:12px;color:#000000;vertical-align: middle;'>";
str+="&nbsp;&nbsp;&nbsp;用户名：</td><td align=left bgcolor=#efefff style='font-size:12px;color:#000000;vertical-align: middle;'>"+
     "<input type='text' id='usr' name='usr' size='20' style='font-family:MS Shell Dlg'/><br><span style='color:#000000;font-size:16px;font-weight:bold'>@itcchina.com</span><input type='hidden' id='domain' name='domain' size='20' value='itcchina.com'/>&nbsp;&nbsp;&nbsp;</td></tr>"+
	 "<tr><td  align=right bgcolor=#efefff style='font-size:12px;color:#000000;vertical-align: middle;'>&nbsp;&nbsp;&nbsp;密&nbsp;&nbsp;&nbsp;&nbsp;码：</td>"+
	 "<td align=left bgcolor=#efefff style='font-size:12px;color:#000000;vertical-align: middle;'>"+
	 "<input  type='password' id='pass' name='pass' size='20' style='font-family:MS Shell Dlg'/></td></tr></table></td></tr>" +
     " <tr height=30 bgcolor=#efefef><td align=center>"+
     "&nbsp;&nbsp;&nbsp;&nbsp;<input type='submit' value='登录' id='OK1'" +
     " onkeydown='parent.alternateWin.onKeyDown(event,this)'"+
     " style='border:solid 1px #666666;background:#cccccc'>&nbsp;&nbsp;&nbsp;&nbsp;" +
     "<input type='button' value='关闭' id='OK2'" +
     " onkeydown='parent.alternateWin.onKeyDown(event,this)'"+
     " onclick='parent.alternateWin.closeWin()' style='border:solid 1px #666666;background:#cccccc'>" +
     "</td></tr></table></form>";
obj.innerHTML=str;

}

alternateWindow.prototype.onKeyDown=function(event,obj){
  switch(event.keyCode){
  case 9:
   event.keyCode=-1;
  break;
  case 13:obj.click();;break;
  case 27:this.closeWin();break;  
  }

  }

 
alternateWindow.prototype.closeWin=function(){

alternateFrame.style.visibility="hidden"; 
this.showAllSelect();
document.body.style.overflow="auto"; 
}
 
alternateWindow.prototype.hideAllSelect=function(){
  var obj;
  obj=document.getElementsByTagName("SELECT");
  var i;
  for(i=0;i<obj.length;i++)
obj[i].style.visibility="hidden";
  }
  
  alternateWindow.prototype.showAllSelect=function(){
  var obj;
  obj=document.getElementsByTagName("SELECT");
  var i;
  for(i=0;i<obj.length;i++)
obj[i].style.visibility="visible";

}