﻿//引入公共脚本文件
//document.write("<scrip"+"t language =\"javascript\" type=\"text/javascript\" src=\"/Content/Js/firefox.js\"></scr"+"ipt>");
//document.write("<scrip" + "t language =\"javascript\" type=\"text/javascript\" src=\"/Content/Js/form.js\"></scr" + "ipt>");

//获取元素的纵坐标
function getTop(e){
    var offset=e.offsetTop;
    if(e.offsetParent!=null) offset+=getTop(e.offsetParent);
    return offset;
}

//获取元素的横坐标
function getLeft(e){
    var offset=e.offsetLeft;
    if(e.offsetParent!=null) offset+=getLeft(e.offsetParent);
    return offset;
}

//生成无边框FLASH
function buildFlash(swdname,width,height,objectName,FlashVars)
{
	var s="";
	s+="<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=9,0,28,0' WIDTH='"+width+"' HEIGHT='"+height+"'"+((objectName)?" id='"+objectName+"'":"")+">";
	s+="<PARAM NAME='movie' VALUE='"+swdname+"' />";
	s+="<PARAM NAME='quality' VALUE='high' /> ";
	s+="<param name='wmode' value='transparent' /> ";
	s+="<param name='menu' value='false' />";
	s+="<param name='allowScriptAccess' value='*' />";
	if(FlashVars) s+="<param name='FlashVars' value='"+FlashVars+"' />";
	s += "<EMBED src='" + swdname + "' FlashVars='" + FlashVars + "' wmode='transparent' quality='high'" + ((objectName) ? " name='" + objectName + "'" : "") + " swLiveConnect='true' allowScriptAccess='*' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http:\/\/www.macromedia.com\/go\/getflashplayer' WIDTH='" + width + "' HEIGHT='" + height + "'></EMBED>";
	s+="</OBJECT>";
	document.write(s);
}

if (!document.getElementById("frmSystemMessage")) {
    document.write('<iframe id="frmSystemMessage" src="/Scripts/transparent.html" allowtransparency="true"');
    document.write('    width="0" height="0" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"');
    document.write('    style="display: none;"></iframe>');
    document.write('<div id="divSystemMessageContent">');
    document.write('    <table cellpadding="0" cellspacing="0" border="0" width="100%" style="height: 100%;">');
    document.write('        <tr>');
    document.write('            <td>');
    document.write('                <iframe id="frmSystemMessageContent" width="100%" height="100%" frameborder="0"');
    document.write('                    marginwidth="0" marginheight="0" scrolling="no"></iframe>');
    document.write('            </td>');
    document.write('        </tr>');
    document.write('    </table>');
    document.write('</div>');
    document.write('<style>');
    document.write('#frmSystemMessage');
    document.write('{');
    document.write('	position:absolute;');
    document.write('	top:0px;');
    document.write('	left:0px;');
    document.write('	FILTER: Alpha(opacity=30);');
    document.write('	-moz-opacity: 0.3;');
    document.write('	opacity: 0.3;');
    document.write('	background-color:#FFFFFF;');
    document.write('	display:none;');
    document.write('}');
    document.write('#divSystemMessageContent');
    document.write('{');
    document.write('	position:absolute;');
    document.write('	background-color:#FFFFFF;');
    document.write('	display:none;');
    document.write('	border: 1px solid #E4E4E4;');
    document.write('	filter:progid:DXImageTransform.Microsoft.Shadow(color=#666666,direction=135,strength=3);');
    document.write('}');
    document.write('</style>');
}



