function openWin(url,w,h){
 var winX = screen.availWidth/2-w/2-10;
 var winY= screen.availHeight/2-h/2-12;
 newWin=window.open(url,"info","left="+winX+",top="+winY+",width="+w+",height="+h+",toolbar=no,status=no,scrollbars=no,resizable=no");
 newWin.focus();
}
function openWin1(url,w,h){
 var winX = screen.availWidth/2-w/2;
 var winY= screen.availHeight/2-h/2;
 winX = 10;
 winY = 10;
 newWin=window.open(url,"newwin","left="+winX+",top="+winY+",width="+w+",height="+h+",toolbar=no,status=no,scrollbars=yes,resizable=no");
 newWin.focus();
}
function openWindow(url,title,w,h){
 var winX = screen.availWidth/2-w/2;
 var winY= screen.availHeight/2-h/2;
 newWin=window.open(url,title,"left="+winX+",top="+winY+",width="+w+",height="+h+",toolbar=no,status=no,scrollbars=yes,resizable=no");
 newWin.focus();
}
function openWin2(url,title,w,h){
 var winX = screen.availWidth/2-w/2;
 var winY= screen.availHeight/2-h/2;
 newWin=window.open(url,title,"left="+winX+",top="+winY+",width="+w+",height="+h+",toolbar=no,status=no,scrollbars=no,resizable=no");
 newWin.focus();
}
function resizeWin(w,h){
  var x,y
  x = screen.availWidth;
  y = screen.availHeight;
  window.moveTo(0,0);
  window.resizeTo(x,y);
}
function resizeWin1(w,h){
  var x,y
  x = screen.availWidth/2 - w/2;
  y = screen.availHeight/2 - h/2;
  window.moveTo(x,y);
  window.resizeTo(w,h);
}
function attachEventOnload(func){
	if(document.attachEvent){
		window.attachEvent("onload", func);
	}else{
		window.addEventListener('load', func, false);
	}
}
var ishow = {
	$ : function(sid){return document.getElementById(sid);},
	/**
	 * @param {title:'',cTitle:'',content:'',contentid:'',src:'',width:'',height:''}
	 */
	init : (function(){
		attachEventOnload(function(){
			var _objs = document.getElementsByTagName('Div');
			for(var i = 0, len = _objs.length; i < len; i++){
				var _obj = _objs[i];
				var _class = _obj.getAttribute(document.all ? "className" : "class");
				if(/\bishow\b/.test(_class)){
					_obj.style.display="none";
				}
			};
		});
	})(),
	show : function(ioption) {
	/*	ioption:{
			title:'';	//层标题
			msgTitle:'';	//内容标题
			msg:'';	//内容
			src:'';		//iframe地址，使用它时，设置msgTitle和msg将无效
			contentid:''; //存放内容的Div的ID,使用它时，msg无效
			width:'';	//宽
			height:'';	//高
		}*/
		ioption.title = ioption.title || "Web2.0";
		ishow.setSelectObj("none");	//将所有下拉框隐藏
		
		var sWidth = ioption.width || "400";
		var sHeight = ioption.height || "200";
		var bordercolor = "#84A0C4"; // 窗口的边框颜色 
		var titlecolor = "#FFFFFF"; // 标题文字颜色 
		var titlebgcolor = "#15428b"; // 标题背景色
		var bgcolor = "#DFE8F6"; // 内容的背景色
	
		var iWidth = document.body.clientWidth; 
		var iHeight = document.body.clientHeight; 
		
		//遮照层
		var bgObj;
		if(ishow.$('bgDiv')){//查询对象是否存在
			bgObj = ishow.$('bgDiv');
			bgObj.innerHTML="";	//清空原有数据
			bgObj.style.display="";
		}else{
			bgObj = document.createElement("div");
			bgObj.id="bgDiv";
			bgObj.style.cssText = "position:absolute;left:0px;top:0px;width:"+iWidth+"px;height:"+Math.max(document.body.clientHeight, iHeight)+"px;filter:Alpha(Opacity=15);opacity:0.3;background-color:#000000;z-index:100;";
			document.body.appendChild(bgObj); 
		}
		//显示提示层
		var msgObj;
		if(ishow.$('msgDiv')){//查询对象是否存在
			msgObj = ishow.$('msgDiv');
			msgObj.innerHTML="";	//清空原有数据
			msgObj.style.display="";
		}else{
			msgObj = document.createElement("div");
			msgObj.id="msgDiv";
			msgObj.style.cssText = "position:absolute;top:"+(iHeight-sHeight)/5+"px;left:"+(iWidth-sWidth)/2+"px;width:"+sWidth+"px;height:"+sHeight+"px;border:1px solid "+bordercolor+";z-index:102;";
			document.body.appendChild(msgObj);
		}
	
		var table = document.createElement("table");
		msgObj.appendChild(table);
		table.style.cssText = "border:0px;width:100%;height:100%;background-color:"+bgcolor;
		table.cellSpacing = 0;
		table.cellPadding = 1;
	
		var tr = table.insertRow(-1);
		var titleBar = tr.insertCell(-1);
		titleBar.style.cssText = "width:100%;padding-left:5px;text-align:left;height:20px;margin:0px;font-size:12px;color:"+titlecolor+";background-color:"+ titlebgcolor;
		titleBar.innerHTML = "<div id='win-tl'><span style='float:left;'>" + ioption.title + "</span><span style='float:right;cursor:pointer;' onclick='ishow.closeDiv();'>\u5173\u95ed</span></div>";
	
		var trMsg = table.insertRow(-1);
		var tdMsg = trMsg.insertCell(-1);
		
		if(ioption.src){
			tdMsg.innerHTML = "<iframe id=\"ifr\" name=\"ifr\" width=\"100%\" height=\""+(parseInt(sHeight)-10)+"\" src=\""+ioption.src+"\"></iframe>";
		}else{
			if(ioption.msgTitle){
				tdMsg.style.cssText = "font-size:12px;color:red;";
				tdMsg.innerHTML = "<div style='white-space:normal;border-bottom:1px solid #000; width:" + (sWidth-10) + "px;word-break:break-all;'>" + ioption.msgTitle + "</div>";
			}
			var trBar = table.insertRow(-1);
			var tdBar = trBar.insertCell(-1);
			if(ioption.contentid){
				var _content = ishow.$(ioption.contentid);
				ioption.msg = _content.innerHTML;
			}
			tdBar.innerHTML="<div style='white-space:normal; width:" + (sWidth-10) + "px;height:+"+(sHeight-20)+"px;word-break:break-all;overflow-x:hidden;overflow-y:auto'>" + ioption.msg + "</div>";
		}
	},
	setSelectObj : function(sflag){
		var selectItem=document.getElementsByTagName("select");  // 捕捉所有select标签
		for(var j=0;j<selectItem.length;j++){selectItem[j].style.display=sflag;} // 设为显示或隐藏
	},
	closeDiv : function(){
		ishow.setSelectObj("");
		ishow.$("bgDiv").style.display="none";
		ishow.$("msgDiv").style.display="none";
	}
}