var n=80;//alpha 初始值
var winshowed=false;//标识窗口是否已经打开
var winshowed0=false;
var msgshowed=false;
var sysshowed=false;

function GetvMnuCode(sty,nam,src,wid,hei){
	if (sty=="green"){//绿色界面
		substr1 = "<table border=1 bordercolor='#E3FFC8'  cellspacing=0><tr><td  background='pic/win_top.gif' height=26>&nbsp;</td></tr><tr><td><iframe id="+nam+" name="+nam+" style='border:0px solid;' src="+src+" width="+wid+" height="+hei+"></iframe></td></tr><tr><td  background='pic/win_bottom.gif' height=26>&nbsp;</td></tr></table>";}
	if (sty=="wood"){//木质界面
		substr1="<table border=4 bordercolor='#993300' bordercolordark='#CC6600'><tr><td><iframe id="+nam+" name="+nam+" style='border:0 px solid;' src="+src+" width="+wid+" height="+hei+" ></frame></td></tr></table>";}
	return substr1;
}


function ShowWin(w,h,s) {
	if (winshowed==true) {
	    q=confirm("窗口中有页面正在运行，要关闭原窗口吗？");
		if (q!=0)
		  CloseWin();
		else
		  return;}
    var window_top = (screen.height-h)/2-90;
	if (window_top <=0) window_top = 0;
    var window_left = (screen.width-w)/2-70;
	vMnuCode = GetvMnuCode("wood","win",s,w,h)
	
	winDiv.innerHTML = vMnuCode;
	winDiv.style.top = window_top;
	winDiv.style.left = window_left;
	winDiv.style.visibility = "visible";
	winshowed=true;
}

function CloseWin(){
	winDiv.style.visibility = "hidden";
	winDiv.innerHTML = "";
	winshowed=false;
}

//系统窗口的控制
function ShowSys(w,h,s) {
	if (sysshowed==true) { CloseSys();}
    var window_top = (screen.height-h)/2-90;
	if (window_top <=0) window_top = 0;
    var window_left = (screen.width-w)/2-70;
	vMnuCode=GetvMnuCode("wood","sys",s,w,h)
	sysDiv.innerHTML = vMnuCode;
	sysDiv.style.top = window_top;
	sysDiv.style.left = window_left;
	sysDiv.style.visibility = "visible";
	sysshowed=true;
}

function CloseSys(){
	sysDiv.style.visibility = "hidden";
	sysDiv.innerHTML = "";
	sysshowed=false;
}

function ShowWin0(w,h,s) {
	if (winshowed0==true) {
	    q=confirm("窗口中有页面正在运行，要关闭原窗口吗？");
		if (q!=0)
		  CloseWin0();
		else
		  return;}
	if (winshowed==true) {//如果上层窗口有内容也需要关闭
	    q=confirm("窗口中有页面正在运行，要关闭原窗口吗？");
		if (q!=0)
		  CloseWin();
		else
		  return;}
    var window_top = (screen.height-h)/2-90;
    var window_left = (screen.width-w)/2-70;
	vMnuCode=GetvMnuCode("wood","",s,w,h)
	winDiv0.innerHTML = vMnuCode;
	winDiv0.style.top = window_top;
	winDiv0.style.left = window_left;
	winDiv0.style.visibility = "visible";
	winshowed0=true;
}

function CloseWin0(){
	winDiv0.style.visibility = "hidden";
	winDiv0.innerHTML = "";
	winshowed0=false;
}

//当进入系统时，就加载了本窗口。而后只是显示和隐藏，而不能关闭，因为关闭那么上次的message就丢失了。因为它是用innerHtml来追加的，再载入就又成空的了。
function initMsg(w,h,s){
    var window_top = (screen.height-h)/2-90;
    var window_left = (screen.width-w)/2-70;
	vMnuCode=GetvMnuCode("wood","msg",s,w,h)
	msgDiv.innerHTML = vMnuCode;
	msgDiv.style.top = window_top;
	msgDiv.style.left = window_left;
	msgDiv.style.visibility = "hidden";
}
//按查看短信时的处理
function ChangeWin(){this.CloseWin();this.ShowMsg('');}

function ShowMsg() {//查看短信
	msgshowed=true;
	msgDiv.style.visibility = "visible";

}

function AddMsg(newmsgstr) {//追加短信
	if (newmsgstr.length>0){
      this.msg.msgshow.innerHTML += newmsgstr;
	}
}

function CloseMsg(){//关闭窗口
	msgDiv.style.visibility = "hidden";
	msgshowed=false;
}

function ClearMsg(){//清空所有message
  msg.msgshow.innerHTML = "<h4 align=center>您的短信为空！</h4>";
   input.msgnum=0;
}

function shortmsg(){
MM_openBrWindow('msgwrite.asp','我的短信','scrollbars=yes,width=350,height=220');
}

//打开新窗口
function MM_openBrWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}
