/********************************************************************

Popup Windows - V 4.5
Author: Brian Gosselin
Site URL: http://scriptasylum.com
Read the "releasenotes.txt" for supported features and release notes.

************** EDIT THE LINES BELOW AT YOUR OWN RISK ****************/

var w3c=(document.getElementById)? true: false;
var ns4=(document.layers)?true:false;
var ie5=(w3c && document.all)? true : false;
var ns6=(w3c && !document.all)? true: false;
var d=document;
currIDb=null; xoff=0; yoff=0;
currRS=null; rsxoff=0; rsyoff=0;
oldac=null; newac=null; zdx=1; mx=0; my=0;
var currFb=null; var currFs=null; var currFID=0; var currFcnt=0;
var cidlist=new Array();

//******* START OF EXPOSED FUNCTIONS. THESE CAN BE USED IN HYPERLINKS. *******\\

function fadeboxin(id){

if (id!='popup_e4') {
self.document.getElementById('thebanner').style.visibility='hidden'; 
if (id=='popup_e3') 
self.document.getElementById('rightplayerareadown').style.display='none'; else
self.document.getElementById('rightplayerareadown').style.display='block';

if (id=='popup_e3') {
self.document.getElementById('rightplayerareaup').style.border='0px solid #000'; 

}
else
self.document.getElementById('rightplayerareaup').style.border='1px solid #000'; 

}
else
{parent.document.getElementById('rightplayerareadown').style.display='block';
parent.document.getElementById('rightplayerareaup').style.border='1px solid #000'; 

}


if (document.getElementById('popup_e1_b')) hidebox('popup_e1');
if (document.getElementById('popup_e2_b')) hidebox('popup_e2');
if (document.getElementById('popup_e3_b')) hidebox('popup_e3');
if (document.getElementById('popup_e4_b')) hidebox('popup_e4');



if((currFb==null) && w3c){
clearInterval(currFID); 
currFb=d.getElementById(id+'_b');
document.getElementById('playerarea').appendChild(currFb);
currFb.style.overflow='hidden';
if(currFb.style.display=='none'){
currFcnt=0;
if(ie5)currFb.style.filter="alpha(opacity=0)";
else currFb.style.MozOpacity=0;
currFb.style.display='block';
changez(currFb);
currFID=setInterval('sub_fadein()',20);
}else currFb=null;
}}

function fadeboxout(id){
if((currFb==null) && w3c){
clearInterval(currFID);
currFb=d.getElementById(id+'_b');
if(currFb.style.display=='block'){
currFcnt=100;
if(ie5){
currFb.style.filter="alpha(opacity=100)";
}else{
currFb.style.MozOpacity=1;
}
currFb.style.display='block';
changez(currFb);
currFID=setInterval('sub_fadeout()',200);
}else currFb=null;
}}

function hidebox(id){
if(w3c){
//if(currFb!=d.getElementById(id+'_b')){
d.getElementById(id+'_b').style.display='none';
//}
}}



function changecontent(id,text){
if(!document.getElementById(id+'_b').isExt){
var d=document.getElementById(id+'_c');
if(ns6)d.style.overflow="hidden";
d.innerHTML=text;
if(ns6)d.style.overflow="hidden";
}else document.getElementById(id+'_ifrm').src=text;
}

function movePopup(ids,x,y){
if(w3c){
var idb=document.getElementById(ids+'_b');
var ids=document.getElementById(ids+'_s');
idb.style.left=x+'px';
ids.style.left=x+8+'px';
idb.style.top=y+'px';
ids.style.top=y+8+'px';
}}

function resizePopup(ids,rx,ry){
}

//******* END OF EXPOSED FUNCTIONS *******\\

function setAllScrollbars(ishide){
if(document.all){
var id;
for(i=0;i<cidlist.length;i++){
id=cidlist[i];
if(!document.getElementById(id+'_b').isExt)document.getElementById(id+'_c').style.overflow='hidden';
}}}

function sub_fadein(){
currFcnt+=20;
if(ie5){
currFb.style.filter="alpha(opacity="+currFcnt+")";
}else{
currFb.style.MozOpacity=currFcnt/100;
}
if(currFcnt>=99){
currFb.style.display=='block';
currFb=null;
clearInterval(currFID);
}}

function sub_fadeout(){
currFcnt=currFcnt-20;
if(ie5){
currFb.style.filter="alpha(opacity="+currFcnt+")";
}else{
currFb.style.MozOpacity=currFcnt/100;
}
if(currFcnt<=0){
currFb.style.display='none';
currFb=null;
clearInterval(currFID);
}}

function preloadBttns(){
var btns=new Array();
btns[0]=new Image(); btns[0].src="min.gif";
btns[1]=new Image(); btns[1].src="max.gif";
btns[2]=new Image(); btns[2].src="close.gif";
btns[3]=new Image(); btns[3].src="resize.gif";
}
preloadBttns();

function minimize(){
if(w3c){
d.getElementById(this.cid+"_b").style.height=(ie5)? '28px':'24px';
d.getElementById(this.cid+"_c").style.display='none';
d.getElementById(this.cid+"_rs").style.display='none';
ns6bugfix();
}}

function restore(){
if(w3c){
d.getElementById(this.cid+"_b").style.height=this.h+'px';
d.getElementById(this.cid+"_c").style.display='block';
ns6bugfix();
}}

function ns6bugfix(){
if(navigator.userAgent.indexOf("Netscape/6")>0)setTimeout('self.resizeBy(0,1); self.resizeBy(0,-1);', 100);
}

function trackmouse(evt){
if(!ns6)movepopup();
if((currIDb!=null)||(currRS!=null))return false;
}

function movepopup(){
if((currIDb!=null)&&w3c)movePopup(currIDb.cid,mx+xoff,my+yoff);
return false;
}

