/*
  消息弹出窗方法     
  
  参数说明：
  width   窗口宽度
  height  窗口高度
  title   窗口标题
  contentArray 消息内容数组
  linkArray  链接地址
  outTime  延时关闭时间（单位：豪秒）

  
  调用的例子：
  popMessage(214,140,'消息提醒',contentArray,linkArray,10000)

*/


var oPopup = window.createPopup();
var popTop=0;
var mytime;
var closeTime;
var flag=0;
function innerHTML(width,height,title,contentArray,linkArray)
{

 var TempArray = ""; 
 var i=0;
 var number=0;
 var zindex=9999;
 var html="";
 var width2=width-6;
 var height2=height-24;
 var PopupWinId="PopupWin";
 var PopupWinHeaderId="PopupWin_Header";
 var PopupWinTitleId="PopupWin_Title";
 var PopupWinContentId="PopupWin_Content";
 var PopupWinMessageId="PopupWin_Message";
 html=html+"<div id=\"service\" style=\"behavior:url(webservice.htc)\"></div>";
 html=html+"<div id=\""+PopupWinId+"\" style=\"background:#E0E9F8; border-right:1px solid #455690; border-bottom:1px solid #455690;border-left:1px solid #B9C9EF; border-top:1px solid #B9C9EF; position:absolute; z-index:"+zindex+";  width:"+width+"px; height:"+height+"px; left:0px; right:0px;\" onselectstart=\"return false;\" >\r\n"+
    "<div id=\""+PopupWinHeaderId+"\" style=\"cursor:default;position:absolute; left:2px; width:"+width2+"px; top:2px;height:14px;filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr='#FFE0E9F8', EndColorStr='#FFFFFFFF');font:12px arial,sans-serif; color:#1F336B; text-decoration:none;\">\r\n"+
     "<span id=\""+PopupWinTitleId+"\">"+title+"</span>\r\n"+
     "<span style=\"position:absolute; right:0px; top:0px; cursor:pointer; color:#728EB8; font:bold 12px arial,sans-serif;position:absolute;\" onclick=\"parent.ClosePopupWin()\" onmousedown=\"event.cancelBubble=true;\" onmouseover=\"style.color='#455690';\" onmouseout=\"style.color='#728EB8';\">X</span>\r\n"+
    "</div>\r\n"+
    "<div id=\""+PopupWinContentId+"\" onmousedown=\"event.cancelBubble=true;\" style=\"border-left:1px solid #728EB8; border-top:1px solid #728EB8;border-bottom:1px solid #B9C9EF; border-right:1px solid #B9C9EF;background:#E0E9F8;padding:5px;pacing=4px; overflow:hidden; text-align:left; filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr='#FFE0E9F8', EndColorStr='#FFFFFFFF');position:absolute;OVERFLOW: auto; left:2px; width:"+width2+"px; top:20px; height:"+height2+"px;\">\r\n";
 for(i=0;i<contentArray.length;i++)
 {
  var tbName = contentArray[i].split("|");  
  number=number+1;
  html=html+"<span  style=\"cursor:hand; font:12px arial,sans-serif; color:#1F336B; text-decoration:none;\" id=\""+PopupWinMessageId+"\" onclick=\"parent.OpenWin('"+linkArray[i]+"','"+i+"')\">"+number+"."+tbName[0]+"</span><br>";
  
 }
 html=html+"</div>\r\n";
 html=html+"</div>\r\n";
 oPopup.document.body.innerHTML =html;
}

function popMessage(width,height,title,contentArray,linkArray,timeOut)
{
 flag=0;
 innerHTML(width,height,title,contentArray,linkArray);
 popupWin(width,height);
 window.setTimeout("CloseWin("+width+","+height+")",timeOut);
}

function ClosePopupWin()
{
 oPopup.show(0,0,0,0);
 flag=1;
 popTop=0;
 window.clearInterval(mytime);
 window.clearInterval(closeTime);
}

function CloseWin(width,height)
{
 if(flag==0)
 {
  window.clearInterval(mytime);
  if( height>0 && null!=oPopup)
  {
   oPopup.show(screen.width-width,screen.height-height-30, width, height);
  }
  else
  {
   window.clearInterval(closeTime);
   if(null!=oPopup)
   {
    oPopup.show(0,0,0,0);
    flag=1;
    popTop=0;
   }
   return;
  }
  height=height-0.8;
  closeTime=window.setTimeout("CloseWin("+width+","+height+");",5);
 }
}

function popupWin(width,height)
{

 if( popTop<=height)
 {
  oPopup.show(screen.width-width,screen.height-popTop, width, popTop);
 }
 
 else if(popTop<=height+30)
 {
  oPopup.show(screen.width-width,screen.height-popTop, width, height);
 }
 else
 {
  oPopup.show(screen.width-width,screen.height-height-30, width, height);
 }
 popTop=popTop+0.8;
 mytime=setTimeout("popupWin("+width+","+height+");",5);
}

 

 

 
 /*
 
 html=html+"<style type=\"text/css\"> "+
 html=html+"<!-- "+
 html=html+"body "+;
 html=html+"{ "+;
 html=html+"background-color:#FFFFFF; "+ 
 html=html+"scrollbar-face-color: #DEE3E7; "+
 html=html+"scrollbar-highlight-color: #FFFFFF; "+
 html=html+"scrollbar-shadow-color: #DEE3E7; "+
 html=html+"scrollbar-3dlight-color: #D1D7DC; "+
 html=html+"scrollbar-arrow-color:  #006699; "+
 html=html+"scrollbar-track-color: #EFEFEF; "+
 html=html+"scrollbar-darkshadow-color: #98AAB1; "+
 html=html+"} ";
 html=html+"--> ";
 html=html+"</style> "+
 
 */
 
 //html="<LINK href=\"../css/nandasoft.css\" type=\"text/css\" rel=\"stylesheet\">";

function OpenWin(strUrl,winName)
{
 var intHeight =520;// 380;
 var intWidth = 800;//600;
 var mytop=(screen.height- intHeight)/2;
 var myleft=(screen.width- intWidth)/2;
 var strType='resizable=no,scrollbars=yes,width=' + intWidth + ',height=' + intHeight + ',left=' + myleft + ',top=' + mytop;
 var win=window.open(strUrl,winName,strType);
 win.focus();
}



