/* Created By: Chris Campbell. http://particletree.com. 2/1/2006   Inspired by the lightbox implementation found at http://www.huddletogether.com/projects/lightbox/ */var detect = navigator.userAgent.toLowerCase();var OS,browser,version,total,thestring;//Browser detect script origionally created by Peter Paul Koch at http://www.quirksmode.org/function getBrowserInfo() {	if (checkIt('konqueror')) {		browser = "Konqueror";		OS = "Linux";	}	else if (checkIt('safari')) browser 	= "Safari"	else if (checkIt('omniweb')) browser 	= "OmniWeb"	else if (checkIt('opera')) browser 	= "Opera"	else if (checkIt('webtv')) browser 	= "WebTV";	else if (checkIt('icab')) browser 		= "iCab"	else if (checkIt('msie')) browser 		= "Internet Explorer"	else if (!checkIt('compatible')) {		browser = "Netscape Navigator"		version = detect.charAt(8);	}	else browser = "An unknown browser";	if (!version) version = detect.charAt(place + thestring.length);	if (!OS) {		if (checkIt('linux')) OS 	= "Linux";		else if (checkIt('x11')) OS 	= "Unix";		else if (checkIt('mac')) OS 	= "Mac"		else if (checkIt('win')) OS 	= "Windows"		else OS 								= "an unknown operating system";	}}function checkIt(string) {	place = detect.indexOf(string) + 1;	thestring = string;	return place;}/*-----------------------------------------------------------------------------------------------*/Event.observe(window, 'load', initialize, false);Event.observe(window, 'load', getBrowserInfo, false);//Event.observe(window, 'unload', Event.unloadCache, false);var lightbox = Class.create();image1 = new Image();image1.src = "/spinner.gif";lightbox.prototype = {	yPos : 0,	xPos : 0,	initialize: function(ctrl) {		if (ctrl!=undefined) {			this.content = ctrl.href;			Event.observe(ctrl, 'click', this.activate.bindAsEventListener(this), false);			ctrl.onclick = function(){return false;};		}	},	// Turn everything on - mainly the IE fixes	activate: function(thetext){		if (browser == 'Internet Explorer'){//			this.getScroll();//			this.prepareIE('100%', 'hidden');//			this.setScroll(0,0);			this.hideSelects('hidden');		}		centrejobby()		if (thetext!=undefined) $("lbLoadMessage").innerHTML = "<p>" + thetext + "</p>"		this.displayLightbox("block");	},	// Ie requires height to 100% and overflow hidden or else you can scroll down past the lightbox	prepareIE: function(height, overflow){		bod = document.getElementsByTagName('body')[0];		bod.style.height = height;		bod.style.overflow = overflow;  		htm = document.getElementsByTagName('html')[0];		htm.style.height = height;		htm.style.overflow = overflow;	},	// In IE, select elements hover on top of the lightbox	hideSelects: function(visibility){		selects = document.getElementsByTagName('select');		for(i = 0; i < selects.length; i++) {			selects[i].style.visibility = visibility;		}	},	// Taken from lightbox implementation found at http://www.huddletogether.com/projects/lightbox/	getScroll: function(){		if (self.pageYOffset) {			this.yPos = self.pageYOffset;		} else if (document.documentElement && document.documentElement.scrollTop){			this.yPos = document.documentElement.scrollTop; 		} else if (document.body) {			this.yPos = document.body.scrollTop;		}	},	setScroll: function(x, y){		window.scrollTo(x, y); 	},	displayLightbox: function(display){		$('overlay').style.display = display;		$('lightbox').style.display = display;	},	deactivate: function(){		try {Element.remove($('lbContent'));} catch(x) {}		if (browser == "Internet Explorer"){			this.hideSelects("visible");		}		this.displayLightbox("none");	}}// Onload, make all links that need to trigger a lightbox activefunction initialize(){	addLightboxMarkup()//	lbox = document.getElementsByClassName('lbOn');}function addLightboxMarkup() {	bod 				= document.getElementsByTagName('body')[0];	overlay 			= document.createElement('div');	overlay.id		= 'overlay';	lb					= document.createElement('div');	lb.id				= 'lightbox';	lb.className 	= 'loading';	lb.innerHTML	= '<div id="lbLoadMessage"><p>Please Wait ....</p></div>';	bod.appendChild(overlay);	bod.appendChild(lb);	image1 = new Image();											// ADDED TO PRELOAD THE IMAGE (3RD APRIL 2007)	image1.src = "/spinner.gif";	var viewPortHeight = windowState.getFullHeight();	var divStyleRef = $("overlay").style	var positionMod = (typeof divStyleRef.height == 'string')?"px":0;	divStyleRef.height = viewPortHeight + positionMod;}var windowState = (function(){										// from http://www.thescripts.com/forum/thread90674.html	var readScroll = {scrollLeft:0,scrollTop:0};	var readSize = {clientWidth:0,clientHeight:0};	var readScrollX = 'scrollLeft';	var readScrollY = 'scrollTop';	var readWidth = 'clientWidth';	var readHeight = 'clientHeight';	function otherWindowTest(obj){		if((document.compatMode)&& (document.compatMode == 'CSS1Compat')&& (document.documentElement)){			return document.documentElement;		}else if(document.body){			return document.body;		}else{			return obj;		}	};	if((typeof this.innerHeight == 'number')&& (typeof this.innerWidth == 'number')){		readSize = this;		readWidth = 'innerWidth';		readHeight = 'innerHeight';	}else{		readSize = otherWindowTest(readSize);	}	if((typeof this.pageYOffset == 'number')&& (typeof this.pageXOffset == 'number')){		readScroll = this;		readScrollY = 'pageYOffset';		readScrollX = 'pageXOffset';	}else{		readScroll = otherWindowTest(readScroll);	}	return {		getScrollX:function(){ return (readScroll[readScrollX]||0); },		getScrollY:function(){ return (readScroll[readScrollY]||0);	},		getWidth:function(){ return (readSize[readWidth]||0); },		getHeight:function(){ return (readSize[readHeight]||0); },		getFullHeight:function(){			var x,y;			var test1 = document.body.scrollHeight;			var test2 = document.body.offsetHeight			if (test1 > test2) // all but Explorer Mac			{				x = document.body.scrollWidth;				y = document.body.scrollHeight;			}			else // Explorer Mac;			{				x = document.body.offsetWidth;				y = document.body.offsetHeight;			}			return (this.getHeight() > y) ? this.getHeight() : y		}	};})();function centrejobby() {	var viewPortHeight = windowState.getHeight();	var verticalScroll = windowState.getScrollY();	divHeight=50;	var vPos = Math.round(verticalScroll+((viewPortHeight-divHeight)/2));	vPos = (vPos < 0)?0:vPos;	var divStyleRef = $("lightbox").style	var positionMod = (typeof divStyleRef.top == 'string')?"px":0;	divStyleRef.top = vPos + positionMod;}