/*

Graculini's Popup Engine - GPE v1.0

Copyright© Gracjan Lech 2003.

Contact me: gracjan.lech@poczta.fm

This notice must remain untouched at all times.



*/



function displayConfig() {

//KONFIGURACJA START



//Odstęp popup'a od kursora w poziomie

if ((popupOffsetX=getValue("popupOffsetX"))==NA)

popupOffsetX=20

//Odstęp popup'a od kursora w pionie

if ((popupOffsetY=getValue("popupOffsetY"))==NA)

popupOffsetY=20

//Położenie popup'a względem myszki

if ((popupAlign=getValue("popupAlign"))==NA)

popupAlign="right" //Inne opcje - left, center

//Długość popup'a

if ((popupWidth=getValue("popupWidth"))==NA)

popupWidth=300

//Szerokość obramowania całego popup'a

if ((popupBorderWidth=getValue("popupBorderWidth"))==NA)

popupBorderWidth="1px"

//Kolor obramowania popup'a

if ((popupBorderColor=getValue("popupBorderColor"))==NA)

popupBorderColor="#ffc344"

//Styl obramowania popup'a (dotted, double...)

if ((popupBorderStyle=getValue("popupBorderStyle"))==NA)

popupBorderStyle="solid"

//Domyślna przeźroczystość popup'a

if ((popupOpacity=getValue("popupOpacity"))==NA)

popupOpacity=80

//Kolor czcionki nagłówka

if ((captionColor=getValue("captionColor"))==NA)

captionColor="#B5DE21"

//Styl czcionki nagłówka

if ((captionFontStyle=getValue("captionFontStyle"))==NA)

captionFontStyle="normal"

//Pogrubienie czcionki nagłówka

if ((captionFontWeight=getValue("captionFontWeight"))==NA)

captionFontWeight="normal"

//Wielkość czcionki nagłówka

if ((captionFontSize=getValue("captionFontSize"))==NA)

captionFontSize="9px"

//Czcionka nagłówka

if ((captionFontFamily=getValue("captionFontFamily"))==NA)

captionFontFamily="Verdana, sans-serif"

//Wypełnienie ogólne

if ((captionPadding=getValue("captionPadding"))==NA)

captionPadding="0px";

//Kolor tła nagłówka

if ((captionBackgroundColor=getValue("captionBackgroundColor"))==NA)

captionBackgroundColor=popupBorderColor

//Tło nagłówka

if ((captionBackgroundImage=getValue("captionBackgroundImage"))==NA)

captionBackgroundImage=""

//Dodatki do tła

if ((captionBackgroundImageProperties=getValue("captionBackgroundImageProperties"))==NA)

captionBackgroundImageProperties=""

//Kolor czcionki tekstu

if ((textColor=getValue("textColor"))==NA)

textColor="#333333"

//Styl czcionki tekstu

if ((textFontStyle=getValue("textFontStyle"))==NA)

textFontStyle="normal"

//Pogrubienie czcionki tekstu

if ((textFontWeight=getValue("textFontWeight"))==NA)

textFontWeight="normal"

//Wielkość czcionki tekstu

if ((textFontSize=getValue("textFontSize"))==NA)

textFontSize="10px"

//Czcionka tekstu

if ((textFontFamily=getValue("textFontFamily"))==NA)

textFontFamily="Verdana"

//Wypełnienie ogólne

if ((textPadding=getValue("textPadding"))==NA)

textPadding="2px";

//Kolor tła tekstu

if ((textBackgroundColor=getValue("textBackgroundColor"))==NA)

textBackgroundColor="#FFFFFF"

//Tło tekstu

if ((textBackgroundImage=getValue("textBackgroundImage"))==NA)

textBackgroundImage="http://www.nast.ws/javascript/tlo.gif"

//Dodatki do tła

if ((textBackgroundImageProperties=getValue("textBackgroundImageProperties"))==NA)

textBackgroundImageProperties=""

//fadeIn

if ((fadeIn=params.indexOf("fadeIn"))!=-1)

fadeIn=true

//Domyślny czas fadeIn

if (fadeIn && ((fadeInTime=getValue("fadeInTime"))==NA))

fadeInTime=1

//fadeOut

if ((fadeOut=params.indexOf("fadeOut"))!=-1)

fadeOut=true

//Domyślny czas fadeOut

if (fadeOut && ((fadeOutTime=getValue("fadeOutTime"))==NA))

fadeOutTime=1



//DODATKOWE SZATY



layout[1]="textBackgroundColor: #ffffe1; popupBorderColor: #000000; textFontFamily: verdana; textFontSize: 11px;"

layout[2]="textFontStyle: italic;"



//KONFIGURACJA KONIEC

}



document.write("<div id=\"popupDiv\" style=\"position: absolute; display: none; z-index: 1000; filter: alpha(opacity=100); -moz-opacity: 1;\">GPE v1.1 - popup engine</div>")

popup=document.getElementById("popupDiv")

OP=NS=IE=false

if (navigator.userAgent.indexOf("Opera")!=-1) OP=true

else if (navigator.appName=="Netscape") NS=true

else if (navigator.appName=="Microsoft Internet Explorer") IE=true



