
/* 

  ================================================
  PVII PopBox Magic scripts
  Copyright (c) 2008 Project Seven Development
  www.projectseven.com
  Version:  1.0.0 - script build: 1-11
  ================================================
  
 */

var p7PBXi=false,p7PBXpp=false,p7pbxA=navigator.userAgent.toLowerCase(),p7pbxB=false,p7PBXan=false,p7PBXtmr;
function P7_PBXset(){
	var i,h,sh,hd,x,v;
	if(!document.getElementById ||typeof document.appendChild=='undefined' ){
		return;
	}
	sh='.p7pbx_wrapper {position:absolute;top:0px;left:-9000px;height:10px;overflow:hidden;z-index:999998;}\n';
	sh+='#p7pbxbk {position:absolute;top:0px;left:0px;display:none;z-index:999999;}\n';
	sh+='#p7pbx_box {position:absolute;top:0px;left:0px;z-index:999998;}\n';
	sh+='.p7pbx_close {display:block;}\n';
	sh+='#p7pbx_dyn_overlay {position:fixed;width:100%;height:120%;position:absolute;left:0px;top:0px;z-index:999997;display:none;}\n';
	x=p7pbxA.indexOf("msie");
	if(x>-1){
		v=parseInt(p7pbxA.substring(x+4,x+6));
		p7pbxB=(v<7)?true:false;
		h='\n<st' + 'yle type="text/css">\n'+sh+'\n</s' + 'tyle>';
		document.write(h);
	}
	else{
		h=document.createElement('style');
		h.type='text/css';
		h.appendChild(document.createTextNode(sh));
		hd=document.getElementsByTagName('head');
		hd[0].appendChild(h);
	}
}
P7_PBXset();
function P7_PBXaddLoad(){
	if(!document.getElementById ||typeof document.removeChild=='undefined' ){
		return;
	}
	if(window.addEventListener){
		window.addEventListener("load",P7_PBXinit,false);
		window.addEventListener("resize",P7_PBXrsz,false);
	}
	else if(window.attachEvent){
		window.attachEvent("onload",P7_PBXinit);
		window.attachEvent("onresize",P7_PBXrsz);
	}
	else if(typeof window.onload=='function'){
		var p7vloadit=onload;
		window.onload=function(){
			p7vloadit();
			P7_PBXinit();
		};
		var p7vrz=onresize;
		window.onresize=function(){
			p7vrz();
			P7_PBXrsz();
		};
	}
	else{
		window.onload=P7_PBXinit;
		window.onresize=P7_PBXrsz;
	}
}
P7_PBXaddLoad();
function P7_PBXinit(){
	var i,tA,tD,oD,cs,cA,el,ba,ob,bd,pp,nw;
	el=document.createElement('div');
	el.setAttribute("id","p7pbxbk");
	bd=document.getElementsByTagName('body');
	bd[0].appendChild(el);
	el=document.createElement('div');
	el.setAttribute("id","p7pbx_dyn_overlay");
	bd[0].appendChild(el);
	el=document.createElement('div');
	el.setAttribute("id","p7pbx_box");
	bd[0].appendChild(el);
	nw=document.getElementById("p7pbx_box");
	for(i=0;i<p7PBXcn.length;i+=3){
		ba=document.getElementById(p7PBXcn[i+1]);
		if(ba){
			nw.appendChild(ba);
		}
	}
	for(i=0;i<p7PBXcn.length;i+=3){
		tA=document.getElementById(p7PBXcn[i]);
		tD=document.getElementById(p7PBXcn[i+1]);
		if(p7pbxA.indexOf("msie 5")>-1){
			p7PBXopt[0]=0;
		}
		if(tA&&tD){
			tA.p7pbxc=tD.id;
			tD.p7pbxt=tA.id;
			tD.p7pbxh=false;
			tA.onclick=function(){
				return P7_PBXshow(this);
			};
			cs=tA.id.replace("t","s");
			cA=document.getElementById(cs);
			tD.style.width=p7PBXcn[i+2]+"px";
			if(cA){
				tD.p7pbxh=cA.id;
				cA.setAttribute("href","#");
				cA.onclick=function(){
					return P7_PBXclose(this);
				};
			}
		}
	}
	oD=document.getElementById('p7pbx_dyn_overlay');
	oD.onclick=function(){
		return P7_PBXclose(this);
	};
}
function P7_PBXshow(a){
	var i,cD,oD,cT,bT,an=p7PBXopt[0],op,cw,ch,tw,th,cl,ct;
	cD=document.getElementById(a.p7pbxc);
	oD=document.getElementById('p7pbx_dyn_overlay');
	if(p7PBXtmr){
		clearTimeout(p7PBXtmr);
	}
	cD.style.height="auto";
	oD.style.display="block";
	if(an==0){
		p7PBXpp=a.p7pbxc;
		P7_PBXpos();
	}
	else if(an==1){
		p7PBXan=true;
		op=0.05;
		if(p7pbxA.indexOf("msie")>-1){
			cD.style.zoom="100%";
			cD.style.filter='alpha(opacity='+op*100+')';
		}
		else{
			cD.style.opacity=op;
		}
		p7PBXpp=a.p7pbxc;
		P7_PBXpos();
		P7_PBXfadeIn(cD.id,op);
	}
	else if(an>1){
		bT=document.getElementById('p7pbxbk');
		th=cD.offsetHeight;
		tw=cD.offsetWidth;
		op=1.00;
		if(p7pbxA.indexOf("msie")>-1){
			bT.style.zoom="100%";
			bT.style.filter='alpha(opacity='+op*100+')';
		}
		else{
			bT.style.opacity=op;
		}
		if(an==2||an==3){
			ch=10;
			cw=tw;
		}
		else if(an==4||an==5){
			cw=10;
			ch=th;
		}
		else if(an==6||an==7){
			cw=6;
			ch=20;
		}
		else{
			cw=tw;
			ch=th;
		}
		bT.style.width=cw+"px";
		bT.style.height=ch+"px";
		bT.style.display="block";
		P7_PBXpos(bT);
		cl=parseInt(bT.style.left);
		ct=parseInt(bT.style.top);
		if(p7PBXopt[1]==1){
			ct=parseInt(ct-(ch/2)+(th/2));
		}
		else if(p7PBXopt[1]==2){
			cl=parseInt(cl-(cw/2)+(tw/2));
		}
		p7PBXan=true;
		p7PBXpp=a.p7pbxc;
		P7_PBXgrow(bT.id,cw,ch,tw,th,cl,ct,an);
	}
	if(cD.p7pbxh){
		cT=document.getElementById(cD.p7pbxh);
		cT.focus();
	}
	return false;
}
function P7_PBXclose(){
	var oD,tB,a,bB;
	if(p7PBXpp){
		if(p7PBXtmr){
			clearTimeout(p7PBXtmr);
		}
		oD=document.getElementById('p7pbx_dyn_overlay');
		tB=document.getElementById(p7PBXpp);
		tB.style.left="-9000px";
		tB.style.height="10px";
		oD.style.display="none";
		if(p7pbxB){
			oD.style.height="10px";
		}
		bB=document.getElementById('p7pbxbk');
		bB.style.display="none";
	}
	a=document.getElementById(tB.p7pbxt);
	a.focus();
	p7PBXpp=false;
	return false;
}
function P7_PBXrsz(){
	if(p7PBXpp&&!p7PBXan){
		P7_PBXpos();
	}
}
function P7_PBXpos(ob){
	var x,y,wd,tB,h,w,sh,oD;
	wd=P7_PBXwin();
	if(typeof ob=='object'){
		tB=ob;
	}
	else{
		tB=document.getElementById(p7PBXpp);
	}
	if(!tB){
		return;
	}
	w=tB.offsetWidth;
	h=tB.offsetHeight;
	x=parseInt((wd[1]-w)/2);
	x=(x<0)?0:x;
	y=parseInt((wd[0]-h)/2);
	y=(y<0)?0:y;
	if(p7PBXopt[1]==1){
		y=p7PBXopt[2];
	}
	else if(p7PBXopt[1]==2){
		x=p7PBXopt[2];
	}
	tB.style.left=x+"px";
	tB.style.top=y+"px";
	if(p7pbxB){
		sh=document.body.parentNode.scrollHeight;
		oD=document.getElementById('p7pbx_dyn_overlay');
		h=(wd[0]>0)?wd[0]:h;
		h=(h>sh)?h:sh;
		oD.style.height=h+"px";
		oD.style.position="absolute";
	}
}
function P7_PBXwin(){
	var h,w;
	if(window.innerHeight){
		if(document.documentElement.clientWidth){
			w=document.documentElement.clientWidth;
		}
		else{
			w=window.innerWidth;
		}
		h=window.innerHeight;
	}
	else if(document.documentElement&&document.documentElement.clientHeight){
		w=document.documentElement.clientWidth;
		h=document.documentElement.clientHeight;
	}
	else if(document.body){
		w=document.body.clientWidth;
		h=document.body.clientHeight;
	}
	return [h,w];
}
function P7_PBXfadeIn(id,op){
	var im,dy=20,lm=0.99,inc,d=document.getElementById(id);
	inc=(window.opera)?0.15:0.04;
	op=(op>=lm)?lm:op;
	if(p7pbxA.indexOf("msie")>-1){
		d.style.filter='alpha(opacity='+op*100+')';
	}
	else{
		d.style.opacity=op;
	}
	if(op<lm){
		op+=inc;
		p7PBXtmr=setTimeout("P7_PBXfadeIn('"+id+"',"+op+")",dy);
	}
	else{
		if(d.style.filter){
			d.style.removeAttribute("filter");
		}
		p7PBXan=false;
		P7_PBXpos();
	}
}
function P7_PBXfadeOut(id,op){
	var im,dy=10,lm=0.01,inc,d=document.getElementById(id);
	inc=(window.opera)?0.15:0.04;
	op=(op<=lm)?lm:op;
	if(p7pbxA.indexOf("msie")>-1){
		d.style.filter='alpha(opacity='+op*100+')';
	}
	else{
		d.style.opacity=op;
	}
	if(op>lm){
		op-=inc;
		p7PBXtmr=setTimeout("P7_PBXfadeOut('"+id+"',"+op+")",dy);
	}
	else{
		d.style.display="none";
		p7PBXan=false;
		P7_PBXpos();
	}
}
function P7_PBXgrow(id,cw,ch,tw,th,cl,ct,op){
	var cD,tt,nw=0,nh=0,nl=0,nt=0,ih=16,iw=12,dy=10,lm=20,pc=0.20;
	p7PBXan=true;
	cD=document.getElementById(id);
	cD.style.height=ch+'px';
	cD.style.width=cw+'px';
	cD.style.left=cl+"px";
	cD.style.top=ct+"px";
	if(ch==th && cw==tw){
		P7_PBXpos();
		if(op==3||op==5||op==7){
			P7_PBXfadeOut(cD.id,0.99);
		}
		else{
			p7PBXan=false;
			cD.style.display='none';
		}
	}
	else{
		if(op==2||op==3){
			nh=ch+ih;
			nw=tw;
		}
		else if(op==4||op==5){
			nw=cw+iw;
			nh=ch;
		}
		else if(op==6||op==7){
			nw=cw+iw;
			if(cw==tw){
				nh=ch+ih;
			}
			else{
				nh=ch;
			}
		}
		nh=(nh>=th)?th:nh;
		nw=(nw>=tw)?tw:nw;
		nl=cl-((nw-cw)/2);
		nt=ct-((nh-ch)/2);
		p7PBXtmr=setTimeout("P7_PBXgrow('"+id+"',"+nw+","+nh+","+tw+','+th+','+nl+','+nt+','+op+")",dy);
	}
}
//Fix Firefox backButton Stupidity
if(window.addEventListener){window.addEventListener("unload",P7_FFfix,false);}
function P7_FFfix(){return;}

