
<!--
//可以打包为js文件;
var x0=0,y0=0,x1=0,y1=0;
var offx=6,offy=6;
var moveable=false;
var hover='#ffce54',normal='#ffce54';//color;
var index=10000;//z-index;
//开始拖动;
function startDrag(obj)
{
//锁定标题栏;
obj.setCapture();
//定义对象;
var win = obj.parentNode;
var sha = win.nextSibling;

//记录鼠标和层位置;
x0 = event.clientX;
y0 = event.clientY;
x1 = parseInt(win.style.left);
y1 = parseInt(win.style.top);
//记录颜色;
normal = obj.style.backgroundColor;
//改变风格;
obj.style.backgroundColor = hover;
win.style.borderColor = hover;
//obj.nextSibling.style.color = hover;
sha.style.left = x1 + offx;
sha.style.top = y1 + offy;
moveable = true;
}
//拖动;
function drag(obj)
{
var win = obj.parentNode;
var sha = win.nextSibling;

//alert(tit.style.cursor);


if(moveable)
{
 d_left = parseInt(x1 + event.clientX - x0);
 d_top = parseInt(y1 + event.clientY - y0);
 
 w_width = parseInt(win.style.width) + offx;
 w_height = parseInt(win.style.height) + offy;
 

 //alert(w_height);
 
 
 if(d_top<0){d_top=0;}//顶边
 
 if(w_width>250){
	if(d_left<50-w_width){d_left=50-w_width;}//左边
	if(d_left>document.documentElement.clientWidth-50){d_left=document.documentElement.clientWidth-50;}//右边
 }else{
	 if(d_left<0){d_left=0;}//左边
	 if(d_left>document.documentElement.clientWidth-w_width+6){d_left=document.documentElement.clientWidth-w_width+6;}//右边
	 if(d_top>document.documentElement.clientHeight-w_height){d_top=document.documentElement.clientHeight-w_height;}//底
 }
 
 win.style.left = d_left;
 win.style.top = d_top;
 
 sha.style.left = parseInt(win.style.left) + offx;
 sha.style.top = parseInt(win.style.top) + offy;
}
}
//停止拖动;
function stopDrag(obj)
{
var win = obj.parentNode;
var sha = win.nextSibling;
win.style.borderColor = normal;
obj.style.backgroundColor = normal;
//obj.nextSibling.style.color = normal;
sha.style.left = obj.parentNode.style.left;
sha.style.top = obj.parentNode.style.top;
//放开标题栏;
obj.releaseCapture();
moveable = false;
//alert(document.body.clientWidth-w_width);
//alert(document.body.clientWidth);
}
//获得焦点;
function getFocus(obj)
{
//index = index + 2;
var idx = index;
obj.style.zIndex=idx;
obj.nextSibling.style.zIndex=idx-1;
}
function min(obj)
{
var win = obj.parentNode.parentNode.parentNode;
var sha = win.nextSibling;
var tit = obj.parentNode.parentNode;
var msg = tit.nextSibling;
var flg = msg.style.display=="none";

//alert(msg.style.height);

	if(flg)
	{
	 win.style.height = parseInt(msg.style.height) + parseInt(tit.style.height) + 2*2-2;
	 sha.style.height = win.style.height;
	 msg.style.display = "block";
	 obj.innerHTML = "0";
	}
	else
	{
	 win.style.height = parseInt(tit.style.height) + 2*2 -2;
	 sha.style.height = win.style.height;
	 obj.innerHTML = "2";
	 msg.style.display = "none";
	}
}
function cls(obj)
{

var win  = document.getElementById('div_'+obj);


	try{
		
		win.outerHTML='';
		var bg  = document.getElementById('xMsg_bg_'+obj);
		var bg_f  = document.getElementById('xMsg_bg_f_'+obj);
		//bg.style.visibility = "hidden";
		//bg_f.style.visibility = "hidden";
		bg.outerHTML='';
		bg_f.outerHTML='';
	}catch(e){};
	
	var foot_obj=document.getElementById('xwin_foot_div');
	if(foot_obj!=null){
		foot_obj.innerHTML='';
	}
	
}
//创建一个对象;
function xWin(id,w,h,l,t,tit,msg,type)
{
	
//alert(id);

index = index+4;

this.id   = id;
this.type   = type;
this.width  = w;
this.height = h;
this.left  = l;
this.top   = t;
this.zIndex = index;
this.title  = tit;
this.message = msg;
this.obj   = null;
this.bulid  = bulid;
this.bulid();

}
//初始化;
function bulid()
{

var str ="";
	
//alert(this.zIndex);
//alert(this.width);
str += ""
 + "<div id=div_" + (this.id) + " "
 + "style='"
 + "z-index:" + this.zIndex + ";"
 + "width:" + (this.width-2)+ "px;"
 //+ "height:" + this.height + "px;"
 + "left:" + this.left + "px;"
 + "top:" + this.top + "px;"
 + "background-color:" + normal + ";"

 + "font-size:12px;"
 + "font-family:Verdana;"
 + "position:absolute;"
 + "cursor:default;"
 + "border:1px solid " + normal + ";"
 + "' ";
 if(this.type==4){
 	str +=" onclick='cls(\"" + (this.id) + "\")' ";
 }
str += "onmousedown='getFocus(this)'>"
  + "<div "
  + "style='background-image:url(../img/es.jpg);"
  + "background-color:" + normal + ";"
  + "width:" + (this.width-2) + "px;"
  + "height:28px;"
  + "color:white;"
  + "' "
/*  + "onmousedown='startDrag(this)' "
  + "onmouseup='stopDrag(this)' "
  + "onmousemove='drag(this)' "*/
  + "><ul style='CLEAR: left; MARGIN: 0px; PADDING:0px; BORDER: 0px; LIST-STYLE-TYPE: none; TEXT-ALIGN: center; DISPLAY:inline;'>";
if (this.type==3 || this.type==4){
  str+="<li style='FLOAT:left;width:"+(this.width-20-50)+"px;padding-left:5px; padding-top:0px; color:#333333;text-align:left; font-weight:bold;cursor:move;line-height:24px;overflow:hidden;'>" + this.title + "</li>";
}else{
	
  str+="<li style='FLOAT:left;width:"+(this.width-30-50)+"px;padding-left:5px; padding-top:0px;text-align:left; color:#333333; font-weight:bold;line-height:24px;overflow:hidden;'>" + this.title + "</li>";	
}
  
if(this.type!=3 && this.type!=5){
 if(this.type!=4){
  //str+="<li style='FLOAT:left;width:12px;border-width:0px;color:white;font-family:webdings;line-height:24px;' onclick='min(this)'>0</li>";
 }
  str+= "<li style='cursor:pointer;FLOAT:right;width:62px;border-width:0px;color:black;line-height:24px;' onclick='cls(\"" + (this.id) + "\")'><b>[关闭]</b></li>";
}
  str+="</ul></div>"
  + "<div style='"
  + "width:100%;"
 // + "height:" + (this.height-20-4) + "px;"
  + "background-color:white;"
  + "line-height:14px;"
  + "word-break:break-all;"
  + "padding-top:4px;"
  + "padding-bottom:2px;"
  + "'>" + this.message + "</div>"
 + "</div>";/*
 + "<div id=div_b_" + (this.id) + " style='"
 + "width:" + (this.width+5) + "px;"
 + "height:" + (this.height+11) + "px;"
 + "top:" + this.top + "px;"
 + "left:" + this.left + "px;"
 + "z-index:" + (this.zIndex-1) + ";"
 + "position:absolute;"
 + "background-color:black;"
 + "filter:alpha(opacity=40);"
 + "'>?</div>"*/
 
 if (this.type==1 || this.type==4 ||this.type==5){
	 
	 var div_h=document.documentElement.clientHeight;
	 if (document.documentElement.scrollHeight>div_h){div_h=document.documentElement.scrollHeight;}
	 div_h=div_h;
	 
	 //alert(div_h);
	 if(this.type!=4){
		 str+="<iframe  onclick='cls(\"" + (this.id) + "\")' id='xMsg_bg_f_" + (this.id) + "' style='border:0px;width:100%;background:#FFF;position:absolute;left:0px;right:0px;top:0px;bottom:0px;opacity:0;-moz-opacity:0;filter:alpha(opacity=0);height:"+ div_h +"px;z-index:"+(this.zIndex-3)+";'></iframe>";
	 }
	if(this.type==5)
	{
		str+="<div id='xMsg_bg_" + (this.id) + "' style='width:100%;background:#fff;position:absolute;left:0;right:0;top:0;bottom:0;opacity:0.7;-moz-opacity:0.7;filter:alpha(opacity=70);z-index:"+(this.zIndex-2)+";height:"+ div_h +"px;' oncontextmenu='return false;' ><div>"
		}
	else
	{
		str+="<div onclick='cls(\"" + (this.id) + "\")' id='xMsg_bg_" + (this.id) + "' style='width:100%;background:#fff;position:absolute;left:0;right:0;top:0;bottom:0;opacity:0.7;-moz-opacity:0.7;filter:alpha(opacity=70);z-index:"+(this.zIndex-2)+";height:"+ div_h +"px;' oncontextmenu='return false;' ><div>"
		
	}
}

//添加时间2009-8-12
//修改者:yun
//显示黑屏 无拖动 
/*if(this.type==5)
{
	var div_h=document.documentElement.clientHeight;
	 if (document.documentElement.scrollHeight>div_h){div_h=document.documentElement.scrollHeight;}
	 div_h=div_h;
	  if(this.type==5){
		  alert("ok");
		 str+="<iframe  onclick='cls(\"" + (this.id) + "\")' id='xMsg_bg_f_" + (this.id) + "' style='border:0px;width:100%;background:#FFF;position:absolute;left:0px;right:0px;top:0px;bottom:0px;opacity:0;-moz-opacity:0;filter:alpha(opacity=0);height:"+ div_h +"px;z-index:"+(this.zIndex-3)+";'></iframe>";
	 }
	 str+="<div  id='xMsg_bg_" + (this.id) + "' style='width:100%;background:#fff;position:absolute;left:0;right:0;top:0;bottom:0;opacity:0.7;-moz-opacity:0.7;filter:alpha(opacity=70);z-index:"+(this.zIndex-2)+";height:"+ div_h +"px;'><div>"
	}*/

// alert(this.id);
// alert(str);


foot_obj=document.getElementById('xwin_foot_div');

if(foot_obj!=null && window.navigator.userAgent.toLowerCase().indexOf("msie")>=1){
	
	var oNewNode = document.createElement("DIV");
	foot_obj.insertBefore(oNewNode);
	oNewNode.innerHTML=str;
}else{
	//alert('Y'+foot_obj);
	//document.body.insertBefore(foot_obj,str);
	document.body.insertAdjacentHTML("beforeEnd",str);
}


/**/

 if (this.type==1){
	 try{
	 eval("div_" + (this.id) + ".focus();");
	 }catch(e){};
 }

}
//-->


