﻿function jsClose(divName)
{
    document.getElementById(divName).style.display = 'none';
}

function jsGG(position,disHeight,disWidth,divName,divWidth,jsSrc,jsUrl,jsType,pWidth,pHeight,autoCloseTime)
{
    document.write("<div id='"+divName+"' style='position:absolute;visibility: visible;z-index:50000;width:'"+divWidth+"';'>\<table border='0' cellpadding='0' cellspacing='0'><tr><td>");
        
    if(jsType=="photo")
    {
        document.write("<a href='" + jsUrl + "' target = '_blank'><img src='" + jsSrc + "' width='"+pWidth+"' heigth='"+pHeight+"' border = '0'><\/a>");
    }
    else if(jsType=="swf")
    {
        document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase=' http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='"+pWidth+"' height='"+pHeight+"'>");
        document.write("<param name='movie' value='"+jsSrc+"' />");
        document.write("<param name='quality' value='high' />");
        document.write("<param name='wmode' value='transparent' />");
        document.write("<embed src='"+jsSrc+"' quality='high' pluginspage=' http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+pWidth+"' height='"+pHeight+"'><\/embed>");
        document.write("<\/object>");
    }
    else if(jsType=="iframe")
    {
        document.write("<IFRAME frameBorder=no height='"+pHeight+"' marginHeight='0' marginWidth='0' name='sznews_frame' scrolling='no'  src='"+jsSrc+"'  width='"+pWidth+" allowtransparency='yes'><\/IFRAME>");
    }
    document.write("<\/td><\/tr><tr><td width='"+divWidth+"' bgcolor='#FFFFFF' style='text-align:right;padding-top:2px;padding-right:3px;'><a href=\"javascript:jsClose('"+divName+"')\" target='_self' style='font-size:12px;color:#000000;text-decoration:none;'>关 闭<\/a><\/td><\/tr>\<\/table>\<\/div>"); 
    
    if(navigator.userAgent.indexOf('MSIE')>=0||navigator.userAgent.indexOf('Firefox') >= 0)
    {
        rollIEFF(position,divName,disHeight,disWidth);
    }
    else
    {
        rollElse(position,divName,disHeight,disWidth);
    }
    
    if(autoCloseTime!=0)
    {
        setTimeout(function(){jsClose(divName);},autoCloseTime);
    }
}
function rollIEFF(position,divName,disHeight,disWidth)
{
    if(position=="left")
    {
        document.getElementById(divName).style.top=document.documentElement.scrollTop+document.documentElement.clientHeight-disHeight+"px";
        document.getElementById(divName).style.left=document.documentElement.scrollLeft+disWidth+"px";
        setTimeout(function(){rollIEFF(position,divName,disHeight,disWidth);},50);
    }
    else if(position=="right")
    {
        document.getElementById(divName).style.top=document.documentElement.scrollTop+document.documentElement.clientHeight-disHeight+"px";
        document.getElementById(divName).style.left=document.documentElement.scrollLeft+document.documentElement.clientWidth-disWidth+"px";
        setTimeout(function(){rollIEFF(position,divName,disHeight,disWidth);},50);
    }
    
}
function rollElse(position,divName,disHeight,disWidth)
{
    if(position=="left")
    {
        document.getElementById(divName).style.top=document.body.scrollTop+document.documentElement.clientHeight-disHeight+"px";
        document.getElementById(divName).style.left=document.body.scrollLeft+disWidth+"px";
        setTimeout(function(){rollElse(position,divName,disHeight,disWidth);},50);
    }
    else if(position=="right")
    {
        document.getElementById(divName).style.top=document.body.scrollTop+document.documentElement.clientHeight-disHeight+"px";
        document.getElementById(divName).style.left=document.body.scrollLeft+document.documentElement.clientWidth-disWidth+"px";     
        setTimeout(function(){rollElse(position,divName,disHeight,disWidth);},50);
    }
}
