﻿/*
*☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆
*★                                      ★
*☆           div模态窗口                ☆
*★                                      ★
*☆  版权所有: 火影软件设计工作室        ☆
*★                                      ★
*☆  程序制作: epzk                      ☆
*★            email:epzk@163.com        ★
*☆            QQ:164096027              ☆
*★                                      ★
*★  主页地址：http://www.hiying.cn      ★
*★                                      ★
*☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆
*/
//--------table+css begin-----------//
//table代码
document.write("<table border=0 cellpadding=0 cellspacing=0><tr><td id='tableModal'></td></tr></table>");
document.write("<Table border=0 cellpadding=0 cellspacing=0><tr><td id='tableModalDialog' valign='top'>");
document.write("<table border=0 cellpadding=0 cellspacing=0 style='background: #3BCF01;'><tr><td class='titleBar' id='mytitle1'></td><td class='titleBar' title='关闭'><a href='javascript:closeModel();'>×</a></td></tr></table>");
document.write("<iframe id='myframe1' src='about:blank' marginheight=0 marginwidth=0 width='100%' height='100%' frameborder=0></iframe>");
document.write("</td></tr></Table>");

//css代码
document.write("<style>");
document.write(".titleBar{color:#fff;width: 100%;padding:5px;padding-bottom:1px;line-height:18px;border-bottom: #999999 solid 1px;font-weight:bold;}");
document.write(".mainBody{width:100%;height:100%;}");
document.write("#tableModalDialog{border:solid 1px #999999;background:white;POSITION: absolute;left:0px;top:0px;DISPLAY: none;z-index:49;}");
document.write("#tableModal{BACKGROUND-COLOR: white; FILTER: alpha(opacity=75); LEFT: 0px; POSITION:absolute; TOP: 0px;}");
document.write("</style>");

//js代码 
function showModel(w,h,url,title)   /*html页面直接调此函数 w-宽度，h-高度，url-链接，title-窗口标题*/
{
    tableModalDialog.style.display = "block";
    tableModalDialog.style.width=w;
    tableModalDialog.style.height=h;
    document.all["myframe1"].src=url;
    mytitle1.innerHTML=title;
    resizeModal();
    window.onresize = resizeModal;
}
function showModel2(w,h,url,title)   /*html页面直接调此函数 w-宽度，h-高度，url-链接，title-窗口标题*/
{
    tableModalDialog.style.display = "block";
    tableModalDialog.style.width=w;
    tableModalDialog.style.height=h;
    document.all["myframe1"].src=url+"&modid="+document.getElementById("mycarousel").getElementsByTagName('li')[YC_IMG.loadimg.page].id;
    mytitle1.innerHTML=title;
    resizeModal();
    window.onresize = resizeModal;
}

function closeModel()
{
    tableModal.style.width = "0px";
    tableModal.style.height = "0px";
    tableModalDialog.style.display = "none";
    window.onresize = null;
}

function resizeModal()
{
    tableModal.style.width = document.body.scrollWidth;
    tableModal.style.height = document.body.scrollHeight;
    tableModalDialog.style.left = ((document.documentElement.clientWidth - tableModalDialog.offsetWidth) / 2);
    tableModalDialog.style.top = (document.documentElement.scrollTop+(document.documentElement.clientHeight - tableModalDialog.offsetHeight) / 2);
    //divModalDialog.style.top = ((document.body.offsetHeight - divModalDialog.offsetHeight) / 2);
        
}
//--------table+css end-----------//

//--------div+css begin-----------//ie7.0不支持
//div代码
document.write("<div id='divModal'></div>");
document.write("<DIV id='divModalDialog'>");
document.write("<div class='titleBar'>");
document.write("<div class='titleName' id='mytitle'></div>");
document.write("<div class='closeButton' title='关闭'><a href='javascript:divCloseModel();'>×</a></div>");
document.write("</div>");
document.write("<div class='mainBody'>");
document.write("<iframe id='myframe' src='about:blank' marginheight=0 marginwidth=0 width='100%' height='100%' frameborder=0></iframe>");
document.write("</div>");
document.write("</DIV>");

//css代码
document.write("<style>");
document.write("div.titleBar{background: #3BCF01;color:#fff;margin: 0px auto;width: 100%;padding:5px;padding-bottom:1px;line-height:18px;border-bottom: #999999 solid 1px;}");
document.write("div.titleName{float:left; font-weight:bold;}");
document.write("div.closeButton{float: right; font-weight:bold;}");
document.write("div.mainBody{margin: auto;}");
document.write("#divModalDialog{border:solid 1px #999999;background:white;POSITION: absolute;left:0px;top:0px;DISPLAY: none;z-index:49;}");
document.write("#divModal{BACKGROUND-COLOR: white; FILTER: alpha(opacity=75); LEFT: 0px; POSITION:absolute; TOP: 0px;}");
document.write("</style>");

//js代码 
function divShowModel(w,h,url,title)   /*html页面直接调此函数 w-宽度，h-高度，url-链接，title-窗口标题*/
{
    divModalDialog.style.display = "block";
    divModalDialog.style.width=w;
    divModalDialog.style.height=h;
    document.all["myframe"].src=url;
    mytitle.innerHTML=title;
    divResizeModal();
    window.onresize = resizeModal;
}

function divCloseModel()
{
    divModal.style.width = "0px";
    divModal.style.height = "0px";
    divModalDialog.style.display = "none";
    window.onresize = null;
}

function divResizeModal()
{
    divModal.style.width = document.body.scrollWidth;
    divModal.style.height = document.body.scrollHeight;
    divModalDialog.style.left = ((document.documentElement.clientWidth - divModalDialog.offsetWidth) / 2);
    divModalDialog.style.top = (document.documentElement.scrollTop+(document.documentElement.clientHeight - divModalDialog.offsetHeight) / 2);
    //divModalDialog.style.top = ((document.body.offsetHeight - divModalDialog.offsetHeight) / 2);
        
}
//--------div+css end-----------//
