EX_Script=true;

// __________________________________________________
// 	DHTML BROWSER & STYLE SHEET DETECTION.

// Finally, check that the browser is not Opera.
var BV4=((NS4 || IE4) && (navigator.userAgent.indexOf("Opera") == -1)) ? true : false;

function LIB_VersionFourCheck() {
	// If the browser is IE4 set "CSS" to true.
	// If it is NS4 and it detects "document.panel" (the navigation panel!) set "CSS" to true.
	var CSS=((NS4 && document.panel) || IE4) ? true : false;
	
	if (BV4 && (!CSS)) {
		// Cannot be IE4 (BV4 equals true and CSS equals true!) so must be NS4 but style sheets are off!
		// So display an alert box to tell the user!
		alert('It appears that you have disabled style sheets in your browsers preferences.\nBecause of this the expanding menus will not work!\n\n' +
			'To turn them on again:\n\n\tSelect "Preferences" from the "Edit" menu...\n\tclick on the category "Advanced"...' + 
			'\n\tclick in the box by "Enable style sheets"...\n\tthen reload the page!');
	}
	// So this function now returns true if the browser is IE4  OR  is NS4 with style sheets enabled.
	// Or it returns false...
	return (BV4 & CSS) ? true : false;
}

/*
 	CROSS-BROWSER LIBRARY... 
*/

/* #################################################################################### */
/* GET... GET... GET... GET... GET... GET... GET... GET... GET... GET... GET... GET... GET... GET... GET... GET... GET... GET... GET... GET...*/
/* #################################################################################### */

// CO-ORDINATE ARRAYS(Shortcuts!) for LIB.JS
function getLib_SC_Win() { return new Array(getLib_WindowWidth(),getLib_WindowHeight()); }
function getLib_SC_Scroll() { return new Array(getLib_PageScrollLeft(),getLib_PageScrollTop()); }

function getLib_WindowWidth() { return (NS4) ? window.innerWidth-16 : document.body.clientWidth; } //(See Note 1.)
function getLib_WindowHeight() { return (NS4) ? window.innerHeight : document.body.clientHeight; }

// Note 1. 	 -16 allows for the v. scrollbar in NS4 - IE4 detects this & adjusts value accordingly - NS4 does not!

function getLib_PageScrollLeft() { return (NS4) ? window.pageXOffset : document.body.scrollLeft; }
function getLib_PageScrollTop() { return (NS4) ? window.pageYOffset : document.body.scrollTop; }

function getLib_TopZindex() { var DD=new Array();(NS4) ? DD=document.layers : DD=document.all.tags("DIV"); var tZ=0; for (var i=0; i < DD.length; i ++ ) { var zIndex=(NS4) ? DD[i].zIndex : DD[i].style.zIndex; tZ=(zIndex > tZ) ? zIndex : tZ; } return tZ; }

function setLib_ElementMoveTo(id,X,Y) { if (NS4) { eval("document."+id).moveTo(X,Y); } else { eval("document.all."+id).style.pixelLeft=X; eval("document.all."+id).style.pixelTop=Y; } }

function setLib_ElementZindex(id,val) {(NS4) ? eval("document."+id).zIndex=val : eval("document.all."+id).style.zIndex=val; }

function setLib_Timer(Is,command,interval) { if (Is == 0) { setTimeout(eval('"'+command+'"'),interval); } if (Is == 1) { setInterval(eval('"'+command+'"'),interval); } }


// __________________________________________________
// 	NS4 RESIZE FIX.

// Fixes a bug in NS4 where the window is not redrawn on a resize.

if (document.layers) {
	var NSrfix_origW=innerWidth;
	var NSrfix_origH=innerHeight;
	onResize=ReSizeFix;
}

function ReSizeFix() {
	if (innerWidth != NSrfix_origW || innerHeight != NSrfix_origH) {
		location.reload();
	}
}
// __________________________________________________


/*
 	FUNCTIONS LIBRARY... 
*/

/* #################################################################################### */
// Create a DHTML image object.
function Lib_Img(I,U,W,H,A,X,Y,V,Z,L,P1,P2) {
	
	// id, src, width, height, alt txt, abs pos left of window, & top of window, visibility, Z index, link URL, parameters 1 & 2 passed to "onclick" handler.

	var Viz=(V) ? 'visible' : 'hidden';
	var Itmp='';
	
	if (X != null) {
		Itmp +='<style type="text/css">';
		Itmp +='<!--';
		Itmp +='#'+I+' { position: absolute; visibility: '+Viz+'; left: '+X+'; top: '+Y+'; width: '+W+'; z-index:'+Z+'}';
		Itmp +='-->';
		Itmp +='<\/style>';
	}
	
	Itmp +='<div id="'+I+'">';
	
	if (L != null) { 
		if (L == "js") Itmp +='<a href="javascript:'+"handleImageClick('"+I+"'"+','+P1+','+P2+')">';
		else Itmp +='<a href="'+L+'">';
	}
	
	Itmp +='<img name="'+I+'img" id="'+I+'img" src="'+U+'" alt="'+A+'" border="0" width="'+W+'" height="'+H+'">';
	
	if (L != null) {
		Itmp +='<\/a>';
	}
	
	Itmp +='<\/div>';

	document.writeln(Itmp)
}	
/* #################################################################################### */

/* #################################################################################### */
// WATERMARK CODE
/* #################################################################################### */

// Declare & set 2 arrays to store x,y co-ords for window & scroll...
var tmpWin = new Array(0,0), tmpScroll = new Array(0,0);

function SetWaterMark(pPos) {
	
	// Check parameter value passed...
	var swmPos = parseInt(pPos);
	if ((swmPos <= 0) || (swmPos >= 10)) { swmPos = 9; }
		
	// Declare & set variables to store the old window & scroll values...
	var Old = tmpWin;
	var OldScroll = tmpScroll;
	
	tmpWin = getLib_SC_Win();
	tmpScroll = getLib_SC_Scroll();
	
	if ((tmpWin[0] != Old[0]) || (tmpWin[1] != Old[1]) || (tmpScroll[0] != OldScroll[0]) || (tmpScroll[1] != OldScroll[1])) {
		
		var wmXPos = 0;
		var wmYPos = 0;
		
		if ((swmPos == 1) || (swmPos == 4) || (swmPos== 7)) {
			wmXPos = tmpScroll[0] + wmSpacerX;
		}
		else if ((swmPos == 2) || (swmPos == 5) || (swmPos == 8)) {
			wmXPos = (tmpWin[0] / 2) + tmpScroll[0] - (wmWidth / 2);
		}
		else if ((swmPos == 3) || (swmPos == 6) || (swmPos == 9)) {
			wmXPos = tmpWin[0] + tmpScroll[0] - (wmWidth + wmSpacerX);
		}
		
		if ((swmPos == 1) || (swmPos == 2) || (swmPos== 3)) {
			wmYPos = tmpScroll[1] + wmSpacerY;
		}
		else if ((swmPos == 4) || (swmPos == 5) || (swmPos == 6)) {
			wmYPos = (tmpWin[1] / 2) + tmpScroll[1] - (wmHeight / 2);
		}
		else if ((pPos == 7) || (swmPos == 8) || (swmPos == 9)) {
			wmYPos = tmpWin[1] + tmpScroll[1] - (wmHeight + wmSpacerY);
		}
		
		setLib_ElementMoveTo(wmID, wmXPos, wmYPos);
		setLib_ElementZindex(wmID, getLib_TopZindex());
		
	}
}
/* #################################################################################### */
