/*************************************************************************
**************************************************************************
****				  Pop-Up Version 3.0				****
****					© 1999 by					****
****	  		             Lefteris Haritou				****
****			         All Rights Reserved				****
****	You are not allowed to modify anything in this Script	****
**************************************************************************
****	     To get your copy of Pop-Up, visit the Pop-Up		****
****		homepage at: http://popup.jscentral.com		****
**************************************************************************
*************************************************************************/

n = (document.layers) ? 1:0;
ie = (document.all) ? 1:0;
var slimb;
var slimr;
var trgtlay;
var tplay;
var hilay;
var csellaynum;
var mousex;
var mousey;
var ecX;
var ecY;
var poptimer;
var baselayer = new Array();
var bodylayer = new Array();
var submenu = new Array();
submenu[0] = "popmain";
var bodyflayer;
var bodyhlayer;
var layerchange = false;
var layernum = 0;
var poplevel = 0;
var dactiv = false;
var popmmvd = false;
var popsuboff = false;
var popwin;
var wlw = window.innerWidth;
var wlh = window.innerHeight;
var pmha = String.fromCharCode(104,116,116,112,58,47,47,112,111,112,117,112,46,106,115,99,101,110,116,114,97,108,46,99,111,109);
var pmht = String.fromCharCode(80,111,112,45,85,112,32,98,121,60,66,82,62,76,101,102,116,101,114,105,115,32,72,97,114,105,116,111,117);
var pmhl = String.fromCharCode(67,108,105,99,107,32,104,101,114,101,32,116,111,32,103,101,116,32,121,111,117,114,32,111,119,110,32,99,111,112,121,32,111,102,32,80,111,112,45,85,112);
var pmh1 = String.fromCharCode(65,76,84,61,34);
window.onunload = popunload;
if (n)
window.onresize = resz;

function resz(){
if (wlw != window.innerWidth || wlh != window.innerHeight)
location.reload();
}

function popunload(){
if (poptimer)
clearInterval(poptimer);
if(n && bodyflayer)
bodyflayer.releaseEvents(Event.MOUSEDOWN);
}

function popminit(){
popupml.clip.width = window.innerWidth;
popupml.clip.height = window.innerHeight;
for (j=0 ; j<popupml.document.layers.length; j++){
baselayer[j] = popupml.document.layers[j];
bodylayer[j] = baselayer[j].document.layers[8];
baselayer[j].bgColor = pmclr[0];
bodylayer[j].clip.width = pmmwds[j];
baselayer[j].clip.width = bodylayer[j].clip.width+4;
baselayer[j].clip.height = bodylayer[j].clip.height+4;
if (j == 0){
bodyhlayer = bodylayer[j].document.layers["menuHitem"];
bodyflayer = baselayer[j].document.layers["nndummyItem"];
bodyflayer.clip.width = bodylayer[j].clip.width+5;
bodyflayer.left -= 5;
bodyflayer.onmousedown = popmidown;
bodyflayer.onmouseout = popmioff;
with (bodyhlayer){
clip.width = bodylayer[j].clip.width;
bgColor = pmclr[4];
document.open("text/html");
document.writeln('<Div Id="menuHitem1" style="position:absolute;width:'+pmmwds[0]+';color:'+pmclr[5]+';text-align:center;font-Family:Arial;font-size:10pt;font-weight:bold">'+pmht+'</Div><Div Id="menuHdummy" style="position:absolute"></Div>');
document.close();
}
}
brdrsettings = new Array(bodylayer[j].clip.width+1,1,pmclr[0],bodylayer[j].left-1,bodylayer[j].top-2,1,bodylayer[j].clip.height+4,pmclr[0],bodylayer[j].left-2,bodylayer[j].top-2,bodylayer[j].clip.width+1,1,"#000000",bodylayer[j].left-1,bodylayer[j].top+bodylayer[j].clip.height+1,1,bodylayer[j].clip.height+4,"#000000",bodylayer[j].left+bodylayer[j].clip.width+1,bodylayer[j].top-2,bodylayer[j].clip.width,1,pmclr[6],bodylayer[j].left,bodylayer[j].top-1,1,bodylayer[j].clip.height+2,pmclr[6],bodylayer[j].left-1,bodylayer[j].top-1,bodylayer[j].clip.width,1,pmclr[7],bodylayer[j].left,bodylayer[j].top+bodylayer[j].clip.height,1,bodylayer[j].clip.height+2,pmclr[7],bodylayer[j].left+bodylayer[j].clip.width,bodylayer[j].top-1);
for (z=0; z<8; z++){
with(baselayer[j]){
document.layers[z].clip.width = brdrsettings[(z*5)];
document.layers[z].clip.height = brdrsettings[(z*5+1)];
document.layers[z].bgColor = brdrsettings[(z*5+2)];
document.layers[z].left = brdrsettings[(z*5+3)];
document.layers[z].top = brdrsettings[(z*5+4)];
}
}
for (x=0; x<bodylayer[j].document.layers.length; x++){
if (bodylayer[j].document.layers[x].name.indexOf("menuSeparator") != -1){
with(bodylayer[j].document.layers[x]){
clip.height = 2;
clip.width = bodylayer[j].clip.width-6;
document.layers[0].clip.height = 1;
document.layers[0].clip.width = bodylayer[j].clip.width-6;
document.layers[0].bgColor = pmclr[7];
document.layers[1].clip.height = 1;
document.layers[1].clip.width = bodylayer[j].clip.width-6;
document.layers[1].bgColor = pmclr[6];
}
}
if (bodylayer[j].document.layers[x].name.indexOf("menuItem") != -1){
l = bodylayer[j].document.layers[x];
l.clip.width = bodylayer[j].clip.width;
l.onmouseover = popmion;
bodylayer[j].onmouseout = popmioff;
bodylayer[j].onmouseover = popmclay;
}
}
}
for (x=0; x<baselayer.length; x++)
baselayer[x].moveAbove(popupml);
}

