﻿// JavaScript Document  //power by fox
var reflash = false;
function GetCookies(name)
{
    var arr = document.cookie.match(new RegExp(name+"=([^&;]+)"));
    if(arr != null)
    {
        return decodeURI(arr[1]);
    }
    return "";
}
document.write('<style type="text/css">#blackbg{position:fixed;_position:absolute;}');

document.writeln('#blackcontentOuter{ position:fixed!important;position:absolute;left:50%;top:50%;_top:expression(eval(document.compatMode &&document.compatMode==\'CSS1Compat\')?(documentElement.scrollTop + (document.documentElement.clientHeight-this.offsetHeight)/2+100) :(document.body.scrollTop + (document.body.clientHeight - this.clientHeight)/2)+100);}</style>');

function getDivHeight()
{
    var a = document.body.scrollHeight;
    var b = window.screen.height;
    return a>b?a:b;
}

var newdiv = document.createElement("div");
var sdiv = document.createElement("div");
var contentdiv = document.createElement("div");
var Globle_width=0,Globle_height=0,Globle_src='',
Globle_title='',Globle_Str='';

function setbg(boxtitle,pwidth,pheight,psrc)
{
    var ob = document.body.getElementsByTagName("embed")
    for(i=0;i<ob.length;i++)
        ob[i].style.display = "none";
        
    if(GetCookies("UserID")=="") 
        reflash =true;
    InitDivData();
    Globle_title = boxtitle;
    Globle_width = pwidth;
    Globle_height= pheight;
    Globle_src = psrc;
    Globle_Str = '<div style="text-align:left;position:relative;top:0px;height:26px; line-height:26px; color:#000;background:url(/images/msgboxbar.gif) repeat-x 0 0;padding-left:12px;"><a style="float:right;color:#000;padding-right:8px;" href="javascript:closeopendiv()">[关闭窗口]</a><strong>'+Globle_title+'</strong></div><iframe scrolling="auto"  src="'+Globle_src+'" frameborder="0" height="'+Globle_height+'" width="'+Globle_width+'"></iframe><div></div><span style="display:none" id="spBackData"></span>';
    scrooleffect();
}

function ShowMsg(Msg)
{
    InitDivData();
    Globle_title = "消息提示";
    Globle_width = 400;
    Globle_height= 200;
    Globle_Str = '<div style="position:relative;top:-24px;border-bottom:1px solid #666; height:24px; line-height:24px; color:#fff;"><a style="float:right;color:#ccc;" href="javascript:closeopendiv()">关闭</a>'+Globle_title+'</div><div style="text-align:center;line-height:300%; color:#03FA13;">'+Msg+'</div>';
    scrooleffect();
}

var sctimer;
var tempwidth =0,tempheight =0,temppate=1,speedrate=24;

function InitDivData()
{
    newdiv.id="blackbg";
    newdiv.style.display = "none";
    newdiv.style.zIndex='9990';
    newdiv.style.backgroundColor="#000000";
    newdiv.style.filter="alpha(opacity=30)"; 
    newdiv.style.opacity=0.8; 
    newdiv.style.display = "block";
    newdiv.style.top = "0px";
    newdiv.style.left = "0px";
    newdiv.style.width="100%";
    newdiv.style.height= getDivHeight() +"px";
    contentdiv.id="blackcontentOuter";
    contentdiv.style.display = "none";
    contentdiv.style.zIndex='9991';
    contentdiv.style.width='10px';
    contentdiv.style.height='10px';
    contentdiv.style.margin='-5px 0px 0px -5px';
    contentdiv.style.backgroundColor="#fff";
    document.body.appendChild(newdiv);
    document.body.appendChild(contentdiv);
}

function scrooldiv()
{
    if(Globle_height>Globle_width)
    {
        temppate = Globle_height/Globle_width;
        tempwidth+=speedrate;
        tempheight+=speedrate*temppate;
    }
    else
    {
        temppate = Globle_width/Globle_height;
        tempheight+=speedrate;
        tempwidth+=speedrate*temppate;
    }
    if((tempwidth+speedrate)>Globle_width || (tempheight+(speedrate*temppate))>Globle_height )
    {
        tempwidth = Globle_width; 
        tempheight = Globle_height; 
        window.clearInterval(sctimer);
        contentdiv.innerHTML = '<div style="position:relative;top:-24px;border-bottom:1px solid #666; height:24px; line-height:24px; color:#fff;"><a style="float:right;color:#ccc;" href="javascript:closeopendiv()">关闭</a>'+Globle_title+'</div><iframe scrolling="no"  src="'+Globle_src+'" frameborder="0" height="'+Globle_height+'" width="'+Globle_width+'"></iframe><div></div>';
        contentdiv.innerHTML = Globle_Str;
    }
    
    contentdiv.style.width= tempwidth + "px";
    contentdiv.style.height= tempheight + "px";
    contentdiv.style.margin = "-"+tempheight/2+"px 0px 0px -"+tempwidth/2+"px";
}

function scrooleffect()
{
    contentdiv.style.display = "block";
    sctimer =  setInterval(scrooldiv,5);
}

function closeopendiv()
{
    if(reflash==true && GetCookies("UserID")!="")
    {
        window.location.reload();
    }
    else
    {
        contentdiv.style.width='10px';
        contentdiv.style.height='10px';
        contentdiv.innerHTML ="";
        Globle_width=0,Globle_height=0,Globle_src='',Globle_title='',Globle_Str='';
        tempwidth =0,tempheight =0,temppate=1,contentdiv.style.display = "none";
        newdiv.style.display = "none";
    }
    var ob = document.body.getElementsByTagName("embed")
    for(i=0;i<ob.length;i++)
        ob[i].style.display = "";
}

function closeopendiv2()
{
    reflash==true ;
    contentdiv.style.width='10px';
    contentdiv.style.height='10px';
    contentdiv.innerHTML ="";
    Globle_width=0,Globle_height=0,Globle_src='',Globle_title='',Globle_Str='';
    tempwidth =0,tempheight =0,temppate=1,contentdiv.style.display = "none";
    newdiv.style.display = "none";
}


function setbg2(boxtitle,pwidth,pheight,psrc)
{
    reflash == true; 
    InitDivData();
    Globle_title = boxtitle;
    Globle_width = pwidth;
    Globle_height= pheight;
    Globle_src = psrc;
    Globle_Str = '<div style="position:relative;top:-27px;height:26px; line-height:26px; color:#000;background:url(/images/msgboxbar.gif) repeat-x 0 0;padding-left:12px;"><a style="float:right;color:#000;padding-right:8px;" href="javascript:closeopendiv2()">[关闭窗口]</a><strong>'+Globle_title+'</strong></div><iframe scrolling="no"  src="'+Globle_src+'" frameborder="0" height="'+Globle_height+'" width="'+Globle_width+'"></iframe><div></div>';
    scrooleffect();
}
