/**
*windId 窗口ID
*width,窗口宽度
*height 窗口高度
*winTitle 窗口标题
*winUrl 窗口链接
*关闭窗口时需要执行的命令,不执行 为空
**/

var zIndex = 5000;
function createEPOPOSWindow(winId,width,height,winUrl)
{
	var myWindow = document.getElementById(winId);
	if(myWindow!=null)
		return;
	var loadDiv = document.getElementById("loadDiv")
	
    var cw  =document.documentElement.clientWidth||document.body.clientWidth;
    var ch = document.documentElement.clientHeight||document.body.clientHeight;
	var st =document.documentElement.scrollTop||document.body.scrollTop;
	loadDiv.style.top=0;
	loadDiv.style.zIndex = zIndex++;
	loadDiv.style.height = document.documentElement.scrollHeight+"px";
	loadDiv.style.display = "block";
	this.startX = (cw-width)/2;
	if(startX<0)
		startX=0;
	this.startY= (ch-height)/2;
	if(startY<=0)
		startY=0;
	var newWindow=document.createElement("div");
	newWindow.style.position ="absolute";
	newWindow.id = winId;	
	newWindow.style.zIndex = zIndex++;
	newWindow.onmouseover=function()
	{
		//drag(winId,1)	
	}
	
	 document.body.appendChild(newWindow);
	

	 newWindow.style.left = startX+"px";
	 newWindow.style.top = (startY+st)+"px";
	 newWindow.style.height = height+100;
	 newWindow.style.width = width;

	var htmlStr='<iframe src="'+winUrl+'" id="PF'+winId+'" name="PF'+winId+'" width="'+width+'" height="'+height+'" frameborder="0" scrolling="no" allowTransparency="true"></iframe>';

	newWindow.innerHTML = htmlStr;
	//if(IE)
		//enablePngImages();
}
/**
*windId 窗口ID
*width,窗口宽度
*height 窗口高度
*winTitle 窗口标题
*winUrl 窗口链接
*关闭窗口时需要执行的命令,不执行 为空
**/
function createWindow(winId,width,height,winTitle,winUrl,command,scrollIf)
{
	var cw = document.documentElement.clientWidth;
	var ch = document.documentElement.clientHeight;
	var loadDiv = document.getElementById("loadDiv");
	var st =document.documentElement.scrollTop||document.body.scrollTop;
	loadDiv.style.top=0;
	loadDiv.style.zIndex = zIndex++;
	loadDiv.style.height = document.documentElement.scrollHeight+"px";
	loadDiv.style.display = "block";
	
	this.startX = (cw-width)/2;
	if(startX<0)
		startX=0;
	this.startY= (ch-height)/2;
	if(startY<=0)
		startY=0;
	var newWindow=document.createElement("div");
	newWindow.className="popWindow";
	newWindow.id = winId;	
	newWindow.style.zIndex = zIndex++;
	newWindow.onmouseover=function()
	{
		drag(winId,1)	
	}

	 document.body.appendChild(newWindow);

	 newWindow.style.left = startX+"px";
	
	 newWindow.style.top = (startY+st)+"px";
	 newWindow.style.height = height+100;
	 newWindow.style.width = width;

	var htmlStr = '<table height="'+height+'" width="'+width+'" border="0" cellspacing="0" cellpadding="0">'+
 ' <tr>'+
    '<td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">'+
     ' <tr>'+
        '<td width="10"><img src="/assets/new/images/window/popWin_03.png" width="10" height="30" /></td>'+
        '<td background="/assets/new/images/window/popWin_04.png" style="color:#1b3642">'+winTitle+'</td>'+
        '<td width="44"><div align="right"><img src="/assets/new/images/window/popWin_06.png" width="44" height="30" style="cursor:pointer" onclick="eval(\''+command+'\');closeWindow(\''+winId+'\')" title="关闭"/></div></td>'+
      '</tr>'+
    '</table></td>'+
  '</tr>'+
  '<tr>'+
    '<td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">'+
      '<tr>'+
        '<td width="6" background="/assets/new/images/window/popWin_08.png"><img src="/assets/new/images/window/popWin_08.png"></td>'
	if(scrollIf==1)
	{
		htmlStr+='<td><iframe src="'+winUrl+'" id="PF'+winId+'" name="PF'+winId+'" width="'+width+'" height="'+height+'" frameborder="0" scrolling="auto"></iframe></td>';
	}
	else
	{
		htmlStr+='<td><iframe src="'+winUrl+'" id="PF'+winId+'" name="PF'+winId+'" width="'+width+'" height="'+height+'" frameborder="0" scrolling="no"></iframe></td>';
	}
        
        htmlStr+='<td width="6" background="/assets/new/images/window/popWin_11.png"><img src="/assets/new/images/window/popWin_11.png"></td>'+
      '</tr>'+
   ' </table></td>'+
  '</tr>'+
  '<tr>'+
    '<td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">'+
      '<tr>'+
       ' <td height="6" width="6"><img src="/assets/new/images/window/popWin_10.png" width="6" height="6" /></td>'+
        '<td background="/assets/new/images/window/popWin_17.png" height="6" width="100%"></td>'+
        '<td height="6" width="6"><img src="/assets/new/images/window/popWin_18.png" width="6" height="6" /></td>'+
     ' </tr>'+
   ' </table></td>'+
  '</tr>'+
'</table>';
	newWindow.innerHTML = htmlStr;
}


//关闭窗口
function closeWindow(winId)
{
	var myWindow = document.getElementById(winId);
	myWindow.style.display = "none";
	var popFrame = document.getElementById("PF"+winId);
	popFrame.src = "";
	var loadDiv = document.getElementById("loadDiv");
	loadDiv.style.display = "none";
	document.body.removeChild(myWindow);
}