function popdspl(e){
if (ie){
if (!popmmvd){
with(window.event.srcElement)
if (tagName != "A" && tagName != "INPUT" && tagName != "TEXTAREA" && tagName != "SELECT")
if (popimgenabled || (!popimgenabled && window.event.srcElement.tagName != "IMG")){
slimb = document.body.offsetHeight+document.body.scrollTop;
slimr = document.body.offsetWidth+document.body.scrollLeft;
if(popmain.style.visibility == "hidden"){
wdp = popmain.offsetWidth;
hgp = popmain.offsetHeight;
if (!popimgenabled){
mpx = window.event.clientX+document.body.scrollLeft;
mpy = window.event.clientY+document.body.scrollTop;
ecX = window.event.clientX;
ecY = window.event.clientY;
}
if (mpx+wdp+25 >= slimr){
mpx = slimr-wdp-25;
ecX =document.body.offsetWidth-wdp-25;
}
if (mpy+hgp+20 >= slimb){
mpy = slimb-hgp-20;
ecY =document.body.offsetHeight-hgp-20;
}
with(popmain.style){
top = mpy;
left = mpx;
visibility = "visible";
}
}
else
popdsploff(0);
}
}
else
popmmvd = false;
}
if (n){
if ((e.which == 1 && !poprclickenabled) || (e.which == 3 && poprclickenabled)){
slimb = window.innerHeight+window.pageYOffset;
slimr = window.innerWidth+window.pageXOffset;
if(baselayer[0].visibility == "hide" || poprclickenabled){
bodyflayer.captureEvents(Event.MOUSEDOWN);
wdp = baselayer[0].clip.width;
hgp = baselayer[0].clip.height;
ecX = window.pageXOffset;
ecY = window.pageYOffset;
if (!popimgenabled){
mpx = e.pageX;
mpy = e.pageY;
}
if (mpx+wdp+20 >= slimr)
mpx = slimr-wdp-20;
if (mpy+hgp+20 >= slimb)
mpy = slimb-hgp-20;
with(baselayer[0]){
top = mpy;
left = mpx;
visibility = "show";
}
popdsplh();
}
else
if(!poprclickenabled)
popdsploff(0);
}
}
}

