// JavaScript Document  //power by zrw247
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">body{ margin:0px !ipmortant; padding:0px  !ipmortant;}');
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 $(objname)
{
	return document.getElementById(objname);
}

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)
{
	if(GetCookies("UserID")=="")
		reflash =true;

	InitDivData();
	Globle_title = boxtitle;
	Globle_width = pwidth;
	Globle_height= pheight;
	Globle_src = psrc;
	Globle_Str = '<iframe scrolling="no"  src="'+Globle_src+'" frameborder="0" height="'+Globle_height+'" width="'+Globle_width+'"></iframe><div></div>';
	scrooleffect();
}

var sctimer;
var tempwidth =0,tempheight =0,temppate=1,speedrate=20;

function InitDivData()
{
	newdiv.id="blackbg";
	newdiv.style.display = "none";
	newdiv.style.position ="absolute";
	newdiv.style.zIndex='9990';
	newdiv.style.backgroundColor="#000000";
	newdiv.style.filter="alpha(opacity=80)";
	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,10);
}

function closeopendiv()
{
	if(reflash==true && GetCookies("UserID")!="")
	{
		window.location.reload();
	}else{
		contentdiv.style.width='10px';
		contentdiv.style.height='10px';
		contentdiv.style.top='50%';
		contentdiv.style.left='50%';
		contentdiv.style.margin='-5px 0px 0px -5px';
		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";
	}
}

