document.write('<div id="divPageMask"></div><div id="divOpenWin" ><div id="divOpenmove"><div class="Closeimg"  id="CloseMyImgico"></div><div id="myTitle"></div></div><div id="myInfos"></div></div>');
document.write(
'<style>'+
'#divPageMask	{	  background-color:#000;left:0px;top:0px;  position:absolute; z-index:1023; width:0px; height:0px;}'+
'#divOpenWin	{    position:absolute; border:1px solid #555; background-color:#f2f2f2; z-index:1024; text-align:left; top:-1000px; display:none;}'+
'#divOpenWin	.Closeimg{ background:url(img/winclose.gif) 0px -21px no-repeat; float:right; height:21px; width:23px; cursor:pointer;}'+
'#divOpenWin	.Closered{ background:url(img/winclose.gif) 0px 0px no-repeat; float:right; height:21px; width:23px; cursor:pointer;}'+
'#divOpenWin #divOpenmove	 { clear:both; height:25px; cursor:move; background-color:#e5f3dc; border-bottom:1px solid #acd98c;}'+
'#divOpenWin #divOpenmove #myTitle{color:#360; font-weight:bold; font-size:12px; padding-top:5px; margin-left:10px;}'+
'#divOpenWin #myInfos{ height:inherit; background-color:#fff; overflow:auto;}'+
'#divOpenWin #myInfos .newTitle { height:auto; padding:5px;color:#555; background-color:#f2f2f2; border-bottom:1px solid #ccc;}'+
'</style>');

var $$ = function (id) {return "string" == typeof id ? document.getElementById(id) : id;}
var flag=false;
 //全局定义
var   divPageMask	//跳出框的黑边     
var   divOpenWin;   // 主窗体
var   objCarMove    //标题移动部位(文字标题+关闭按钮合并一起)
var   objmyTitle    //标题显示部门
var   objmyImgClose //关闭按钮位置
var   objmyInfoin	//内容层
var   isIE 		    =	document.all ? true : false;




function divShow(sW,sH,sTitle,sURL,sContent,sNum){ //主函数。传递的参数任意修改
	//sTitle:标题的名称,       sURL//导入的网页地址iframe用的,         sNum//多种情况1-是iframe; 2-为空白页
	
	var w=sW;//自定义宽度跟高度
	var h=sH;

	var pURL=sURL;
	if(pURL=="") pURL="about:blank";

	divOpenWin.style.display		= "block";
	divOpenWin.style.width			= w +"px";
	divOpenWin.style.height			= h + "px";
	divPageMask.style.width			= w + 20 + "px";
	divPageMask.style.height		= h + 20 + "px";
	objmyInfoin.style.height		= h - 30 + "px";
	objmyTitle.innerHTML=sTitle;
	objmyImgClose.onclick	  = function(){divClose();}
	objmyImgClose.onmouseover = function(){this.className="Closered";}
	objmyImgClose.onmouseout  = function(){this.className="Closeimg";}
	 with(divPageMask){
     	style.display	  = "block";
		if(isIE){
			style.filter  = "Alpha(opacity=30);";
		}else{
			style.opacity = "0.30";
		}
	 }
     resizeMask(w,h);
     window.onResize = resizeMask(w,h);
	 BigMove(objCarMove,divOpenWin,divPageMask);
	 var newImgfo="";//清空内存
	 
	 
	 if(sNum==1){//这2个变量判断是否使用iframe
	 var newImgfo="<iframe id=\"myFrm_main\" name=\"myFrm_main\" scrolling=\"auto\" width=\"100%\" height=\"100%\" src=\""+ pURL +"\" frameborder=\"0\"></iframe>"; 
	 }
	 
	 if(sNum==2){
	 var newImgfo='<div style="margin:10px;">' + sContent + '</div>';
	 }
	 
	 	 if(sNum==10){//这2个变量判断是否使用iframe
	 var newImgfo="<iframe id=\"myFrm_main\" name=\"myFrm_main\" scrolling=\"auto\" width=\"100%\" height=\"100%\" src=\""+ pURL +"\" frameborder=\"0\"></iframe>";
	 objmyInfoin.style.overflow="hidden";
	 objmyInfoin.style.height=h;
	 divOpenWin.style.overflow="hidden";
	 
	 
	 
	 
	 
	 
	 
	 
	 }
	 
	 
	 objmyInfoin.innerHTML=newImgfo;	 
	 
}


	 
	 function Open_shiw(){
		 //h=270+150;
		 objmyInfoin.style.overflow="hidden";
	 	 divOpenWin.style.overflow="hidden";
		 var info_newTime_start;
		 clearInterval(info_newTime_start);
		 info_newTime_start=setInterval(di_demo,10)
		 var this_hei=270;
		 
		 function di_demo(){
		 this_hei+=10;
		if(this_hei>=150+270){
		clearInterval(info_newTime_start);
		this_hei=270+150;
		window.frames["myFrm_main"].document.getElementById("u_info_s").style.display="block";
		}
		 divOpenWin.style.height		= this_hei + "px";
		 divPageMask.style.height		= this_hei + 20 + "px";
		 objmyInfoin.style.height		= this_hei + "px";	 
		 }


		 }
	 function Close_shiw(){
		// h=270;
		 window.frames["myFrm_main"].document.getElementById("u_info_s").style.display="none";
		 objmyInfoin.style.overflow="hidden";
	 	 divOpenWin.style.overflow="hidden";
		 var info_newTime_start;
		 clearInterval(info_newTime_start);
		 info_newTime_start=setInterval(di_demo,10)
		 var this_hei=270+150;
		 
		 function di_demo(){
		 this_hei-=10;
		if(this_hei<=270){
		clearInterval(info_newTime_start);
		this_hei=270;

		}
		 divOpenWin.style.height		= this_hei + "px";
		 divPageMask.style.height		= this_hei + 20 + "px";
		 objmyInfoin.style.height		= this_hei + "px";	 
		 }
		 
		 
		 }
	 