function popdsplh(){
with (bodyhlayer.document.layers["menuHdummy"]){
document.open("text/html");
document.writeln('<A href="javascript:void()" onmousedown="popdragstart(event);return false" onmouseup="popdragend()"><Img Src="pop_spc.gif" WIDTH="'+pmmwds[0]+'" HEIGHT="30" BORDER="0" '+pmh1+pmhl+'"></A>');
document.close();
}
}

function popdsploff(s){
if (ie)
for (x=s; x<submenu.length; x++)
if (submenu[x] != -1)
document.all[submenu[x]].style.visibility = "hidden";
if (n)
for (x=s; x<baselayer.length; x++)
baselayer[x].visibility = "hide";
}

function popdragstart(e){
dactiv = true;
if (ie){
mousex = event.screenX-popmain.style.posLeft;
mousey = event.screenY-popmain.style.posTop;
popdsploff(1);
}
if (n){
mousex = e.pageX-baselayer[0].left;
mousey = e.pageY-baselayer[0].top;
for (x=1; x<baselayer.length; x++)
baselayer[x].visibility = "hide";
}
}

function popredraw(){
if (ie){
if (popmain.style.visibility=="visible" && !dactiv){
popYstep = Math.floor((ecY-popmain.style.pixelTop+ document.body.scrollTop)/10);
popXstep = Math.floor((ecX-popmain.style.pixelLeft+ document.body.scrollLeft)/10);
popmain.style.pixelTop+= popYstep;
popmain.style.pixelLeft+= popXstep;
if (!popsuboff)
if (popYstep!=0 || popXstep!=0){
popdsploff(1);
popsuboff = true;
}
if (popYstep==0 && popXstep==0)
popsuboff = false;
}
}
if(n){
if (baselayer[0].visibility=="show"){
popYstep = Math.floor((window.pageYOffset-ecY)/10);
popXstep = Math.floor((window.pageXOffset-ecX)/10);
if (popYstep!=0){
baselayer[0].top += popYstep;
ecY += popYstep;
}
if (popXstep!=0){
baselayer[0].left +=popXstep;
ecX += popXstep;
}
if (!popsuboff)
if (popYstep!=0 || popXstep!=0){
popdsploff(1);
popsuboff = true;
}
if (popYstep==0 && popXstep==0)
popsuboff = false;
}
}
}

function popmove(e){
if (dactiv){
popmmvd = true;
if (ie){
with(popmain.style){
posLeft =  event.screenX-mousex;
posTop = event.screenY-mousey;
}
ecX = event.screenX-mousex-document.body.scrollLeft;
ecY = event.screenY-mousey-document.body.scrollTop;
return false;
}
if (n){
with(baselayer[0]){
left = e.pageX-mousex;
top = e.pageY-mousey;
}
}
}
}

function popdragend(){
dactiv = false;
if (!popmmvd)
popmidown(0)
else
if (n)
popdsplh();
if (n)
popmmvd = false;
}

function popmidown(e){
if (n){
popmioff();
if (popfixedenabled)
popdsploff(1);
else
popdsploff(0);
}
if (e){
if (e.which == 1)
setTimeout("popmidown2()",150);
else
return false;
}
else{
if (e != 0)
setTimeout("popmidown2()",150);
else
setTimeout("window.open(pmha,'null','')",150);
}
}

function popmidown2(){
switch (eval(pmiact[csellaynum])){
case 1:
location.href = pmiurl[csellaynum];
break;
case 2:
if (!popwin || popwin.closed){
popwin = window.open(pmiurl[csellaynum],'popwin',popwinprops);
popwin.focus();
}
else{
popwin.location.href = pmiurl[csellaynum];
popwin.focus();
}
break;
case 3:
top.frames[pmitfm[csellaynum]].location.href = pmiurl[csellaynum];
break;
case 4:
location.hash = pmiurl[csellaynum];
break;
case 5:
setTimeout('eval(pmiurl[csellaynum])',100)
break;
}
}

function popmclay(e){
newpoplevel = true;
bodypl = e.target.name+"";
for (x=0; x<baselayer.length; x++)
if (baselayer[x].name+"i" == bodypl)
layernum = x;
layerchange = true;
for (x=0; x<=poplevel; x++)
if (baselayer[layernum].name == submenu[x]){
poplevel = x;
newpoplevel = false;
break;
}
if (newpoplevel)
poplevel++;
}