//生成系统提示框
function showSystemMessage(w,h,url){
    closeSystemMessage();
    //生成遮照
    var f=document.getElementById("frmSystemMessage");
    /*
    if(!f){
        self.top.closeSystemMessage();
        self.top.showSystemMessage(w,h,url);
        return;
    }
    */
	f.style.width = document.documentElement.scrollWidth+"px";
	f.style.height = document.documentElement.scrollHeight+"px";
	f.style.zIndex="2000";
    f.style.display="inline";
    
    var c=document.getElementById("divSystemMessageContent"); //内容面板
    
	c.style.width = w+"px";
	c.style.height = h+"px";
	c.style.left=document.documentElement.scrollLeft+parseInt((document.documentElement.scrollWidth-w)/2)+"px";
	c.style.top=document.documentElement.scrollTop+parseInt((document.documentElement.scrollHeight-h)/2)+"px";
	c.style.zIndex="2001";

    //c.getElementsByTagName("TABLE")[0].rows[1].style.height=h-0+"px";
    c.getElementsByTagName("IFRAME")[0].style.height=h-0+"px";
    
    url+=((url.indexOf("?")>0)?"&":"?");
    url+=Math.random();

    c.getElementsByTagName("IFRAME")[0].src = url;
    
    c.style.display="inline";

  
    window.onresize = window.onscroll = function () {
        //alert(document.documentElement.clientHeight);
        var f = document.getElementById("frmSystemMessage");

        if (f != null) {
            if (f.style.display == "inline") {
                f.style.width = document.documentElement.scrollWidth + "px";
                f.style.height = document.documentElement.scrollHeight + "px";
            }
            var c = document.getElementById("divSystemMessageContent");
            if (c.style.display == "inline") {
                c.style.left = document.documentElement.scrollLeft + parseInt((document.documentElement.clientWidth - w) / 2) + "px";
                c.style.top = document.documentElement.scrollTop + parseInt((document.documentElement.clientHeight - h) / 2) + "px";
            }
        }
    }
}

//关闭系统提示框
function closeSystemMessage(){
    var f=document.getElementById("frmSystemMessage");
    f.style.display="none";
    
    var c=document.getElementById("divSystemMessageContent");
    c.getElementsByTagName("IFRAME")[0].src = "/Scripts/transparent.html";
    c.style.display="none";
    
    window.onresize=window.onscroll=null;

}


function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6. 
{ 
    var arVersion = navigator.appVersion.split("MSIE") 
    var version = parseFloat(arVersion[1]) 
    if ((version >= 5.5) && (document.body.filters)) 
    { 
       for(var j=0; j<document.images.length; j++) 
       { 
          var img = document.images[j] 
          var imgName = img.src.toUpperCase() 
          if (imgName.substring(imgName.length-3, imgName.length) == "PNG") 
          { 
             var imgID = (img.id) ? "id='" + img.id + "' " : "" 
             var imgClass = (img.className) ? "class='" + img.className + "' " : "" 
             var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' " 
             var imgStyle = "display:inline-block;" + img.style.cssText 
             if (img.align == "left") imgStyle = "float:left;" + imgStyle 
             if (img.align == "right") imgStyle = "float:right;" + imgStyle 
             if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle 
             var strNewHTML = "<span " + imgID + imgClass + imgTitle 
             + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" 
             + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" 
             + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
             img.outerHTML = strNewHTML 
             j = j-1 
          } 
       } 
    }
}
//弹出层弹出后修改弹出层大小
function changewidth(w, h) {
    var c = document.getElementById("divSystemMessageContent"); //内容面板
    var e = document.documentElement;
    c.style.width = w + "px";
    c.style.height = h + "px";
    c.style.left = e.scrollLeft + parseInt((e.clientWidth - w) / 2) + "px";
    c.style.top = e.scrollTop + parseInt((e.clientHeight - h) / 2) + "px";
    c.getElementsByTagName("IFRAME")[0].style.height = h - 0 + "px";
    window.onresize = window.onscroll = function () {
        var f = document.getElementById("frmSystemMessage");
        if (f.style.display == "inline") {
            f.style.width = e.scrollWidth + "px";
            f.style.height = e.scrollHeight + "px";
        }
        var c = document.getElementById("divSystemMessageContent");
        if (c.style.display == "inline") {
            c.style.left = e.scrollLeft + parseInt((e.clientWidth - w) / 2) + "px";
            c.style.top = e.scrollTop + parseInt((e.clientHeight - h) / 2) + "px";
        }
    }
}

