//	Event.observe(window, 'load', addLightboxMarkup, false);
//	Event.observe(window, 'load', getBrowserInfo, false);
	Event.observe(window, 'unload', Event.unloadCache, false);

	var detect = navigator.userAgent.toLowerCase();
	var OS, browser, version, total, thestring;

	getBrowserInfo();

	function checkIt(string)
	{
		place = detect.indexOf(string) + 1;
		thestring = string;
		return place;
	}

	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 activate(lbid)
	{
		if (browser == 'Internet Explorer')
		{
			prepareIE('100%', 'hidden');
			hideSelects('hidden');
		}

		getScroll(lbid);
		setScroll(0,0);
		displayLightbox(lbid, 'block');
	}

	function prepareIE(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;
	}

	function hideSelects(visibility)
	{
		selects = document.getElementsByTagName('select');
		for(i = 0; i < selects.length; i++)
			selects[i].style.visibility = visibility;
	}

	function getScroll(lbid)
	{
		if (self.pageYOffset)
		{
			document.getElementById('yPos_' + lbid).value = self.pageYOffset;
		}
		else if (document.documentElement && document.documentElement.scrollTop)
		{
			document.getElementById('yPos_' + lbid).value = document.documentElement.scrollTop;
		}
		else if (document.body)
		{
			document.getElementById('yPos_' + lbid).value = document.body.scrollTop;
		}
	}

	function setScroll(x, y)
	{
		window.scrollTo(x, y);
	}

	function displayLightbox(lbid, display)
	{
		document.getElementById('overlay').style.display = display;
		document.getElementById(lbid).style.display = display;
		if (display != 'none') actions();
	}

	function actions()
	{

	}

	function deactivate(lbid)
	{
		if (browser == 'Internet Explorer')
		{
			prepareIE('auto', 'auto');
			hideSelects('visible');
		}

		setScroll(0, document.getElementById('yPos_' + lbid).value);
		displayLightbox(lbid, 'none');
	}

	function addLightboxMarkup()
	{
		bod 				= document.getElementsByTagName('body')[0];

		overlay 			= document.createElement('div');
		overlay.id			= 'overlay';

		bod.appendChild(overlay);
	}