if (typeof quickcolor == 'undefined') { var quickcolor = "#ffffff";}	

if (typeof backcolor == 'undefined') { var backcolor = "#1368B1";}

if (typeof textcolor == 'undefined') { var textcolor = "#2E4F71";}

if (typeof width == 'undefined') { var width = "155";}

if (typeof border == 'undefined') { var border = "1";}

if (typeof dragActive == 'undefined') { var dragActive=false }

if (typeof offsety == 'undefined') { var offsety = 10;}

if (typeof hoch == 'undefined') { var hoch = 20;}

itemh=null; offsetxakt=0; offsetyakt=0; offsetx=15; offsety=15;

ns4 = (document.layers)? true:false
ns6 = (parseInt(navigator.appVersion) >=5 && navigator.appName == "Netscape")? true:false
ie4 = (document.all)? true:false

function nix() { 
var test = 1;
}

// Microsoft Stupidity Check.
if (ie4) {
	if (navigator.userAgent.indexOf('MSIE 5')>0) {
		ie5 = true;
	} else {
		ie5 = false; }
} else {
	ie5 = false;
}
var x = 0;
var y = 0;
var snow = 0;
var sw = 0;
var cnt = 0;
var dir = 1;

if ( (ns4) || (ie4) || (ns6)) {
	if (ns4) over = document.overDiv
	if (ie4) over = overDiv.style
	if (ns6) over = document.getElementById("overDiv").style
	document.onmousemove = mouseMove
	if (ns4) document.captureEvents(Event.MOUSEMOVE)
}

// Public functions to be used on pages.

// Simple popup right
function drs(text) {
	itemh=30;
	dts(1,text);
}

// Clears popups if appropriate
function nd() {
	if ( cnt >= 1 ) { sw = 0 };
	if ( (ns4) || (ie4) || (ns6) ) {
		if ( sw == 0 ) {
			snow = 0;
			hideObject(over);
			itemh=null;
			offsetxakt=0; offsetyakt=0;
		} else {
			cnt++;
		}
	}
}

// Non public functions. These are called by other functions etc.

// Simple popup

function dts(d,text) {
	txt = "<TABLE WIDTH="+width+" cellspacing=1 cellpadding=3 BORDER=0 BGCOLOR=\""+backcolor+"\"><TR><TD class=\"cms_whiteinfo\" background=\"/img_cms/headerback.gif\"><strong>WI-CMS</strong> Info</TD></TR><TR><TD class=\"cms_info\" bgcolor=\"#ffffff\">"+text+"</TD></TR></TABLE>"
	layerWrite(txt);
	dir = d;
	disp();
}




// Rebuild 
function rebuild(text, title) {
	txt = "<TABLE WIDTH="+width+" BORDER=0 CELLPADDING="+border+" CELLSPACING=0 BGCOLOR=\""+backcolor+"\"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD height="+hoch+"><SPAN ID=\"PTT\"><B><FONT COLOR=\""+capcolor+"\">"+title+"</FONT></B></SPAN></TD><TD ALIGN=RIGHT><A HREF=\"/\" onMouseOver=\"cClick();\" ID=\"PCL\"><FONT COLOR=\""+closecolor+"\">Close</FONT></A></TD></TR></TABLE><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR=\""+fcolor+"\"><TR><TD><SPAN ID=\"PST\"><FONT COLOR=\""+textcolor+"\">"+text+"</FONT><SPAN></TD></TR></TABLE></TD></TR></TABLE>"
	layerWrite(txt);
}