function stopRS(){



}

function changez(v){

}

function stopdrag(){

}

function grab_id(evt){
var ex=(ie5)?event.clientX+d.body.scrollLeft:evt.pageX;
var ey=(ie5)?event.clientY+d.body.scrollTop:evt.pageY;
xoff=parseInt(d.getElementById(this.cid+"_b").style.left)-ex;
yoff=parseInt(d.getElementById(this.cid+"_b").style.top)-ey;
currIDb=d.getElementById(this.cid+"_b");
d.getElementById(this.cid+"_extWA").style.display="block";
return false;
}

function subBox(x,y,w,h,bgc,id){
var v=d.createElement('div');
v.setAttribute('id',id);
v.style.position='absolute';
v.style.left=x+'px';
v.style.top=y+'px';
v.style.width=w+'px';
v.style.height=h+'px';
if(bgc!='')v.style.backgroundColor=bgc;
v.style.visibility='visible';
v.style.padding='0px';

return v;
}

function get_cookie(Name) {
var search=Name+"=";
var returnvalue="";
if(d.cookie.length>0){
offset=d.cookie.indexOf(search);
if(offset!=-1){
offset+=search.length;
end=d.cookie.indexOf(";",offset);
if(end==-1)end=d.cookie.length;
returnvalue=unescape(d.cookie.substring(offset,end));
}}
return returnvalue;
}

function popUp(x,y,w,h,cid,text,bgcolor,textcolor,fontstyleset,title,titlecolor,titletextcolor,bordercolor,scrollcolor,shadowcolor,showonstart,isdrag,isresize,oldOK,isExt,popOnce,minImg,maxImg,clsImg,rsImg){

var okPopUp=false;
if (popOnce){
if (get_cookie(cid)==""){
okPopUp=true;
d.cookie=cid+"=yes"
}}
else okPopUp=true;
if(okPopUp){
if(w3c){
cidlist[cidlist.length]=cid;
w=Math.max(w,100);
h=Math.max(h,80);
var rdiv=new subBox(w,h,0,0,'',cid+'_rs');
if(isresize){
rdiv.innerHTML='<img src="'+rsImg+'" width="7" height="7">';
rdiv.style.cursor='move';
rdiv.style.overflow='hidden';

}
rdiv.rsEnable=isresize;
var tw=(ie5)?w:w;
var th=(ie5)?h:h;

var outerdiv=new subBox(x,y,w,h,bordercolor,cid+'_b');


document.getElementById('playerarea').style.position='relative';
document.getElementById('playerarea').appendChild(outerdiv);


outerdiv.style.display="none";


outerdiv.style.overflow='hidden';

outerdiv.style.zIndex=++zdx;
tw=(ie5)?w-8:w-5;
th=(ie5)?h+4:h-4;
var titlebar=new subBox(0,0,0,0,titlecolor,cid+'_t');
titlebar.style.overflow="hidden";
titlebar.style.cursor="default";
var tmp=(isresize)?'<img src="'+minImg+'" width="16" height="16" id="'+cid+'_min"><img src="'+maxImg+'" width="16" height="16"  id="'+cid+'_max">':'';
titlebar.innerHTML='<span style="position:absolute; left:0px; top:0px; font:bold 10pt sans-serif; color:'+titletextcolor+'; height:18px; overflow:hidden; clip-height:16px;">'+title+'</span><div id="'+cid+'_btt" style="position:absolute; width:48px; height:16px; left:'+(tw-48)+'px; top:2px; text-align:right">'+tmp+'<img src="'+clsImg+'" width="16" height="16" id="'+cid+'_cls"></div>';
tw=(ie5)?w-7:w-13;
var content=new subBox(0,0,w,h,bgcolor,cid+'_c');
content.style.borderColor=bordercolor;
content.style.borderWidth="0px";
if(isExt){
content.innerHTML='<iframe id="'+cid+'_ifrm" src="'+text+'" width="100%" height="100%" frameborder="0" marginwidth="0" marginheight="0"></iframe>';
content.style.overflow="hidden";
}else{
content.style.border="none";
content.style.overflow="hidden";
content.style.padding="0px 0px 0px 0px";
content.innerHTML=text;
content.style.font=fontstyleset;
content.style.color=textcolor;
content.style.overflow='hidden';

}
var extWA=new subBox(0,0,0,0,'',cid+'_extWA');
extWA.style.display="none";
extWA.style.width='100%';
extWA.style.height='100%';
outerdiv.appendChild(content);
d.body.appendChild(outerdiv);
d.gEl=d.getElementById;
if(!showonstart)hidebox(cid);
var wB=d.gEl(cid+'_b');
wB.cid=cid;
wB.isExt=(isExt)?true:false;
if(isresize){
}
var wCLS=d.gEl(cid+'_cls');
var wEXTWA=d.gEl(cid+'_extWA');
if(isdrag){

}
}else{
if(oldOK){
var ctr=new Date();
ctr=ctr.getTime();
var t=(isExt)?text:'';
var posn=(ns4)? 'screenX='+x+',screenY='+y: 'left='+x+',top='+y;
var win=window.open(t , "abc"+ctr , "status=no,menubar=no,width="+w+",height="+h+",resizable="+((isresize)?"yes":"no")+",scrollbars=no,"+",statusbar=no,"+posn);
if(!isExt){
t='<html><head><title>'+title+'</title></head><body bgcolor="'+bgcolor+'"><font style="font:'+fontstyleset+'; color:'+textcolor+'">'+text+'</font></body></html>';
win.document.write(t);
win.document.close();
}}}}}

if(ns6)setInterval('movepopup()',40);

if(w3c){
d.onmousemove=trackmouse;
d.onmouseup=new Function("currRS=null");



}