/********************************************************************

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 ns4=(document.layers)?true:false;
var ie5=(document.all)? true : false;
var ns6=(!document.all)? true: false;
currIDb=null; xoff=0; yoff=0;
oldac=null; newac=null; zdx=1; mx=0; my=0;
var cidlist=new Array();

//******* START OF EXPOSED FUNCTIONS. THESE CAN BE USED IN HYPERLINKS. *******\\

function hidebox(id){
document.getElementById(id+'_b').style.display='none';
}

function showbox(id){
var bx=document.getElementById(id+'_b');
bx.style.display='block';
bx.style.zIndex=++zdx;
if(ns6){
bx.style.MozOpacity=1;
}else{
bx.style.filter="alpha(opacity=100)";
}
changez(bx);
}

/*
function showbox(id,text){
var cx=document.getElementById(id+'_c');
cx.innerHTML=text;
var bx=document.getElementById(id+'_b');
bx.style.display='block';
bx.style.zIndex=++zdx;
if(ns6){
bx.style.MozOpacity=1;
}else{
bx.style.filter="alpha(opacity=100)";
}
changez(bx);
}
*/

function movePopup(ids,x,y){
var idb=document.getElementById(ids+'_b');
idb.style.left=x+'px';
idb.style.top=y+'px';
}

//******* END OF EXPOSED FUNCTIONS *******\\


function ns6bugfix(){
if(navigator.userAgent.indexOf("Netscape/6")>0)setTimeout('self.resizeBy(0,1); self.resizeBy(0,-1);', 100);
}

function trackmouse(evt){
mx=(ie5)?event.clientX+document.body.scrollLeft:evt.pageX;
my=(ie5)?event.clientY+document.body.scrollTop:evt.pageY;
if(!ns6)movepopup();
if((currIDb!=null))return false;
}

function movepopup(){
if((currIDb!=null))movePopup(currIDb.cid,mx+xoff,my+yoff);
return false;
}

function changez(v){
var th=(v!=null)?v:this;
if(oldac!=null)document.getElementById(oldac.cid+"_t").style.backgroundColor=oldac.inactivecolor;
if(ns6)document.getElementById(th.cid+"_c").style.overflow='auto';
oldac=th;
document.getElementById(th.cid+"_t").style.backgroundColor=th.activecolor;
th.style.zIndex=++zdx;
}

function stopdrag(){
currIDb=null;
ns6bugfix();
}

function grab_id(evt){
var ex=(ie5)?event.clientX+document.body.scrollLeft:evt.pageX;
var ey=(ie5)?event.clientY+document.body.scrollTop:evt.pageY;
xoff=parseInt(document.getElementById(this.cid+"_b").style.left)-ex;
yoff=parseInt(document.getElementById(this.cid+"_b").style.top)-ey;
currIDb=document.getElementById(this.cid+"_b");
return false;
}

function popUp(cid,title,text,showonstart,clsImg){

cidlist[cidlist.length]=cid;

var outerdiv=document.createElement('div');
outerdiv.setAttribute('id',cid+'_b');
outerdiv.style.position='absolute';
outerdiv.style.left='100px';
outerdiv.style.top='100px';
outerdiv.style.border='2px outset gray';
outerdiv.style.padding='0px';
outerdiv.style.display='block';
outerdiv.style.backgroundColor='#DFDCB5';
outerdiv.style.zIndex=++zdx;

var titlebar=document.createElement('div');
titlebar.setAttribute('id',cid+'_t');
titlebar.style.backgroundColor='#999967';
titlebar.style.fontWeight='bold';
titlebar.innerHTML='<div style="float:left;height:20px;padding:2px 2px ">'+title+'</div><div style="text-align:right"><img src="'+clsImg+'" width="16" height="16" id="'+cid+'_cls"></div><div style="clear:both"></div>';

var content=document.createElement('div');
content.setAttribute('id',cid+'_c');
content.style.border='2px inset gray';
if(ie5)content.style.scrollbarBaseColor="gray";
content.innerHTML=text;

outerdiv.appendChild(titlebar);
outerdiv.appendChild(content);

document.body.appendChild(outerdiv);

if(!showonstart)hidebox(cid);
var wB=document.getElementById(cid+'_b');
wB.cid=cid;
var wT=document.getElementById(cid+'_t');
wT.cid=cid;

var wCLS=document.getElementById(cid+'_cls');

wB.activecolor="#999967";
wB.inactivecolor="#DFDCB5";
if(oldac!=null)document.getElementById(oldac.cid+"_t").style.backgroundColor=oldac.inactivecolor;
oldac=wB;
wCLS.onclick=new Function("hidebox('"+cid+"');");
wB.onmousedown=function(){ changez(this) }
wT.onmousedown=grab_id;
wT.onmouseup=stopdrag;
}

if(ns6)setInterval('movepopup()',40);

document.onmousemove=trackmouse;


/***********************************************
* Fixed ToolTip script- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
		
var tipwidth='150px' //default tooltip width
var tipbgcolor='#E7E4D4'  //tooltip bgcolor
var disappeardelay=800  //tooltip disappear speed onMouseout (in miliseconds)
var vertical_offset="0px" //horizontal offset of tooltip from anchor link
var horizontal_offset="-50px" //horizontal offset of tooltip from anchor link

/////No further editting needed

var ie4=document.all
//var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="fixedtipdiv" style="visibility:hidden;width:'+tipwidth+';background-color:'+tipbgcolor+'" ></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, tipwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (tipwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=tipwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

//KS: added
function fixedtooltipshow(){
obj=document.getElementById? document.getElementById("fixedtipdiv") : fixedtipdiv
obj.style.visibility='visible'
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
}
return edgeoffset
}

function fixedtooltip(menucontents, obj, e, tipwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidetip()
dropmenuobj=document.getElementById? document.getElementById("fixedtipdiv") : fixedtipdiv
dropmenuobj.innerHTML=menucontents

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", tipwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}
}

function hidetip(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidetip(){
if (ie4||ns6)
delayhide=setTimeout("hidetip()",disappeardelay)
}

function clearhidetip(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