// Common calls
function disp() {
	if (offsetxakt!=0) { offsetxnow=offsetxakt } else { offsetxnow=offsetx };
	if (offsetyakt!=0) { offsetynow=offsetyakt } else { offsetynow=offsety };

	if (ie4 && window.event) { x=window.event.clientX+document.body.scrollLeft; y=window.event.clientY+document.body.scrollTop; w=document.body.clientWidth; h=document.body.clientHeight }
		if ( (ns4) || (ie4) || (ns6)) {
		if (snow == 0) 	{
			if (dir == 2) { // Center
				moveTo(over,x+offsetxnow-(width/2),y+offsetynow);
			}
			if (dir == 1) { // Right
				if (w) { if (x>w-width-offsetxnow) x=w-width-offsetxnow; }
				//if (h<100) y=1-offsetynow;

				if (itemh!=null)
					{
					if (ie4) { if ((y-document.body.scrollTop)>(h-itemh)) y=(document.body.scrollTop)+h-itemh; }
					if (ns4) { if ((y-window.pageYOffset)>(h-itemh)) y=(window.pageYOffset)+h-itemh; }
					}
				moveTo(over,x+offsetxnow,y+offsetynow);
			}
			if (dir == 0) { // Left
				//if (h<100) y=1-offsetynow;
				
				if (x<width-(-offsetxnow)-15) x=width-(-offsetxnow)+15
				moveTo(over,x-offsetxnow-width,y+offsetynow);
			}
				
			showObject(over);
			snow = 1;
		}
	}
// Here you can make the text goto the statusbar.
}

// Moves the layer
function mouseMove(e) {

if (dragActive)
{
	if (mouseMoveDrag)
	{
		mouseMoveDrag(e)
		return false;
	}
}
else
{
	if (offsetxakt!=0) { offsetxnow=offsetxakt } else { offsetxnow=offsetx };
	if (offsetyakt!=0) { offsetynow=offsetyakt } else { offsetynow=offsety };
	if ((ns4 || ns6) && (e)) {x=e.pageX; y=e.pageY; w=window.innerWidth-offsetxnow; h=window.innerHeight-offsetynow}
//	if (ie4) {x=event.x; y=event.y; w=document.body.clientWidth-offsetx; h=document.body.clientHeight-offsety}
//	if (ie5) {x=event.x+document.body.scrollLeft; y=event.y+document.body.scrollTop; w=document.body.clientWidth-offsetx; h=document.body.clientHeight-offsety}
	if ((ie4) && (window.event)) {x=window.event.clientX+document.body.scrollLeft; y=window.event.clientY+document.body.scrollTop; w=document.body.clientWidth; h=document.body.clientHeight}
		if (snow) {
		if (dir == 2) { // Center
			moveTo(over,x+offsetxnow-(width/2),y+offsetynow);
		}
		if (dir == 1) { // Right
			if (x>w-width-offsetxnow) x=w-width-offsetxnow;
			//if (h<100) y=1-offsetynow	
				if (itemh!=null)
					{
					if (ie4) { if ((y-document.body.scrollTop)>(h-itemh)) y=(document.body.scrollTop)+h-itemh; }
					if (ns4) { if ((y-window.pageYOffset)>(h-itemh)) y=(window.pageYOffset)+h-itemh; }
					}
			moveTo(over,x+offsetxnow,y+offsetynow);
		}
		if (dir == 0) { // Left
			//if (h<100) y=1-offsetynow;
			
			if (x<width-(-offsetxnow)-15) x=width-(-offsetxnow)+15
			moveTo(over,x-offsetxnow-width,y+offsetynow);
		}

	}
}

}


// Writes to a layer
function layerWrite(txt) {
        if (ns4) {
                var lyr = document.overDiv.document
                lyr.write(txt)
                lyr.close()
        }
        if (ie4) document.all["overDiv"].innerHTML = txt
	if (ns6) document.getElementById("overDiv").innerHTML = txt
}

// Make an object visible
function showObject(obj) {
        if (ns4) obj.visibility = "show"
        if (ie4 || ns6) obj.visibility = "visible"
}

// Hides an object
function hideObject(obj) {
        if (ns4) obj.visibility = "hide"
        if (ie4 || ns6) obj.visibility = "hidden"
}

// Move a layer
function moveTo(obj,xL,yL) {
        obj.left = xL
        obj.top = yL
}