


/*
	Browser identification.
*/
var browser_windows = (navigator.userAgent.indexOf('Windows') >= 0);
var browser_mac = (navigator.userAgent.indexOf('Macintosh') >= 0);
var browser_ie = (navigator.userAgent.indexOf('MSIE') >= 0);
var browser_ie6 = (navigator.userAgent.indexOf('MSIE 6.0') >= 0);
var browser_firefox = (navigator.userAgent.indexOf('Firefox') >= 0);
var browser_opera = (navigator.userAgent.indexOf('Opera') >= 0);
var browser_safari = (navigator.userAgent.indexOf('Safari') >= 0);



function getObjPos(objInput)
{
	intOutLeft = 0;
	intOutTop = 0;
	intOutRight = objInput.offsetRight ? objInput.offsetRight : null;
	intOutBottom = objInput.offsetBottom ? objInput.offsetBottom : null;
	intOutWidth = objInput.offsetWidth ? objInput.offsetWidth : null;
	intOutHeight = objInput.offsetHeight ? objInput.offsetHeight : null;
	
	if (objInput.offsetParent)
	{	while (objInput.offsetParent)
		{	intOutLeft += objInput.offsetLeft;
			intOutTop += objInput.offsetTop;
			objInput = objInput.offsetParent;
		}
	}
	else
	if (objInput.x || objInput.y)
	{	intOutLeft += objInput.x;
		intOutTop += objInput.y;
		intOutWidth = objInput.width ? objInput.width : null;
		intOutHeight = objInput.height ? objInput.height : null;
	}
	
	
	if ((intOutRight == null) && intOutWidth) intOutRight = intOutLeft+intOutWidth;
	if ((intOutBottom == null) && intOutHeight) intOutBottom = intOutTop+intOutHeight;
	
	rayOutput = new Array();
	rayOutput['left'] = intOutLeft;
	rayOutput['right'] = intOutRight;
	rayOutput['top'] = intOutTop;
	rayOutput['bottom'] = intOutBottom;
	rayOutput['width'] = intOutWidth;
	rayOutput['height'] = intOutHeight;
	return rayOutput;
}



function go(strInHref)
{	
	document.location = strInHref;
}








function getAjax()
{	
	xmlHttp = false;
	try
	{	// standards compliant
		xmlHttp = new XMLHttpRequest();
	}
	catch (ie)
	{	// stupid compliant
		try
		{	xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); }
		catch (ie)
		{	try
			{	xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); }
			catch (ie)
			{	
				return false;
			}
		}
	}
	return xmlHttp;
}









/*
	Get page parameters from query string.
*/
var rayPageParameters = null;

function getPageParameters()
{	
	rayOutParameters = new Array();
	strQueryString = location.search.replace(/\?/,'&');
	rayQueryString = strQueryString.split('&');
	for (i=1; i < rayQueryString.length; i++)
	{	strParameter = rayQueryString[i];
		rayParameter = strParameter.split('=');
		rayOutParameters[rayParameter[0]] = rayParameter[1];
	}
	return rayOutParameters;
}

function getPageParameter(strInParam)
{	
	if (!rayPageParameters) rayPageParameters = getPageParameters();
	return rayPageParameters[strInParam];
}













/*
	Set object opacity. (method based on browser)
*/
function setOpacity(objIn, intOpacity)
{	
	if (browser_ie)
	{	
		objIn.style.filter='alpha(opacity='+intOpacity+')';
		objIn.style.zoom='1';
	}
	else
	{
		objIn.style.opacity=(intOpacity/100);
	}
}






















/*
	Sequence object...
*/
var raySequenceByID = new Array();

function sequence(strInSequenceID)
{	
	this.id = strInSequenceID;
	
	this.rayCommands = new Array();
	
	raySequenceByID[this.id] = this;
}
sequence.prototype.addCommand = function(strInCommand)
{	
	this.rayCommands.push(strInCommand);
}
sequence.prototype.getNextCommand = function()
{	
	if (this.rayCommands.length)
	{	return this.rayCommands.shift(); }
	else
	{	return false; }
}	
sequence.prototype.doNext = function()
{	
	strNextCommand = this.getNextCommand();
	if (strNextCommand) eval(strNextCommand);
}



function createSequence(strInSequenceID)
{	
	return new sequence(strInSequenceID);
}
function getSequence(strInSequenceID)
{	
	return raySequenceByID[strInSequenceID];
}
function resumeSequence(strInSequenceID)
{	
	s = getSequence(strInSequenceID);
	if (s)
	{	s.doNext(); }
	else
	{	alert("resumeSequence ERROR: sequence id '"+strInSequenceID+"' not found."); }
}
function addToSequence(strInSequenceID, strInNewCommand)
{	
	s = getSequence(strInSequenceID);
	if (s)
	{	s.addCommand(strInNewCommand); }
	else
	{	alert("resumeSequence ERROR: sequence id '"+strInSequenceID+"' not found."); }
}