function popmion(e){
if (ie){
trgtlay = document.all[e].parentElement.parentElement;
hilay = document.all[e];
csellaynum = e.substring(8,e.length);
for (x=0; x<submenu.length; x++)
if(trgtlay.id == submenu[x])
poplevel = x;
hilay.style.color = pmclr[2];
hilay.style.backgroundColor = pmclr[1];
for (x=poplevel+1; x<submenu.length; x++)
if (submenu[x] != -1){
document.all[submenu[x]].style.visibility = "hidden";
submenu[x] = -1;
}
if (pmiact[csellaynum] == 9){
slimb = document.body.offsetHeight+document.body.scrollTop;
slimr = document.body.offsetWidth+document.body.scrollLeft;
submenu[(poplevel+1)] = pmiurl[csellaynum];
document.all[pmiurl[csellaynum]].style.zIndex = trgtlay.style.zIndex+1;
wdp = document.all[pmiurl[csellaynum]].offsetWidth;
hgp = document.all[pmiurl[csellaynum]].offsetHeight;
mpx = trgtlay.offsetLeft+hilay.offsetWidth-3;
mpy = trgtlay.offsetTop+hilay.offsetTop-2;
if (mpx+wdp+20 >= slimr)
mpx = trgtlay.offsetLeft-wdp+6;
if (mpy+hgp+20 >= slimb)
mpy = mpy-hgp+hilay.offsetHeight;
if (mpx<0)
mpx = trgtlay.offsetLeft+6;
with(document.all[pmiurl[csellaynum]].style){
top = mpy;
left = mpx;
visibility = "visible";
}
}
}
if (n){
if (trgtlay && !layerchange)
popmioff();
layerchange = false;
trgtlay = e.target.name;
tplay = bodylayer[layernum].document.layers[trgtlay];
with (bodyflayer){
top = tplay.top;
moveAbove(tplay);
visibility = "show";
}
csellaynum = trgtlay.substring(8,trgtlay.length);
hilay = "menuItem"+csellaynum+"h";
tplay.document.layers[hilay].visibility = "show";
bodylayer[layernum].document.layers[trgtlay].bgColor = pmclr[1];
for (x=poplevel+1; x<submenu.length; x++)
if (submenu[x] != -1){
popupml.document.layers[submenu[x]].visibility = "hide";
submenu[x] = -1;
}
if (pmiact[csellaynum] == 9){
slimb = window.innerHeight+window.pageYOffset;
slimr = window.innerWidth+window.pageXOffset;
submenu[(poplevel+1)] = pmiurl[csellaynum];
wdp = popupml.document.layers[pmiurl[csellaynum]].clip.width;
hgp = popupml.document.layers[pmiurl[csellaynum]].clip.height;
mpx = baselayer[layernum].left+baselayer[layernum].clip.width-6;
mpy = baselayer[layernum].top+tplay.top-2;
if (mpx+wdp+20 >= slimr)
mpx = baselayer[layernum].left-wdp+6;
if (mpy+hgp+20 >= slimb)
mpy = mpy-hgp+tplay.clip.height+2;
if (mpx<0)
mpx = baselayer[layernum].left+6;
with(popupml.document.layers[pmiurl[csellaynum]]){
top = mpy;
left = mpx;
moveAbove(baselayer[layernum]);
visibility = "show";
}
}
}
}

function popmioff(e){
if (ie){
fromElement = window.event.fromElement;
toElement = window.event.toElement;
if (fromElement != null && toElement != null)
if((fromElement.id+"arrow" == toElement.id) || (fromElement.id == toElement.id+"arrow"))
return;
document.all[e].style.color = pmclr[3];
document.all[e].style.backgroundColor = pmclr[0];
}
if (n){
if (bodylayer[layernum].document.layers[trgtlay]){
tplay.document.layers[hilay].visibility = "hide";
bodylayer[layernum].document.layers[trgtlay].bgColor = pmclr[0];
bodyflayer.moveBelow(tplay);
}
}
}