﻿var TopWindow = {
    FrameHTMLCode :"",
    AlertMessage :"",
    AlertMessageColor :"#FF0000",
    AlertMessageWeight :"BOLD",
    AlertMessageHref : "",
    AlertMeesageIsA : false,
    MessageUrl : "",
    AlertMessageSize : 14,
    WindowTitle : "系统提示",
    WindowTitleSize : 14,
    WindowTitleString : "",
    AlertMessageString : "",
    ButtonComfirmRefreshPage : false,
    
    Refresh:function(){
        TopWindow.WindowTitleString       = "<span style=\"font-size:"+TopWindow.WindowTitleSize+"px;\"><B>"+TopWindow.WindowTitle+"</B></span>";
          
        if(TopWindow.AlertMeesageIsA){
            TopWindow.AlertMessageString        = "<span style=\"font-size:"+TopWindow.AlertMessageSize+"px;font-weight:"+TopWindow.AlertMessageWeight+";color:"+TopWindow.AlertMessageColor+"\"><a href=\""+TopWindow.MessageUrl+"\">"+TopWindow.AlertMessage+"</a></span>";
        }else{
            TopWindow.AlertMessageString        = "<span style=\"font-size:"+TopWindow.AlertMessageSize+"px;font-weight:"+TopWindow.AlertMessageWeight+";color:"+TopWindow.AlertMessageColor+"\">"+TopWindow.AlertMessage+"</span>";
        }
        
    },
    
    init:function(){
        TopWindow.Refresh();
        TopWindow.FrameHTMLCode       = "<div id=\"TopWindowbg\" class=\"AlertWindowbg\">"+
        "</div><div id=\"TopWindowsDiv\" class=\"mydiv\" style=\"display:none;\">"+
"<table width=\"400\" border=\"0\" align=\"center\" bgcolor=\"#FFFFFF\" cellpadding=\"0\" cellspacing=\"0\" class=\"tbl_6\" style=\"margin:12px 12px 0px 12px\">"+
  "<tr>"+
    "<td height=\"24\" align=\"left\" bgcolor=\"#ddf1d8\" class=\"f_14\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"+
        "<tr>"+
          "<td>&nbsp;<span id=\"TopWindowTitleContent\">"+TopWindow.WindowTitleString+"</span></td>"+
          "<td align=\"right\"><table width=\"24\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"+
              "<tr>"+
                "<td><div align=\"left\"><a href=\"#\"><img src=\"../images/close.gif\" width=\"20\" height=\"20\" onclick=\"TopWindow.Hidden()\" style=\"cursor:hand\"/></a></div></td>"+
              "</tr>"+
          "</table></td>"+
        "</tr>"+
      "</table></td>"+
  "</tr>"+
  "<tr>"+
    "<td valign=\"top\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\">"+
      "<tr>"+
        "<td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"10\">"+
          "<tr>"+
            "<td>"+
                "<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\" bgcolor=\"#DDF1D8\">"+
                  "<tr>"+
                    "<td bgcolor=\"#FFFFFF\"><table width=\"98%\" border=\"0\" align=\"center\" cellpadding=\"1\" cellspacing=\"1\">"+
                        "<tr>"+
                          "<td width=\"100%\" height=\"60\" bgcolor=\"#FFFFFF\"><div align=\"center\" id=\"TopWindowMessageContent\">"+
                            TopWindow.AlertMessageString+
                            "</div></td>"+
                        "</tr>"+
                        "<tr style=\"display:none;\">"+
                          "<td bgcolor=\"#FFFFFF\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"+
                              "<tr>"+
                                "<td><div align=\"center\">"+
                                    "<input name=\"button\" type=\"button\" class=\"input_btn1\" id=\"button\" value=\"  确 定  \" onclick=\"TopWindow.Hidden()\"/>"+
                                  "</div></td>"+
                                "</tr>"+
                          "</table></td>"+
                        "</tr>"+
                    "</table></td>"+
                  "</tr>"+
                "</table>"+
                 "</td>"+
          "</tr>"+
        "</table>          </td>"+
      "</tr>"+
    "</table></td>"+
  "</tr>"+
"</table>"+
"</div><iframe id=\"TopWindowpopIframe\" class=\"AlertWindowpopIframe\" frameborder=\"0\" ></iframe>";

//新版内页改版的提示层

        TopWindow.FrameHTMLCode       = "<div class=\"popup\" style=\"display:none;\" id=\"TopWindowbg\">"+
"<h3><span class=\"pop_ttl\" id=\"TopWindowTitleContent\">"+TopWindow.WindowTitleString+"</span><a href=\"javascript:void(0);\" onclick=\"TopWindow.Hidden()\" class=\"pop_close\"><img src=\"../images/icon_close.gif\" alt=\"关闭弹出窗口\" title=\"关闭弹出窗口\" border=\"0\" /></a></h3>"+
"<div class=\"pop_content\" id=\"TopWindowMessageContent\">"+
TopWindow.AlertMessageString+
"</div>"+
"<div class=\"pop_end\"></div>"+
"</div><iframe id=\"TopWindowpopIframe\" class=\"AlertWindowpopIframe\" frameborder=\"0\" ></iframe>";


        
        //显示TopWindow
        document.write(TopWindow.FrameHTMLCode);
        
    },

    Show:function(){
        /*Refresh Recompute Display Information(WindowTitleString/AlertMEssageString)*/
        TopWindow.Refresh();
        
        /*Fill New Information to HTMLFrame*/
        document.getElementById("TopWindowTitleContent").innerHTML    =   TopWindow.WindowTitleString;   
        document.getElementById("TopWindowMessageContent").innerHTML     =   TopWindow.AlertMessageString ;
        
        /*Display TopWindow*/
        //document.getElementById("TopWindowsDiv").style.display='block';
        document.getElementById("TopWindowpopIframe").style.display='block';
        document.getElementById("TopWindowbg").style.display='block';
        popup("TopWindowbg","block");
    },
    Hidden:function(){
        //document.getElementById("TopWindowsDiv").style.display='none';
        document.getElementById("TopWindowpopIframe").style.display='none';
        document.getElementById("TopWindowbg").style.display='none';
        popup("TopWindowbg","none");
        if(TopWindow.ButtonComfirmRefreshPage){
            location.reload();
        }
    },
    LoadCss : function(id,url)
	{
		var h = document.getElementsByTagName("head")[0];
	    var link = document.createElement("link");
	    link.id= id;
		link.type ="text/css";
		link.rel = "STYLESHEET";
		link.href = url;
	    h.appendChild(link);
	},
	ImportCss:function(){
	    TopWindow.LoadCss("AlertWindowCss","../js/AlertWindow.css");
	}
	
}
TopWindow.ImportCss();
//TopWindow.CreatePanel();