function gpe(arguments) {

fadingIn=false

fadeOut=false

params=arguments

layout=new Array()

captionClass=getValue("captionClass")

caption=getValue("caption")

textClass=getValue("textClass")

text=getValue("text")

popupLayout=getValue("popupLayout")

if (popupLayout!=null) params+=grabLay()

NA=null

displayConfig()

if (popupBorderColor==NA && captionBackgroundColor!=NA) popupBorderColor=captionBackgroundColor

po=eval(popupOpacity)

if (NS) NSpo=(po/100)

if (textBackgroundImage!=null) textBackgroundImage="url('"+textBackgroundImage+"') "+textBackgroundImageProperties+""

if (captionBackgroundImage!=null) captionBackgroundImage="url('"+captionBackgroundImage+"') "+captionBackgroundImageProperties+""

popupContent="<table cellpadding=0 cellspacing=0 style=\"width: "+popupWidth+"; border: "+popupBorderWidth+" "+popupBorderStyle+" "+popupBorderColor+";\">"

if (caption!=NA) {

popupContent+="<tr><td "

if (captionClass==null) popupContent+="style=\"color: "+captionColor+"; font: "+captionFontStyle+" "+captionFontWeight+" "+captionFontSize+" "+captionFontFamily+"; padding: "+captionPadding+"; background: "+captionBackgroundColor+" "+captionBackgroundImage+";\""

else popupContent+="class=\""+captionClass+"\""

popupContent+=">"+caption+"</td></tr>"

}

popupContent+="<tr><td "

if (textClass==null) popupContent+="style=\"color: "+textColor+"; font: "+textFontStyle+" "+textFontWeight+" "+textFontSize+" "+textFontFamily+"; padding: "+textPadding+"; background: "+textBackgroundColor+" "+textBackgroundImage+";\""

else popupContent+="class=\""+textClass+"\""

popupContent+=">"+text+"</td></tr></table>"

if (NS) {

content=document.createRange();

content.setStartBefore(popup);

content=content.createContextualFragment(popupContent);

with (popup) {

if (hasChildNodes()) removeChild(lastChild)

appendChild(content)

}

}

else popup.innerHTML=popupContent

pO(po)

if (IE) gpePos()

document.onmousemove=function gpePos(evt) {

if (NS) {

coordX=evt.pageX

coordY=evt.pageY

winWidth=innerWidth

}

else {

coordX=event.clientX+document.body.scrollLeft

coordY=event.clientY+document.body.scrollTop

winWidth=document.body.clientWidth

}

switch (popupAlign) {

case "left" :

if (coordX-popupWidth-popupOffsetX<0) coordX=popupWidth+popupOffsetX

coordX-=popupWidth+(popupOffsetX*2)

break

case "center" :

if (coordX+popupWidth/2>winWidth) {coordX=winWidth-popupWidth/2; popupOffsetX=0}

if (coordX-popupWidth/2<0) {coordX=popupWidth/2; popupOffsetX=0}

coordX-=popupWidth/2+popupOffsetX

break

case "right" :

if (coordX+popupWidth+popupOffsetX>winWidth) coordX=winWidth-popupWidth-popupOffsetX

}

popup.style.left=coordX+popupOffsetX

popup.style.top=coordY+popupOffsetY

}

popup.style.display="block"

if (fadeIn==true) {

pO(0)

fade(1)

}

popup.style.display="block"

document.onmouseout=function() {

if (fadeOut==true) {

if (fadeIn) fadeIn=false

else pO(po)

fade(2)

}

else popup.style.display="none"

}

}

function getValue(keyWord) {

with (params) {

if (indexOf(keyWord+":")==-1) return

keyInd=lastIndexOf(keyWord+":")

value=substring(keyInd+(keyWord.length+1),indexOf(";",keyInd))

}

while (value.indexOf("|:|")!=-1) {

with (value) {

value=substring(0,indexOf("|:|"))+";"+substring(indexOf("|:|")+3)

}

}

while (value.indexOf(" ")!=-1 && keyWord!="text" && keyWord!="caption") {

with (value) {

value=substring(0,indexOf(" "))+substring(indexOf(" ")+1)

}

}

if (keyWord=="popupOffsetX" || keyWord=="popupOffsetY" || keyWord=="popupWidth") {

value=eval(value)

}

return value

}

function grabLay() {

layParam=displayConfig+""

with (layParam) {

layParam=substring(indexOf("layout["+popupLayout+"]"),indexOf(";\"",indexOf("layout["+popupLayout+"]"))+1)

}

return layParam;

}

function fade(num) {

if (num==1 && fadeIn==true) {

if (pO()!=po) {

pO(2,"+")

fadingIn=setTimeout("fade(1)",fadeInTime)

}

else fadeIn=false

}

if (num==2 && fadeOut==true) {

if (pO()!=0) {

pO(2,"-")

fadingOut=setTimeout("fade(2)",fadeOutTime)

}

else {

fadeOut=false

if (NS==false && IE==false) popup.style.display="none"

}

}

}

function pO(oL,op) {

if (IE) {

with (popup.filters.alpha) {

if (oL==NA) return opacity

if (op==NA) opacity=oL

if (op=="+") {

if (opacity>=po) opacity=po

else opacity+=oL

}

if (op=="-") opacity-=oL

}

}

else if (NS) {

with (popup.style) {

if (oL==NA) return MozOpacity

else oL=(oL/100)

if (op==NA) MozOpacity=oL

if (op=="+") {

if (MozOpacity>=NSpo) MozOpacity=NSpo

else MozOpacity=parseFloat(MozOpacity)+oL

}

if (op=="-") MozOpacity=parseFloat(MozOpacity)-oL

}

}

else return false

}