function divClose(){ //关闭窗口函数
     divPageMask.style.width 			= "0px";
     divPageMask.style.height			= "0px";
	 objmyInfoin.style.height			= "0px";
	 divOpenWin.style.display			= "none";
     divOpenWin.style.top 				= parseInt(500)*-1 + "px";
     window.onResize = null;//清理内存
	 objmyTitle.innerHTML="";//清理内存
	 objmyInfoin.innerHTML="";//清理内存
}

function resizeMask(frmResizemakew,frmResizemakeh){//定位框的位置
var arrayPageSize = getPageSize();
var arrayPageScroll = getPageScroll();

divOpenWin.style.left =(((arrayPageSize[0] - 20 - frmResizemakew) / 2) + "px");
divOpenWin.style.top =(arrayPageScroll[1] + ((arrayPageSize[3] - 10 - frmResizemakeh) / 2) + "px");
divPageMask.style.left=parseInt(divOpenWin.style.left) - 9 + "px";
divPageMask.style.top=parseInt(divOpenWin.style.top) - 9 + "px";
}


	
function BigMove(o,s,m){ //移动窗口这个函数不好。foxfire 反对这个函数。你可以自己重新写个函数。监听的方式。对CPU有好处。哈哈
	o.onmousedown = function(a){
		var d=document;
		//if(!a)a=window.event;
		var a = a ? a : event;
		var x_ = a.clientX;
		var y_ = a.clientY;
		
        s.style.left = s.offsetLeft + "px";
		s.style.top = s.offsetTop  + "px";
		 m.style.left = m.offsetLeft + "px";
		m.style.top = m.offsetTop  + "px";

		d.ondragstart = "return false;"
		d.onselectstart = "return false;"
		d.onselect = "document.selection.empty();"
				
		if(o.setCapture){
			o.setCapture();
			//s.filters.alpha.opacity = 50;
		}else if(window.captureEvents){
			window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
			//s.style.opacity = 0.5;
		}
	

		d.onmousemove = function(a){
			var a = a ? a : event;
			var mrx = a.clientX - x_;
			var mry = a.clientY - y_;
			s.style.left = parseInt(s.style.left) + mrx + "px";
			s.style.top = parseInt(s.style.top) + mry + "px";
			
			m.style.left = parseInt(m.style.left) + mrx + "px";
			m.style.top = parseInt(m.style.top) + mry + "px";

			x_= a.clientX ;
			y_= a.clientY ;
		}

		d.onmouseup = function()
		{
			if(o.releaseCapture){
				o.releaseCapture();
				//s.filters.alpha.opacity =100;
			}else if(window.captureEvents){
				window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
				//s.style.opacity = 1;
			}
			d.onmousemove = null;
			d.onmouseup = null;
			d.ondragstart = null;
			d.onselectstart = null;
			d.onselect = null;
		}
	}
		
}


function getPageSize(){//得到整个浏览器的默认打开的长宽【浏览器不一定是打开全屏的，跟显示分别率也有关系的】
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ 
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { 
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	if (self.innerHeight) {
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { 
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) {
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}


function getPageScroll(){//得到浏览器工作区域的函数 基本上用这个函数来确认跳出框的位置

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}



function addLoadEvent(func) { // 这个是验证js文档及函数是否完整加载
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
     window.onload = func;
   } else {
     window.onload = function() {
      if (oldonload) {
         oldonload();
       }
       func();
     }
   }
}



addLoadEvent(winLod);//加载window.onload

function winLod(){//为了取得顺序 怕有些函数有先后顺序。不过这次的demo没用到函数，方便以后扩展函数
if(flag) return ;	
	flag			=	true;
	divPageMask		=   $$("divPageMask");
	divOpenWin		=   $$("divOpenWin");
	objCarMove		=   $$("divOpenmove");
	objmyTitle		=   $$("myTitle");
	objmyImgClose	=	$$("CloseMyImgico");
	objmyInfoin		=	$$("myInfos")

}