/*
	var bg_index=index+1;
	 var div = document.createElement(");
	 var iframe = document.createElement(");
	// var style = document.createElement("<iframe class='dis' style='z-index:98;'>");
	
	// document.body.insertAdjacentHTML("beforeEnd",style);
	 document.getElementsByTagName("body")[0].appendChild(iframe);
	 document.getElementsByTagName("body")[0].appendChild(div);
*/


//新建窗体
function show_divwin(title,url,width,height,type,left,top)
{
	//alert(top+''+left);
	//alert(index);

	
	//1=先关闭.2无拖动,3无关闭
	if(isFileLoad==false){return false};
	
	if(type==false){//必须关闭后方可再操作
		type=0;
	}
	var w_width=width;
	var w_height=height+40;
	var w_left=(document.documentElement.clientWidth-w_width)/2;
	var w_top =(document.documentElement.clientHeight-w_height)/2+document.documentElement.scrollTop;
	
	if(w_top<=0){w_top=0}
	if(w_left<=0){w_left=0}
	
	if(left){
		w_left=left;
	}
	if(top){
		w_top=top;
	}

	
	//alert(w_top);
	var win1_str='<table width="'+width+'" height="'+height+'" border="0" align="center" cellspacing="0">  <tr>    <td align="center">      <iframe src="'+url+'" id="sub_win_'+index+'"  name="sub_win_'+index+'" width="'+(width-8)+'" height='+height+' frameborder="0" scrolling="auto"></iframe>	  </td></tr></table>';

	var win_a = new xWin("sub_win_"+index,w_width,w_height,w_left,w_top,title,win1_str,type);

}
//新建窗体
function show_divbox(title,content,width,height,type,left,top)
{
	//alert(top+''+left);
	//
	if(isFileLoad==false){ return false};
	
	/*
	1=有黑屏
	2无拖动,
	3无关闭,
	4有黑屏（点击黑屏可关闭）无最小化,有关闭
	5 有黑屏 无拖动 无关闭
	*/
	
	
	if(type==false){//必须关闭后方可再操作
		type=0;
	}
	var w_width=width;
	var w_height=height+40;
	var w_left=(document.documentElement.clientWidth-w_width)/2;
	var w_top =(document.documentElement.clientHeight-w_height)/2+document.documentElement.scrollTop;
	
	if(w_top<=0){w_top=0}
	if(w_left<=0){w_left=0}
	
	if(left){
		w_left=left;
	}
	if(top){
		w_top=top;
	}

	
	//alert(w_top);
	var win1_str=content;
	var win_a = new xWin("sub_win_"+index,w_width,w_height,w_left,w_top,title,win1_str,type);

}



