﻿//引入公共脚本文件
document.write("<scrip"+"t language =\"javascript\" type=\"text/javascript\" src=\"/common/firefox.js\"></scr"+"ipt>");
document.write("<scrip"+"t language =\"javascript\" type=\"text/javascript\" src=\"/common/form.js\"></scr"+"ipt>");
document.write("<scrip"+"t language =\"javascript\" type=\"text/javascript\" src=\"/common/ajax.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+"' 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+"' wmode='Opaque'></EMBED>";
	s+="</OBJECT>";
	document.write(s);
}

//生成系统提示框
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.clientWidth+"px";
	f.style.height = document.documentElement.clientHeight+"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.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="/common/transparent.html";
    c.style.display="none";
    
    window.onresize=window.onscroll=null;

}

if(!document.getElementById("frmSystemMessage")){    
    document.write('<iframe id="frmSystemMessage" src="/common/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:#000000;');
    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>');    
}
