//Browser detection
/*
var ns6 = (document.getElementById)?true:false;
var ie5 = (document.getElementById)?true:false;
var ns4 = (document.layers)?true:false;
var ie4 = (document.all)?true:false;
*/

//preload images
imgHomeOn = new Image();
imgHomeOn.src = '/images/homeOn.gif';
imgHomeOff = new Image();
imgHomeOff.src = '/images/homeOff.gif';

imgBMROn = new Image();
imgBMROn.src = '/images/bmrOn.gif';
imgBMROff = new Image();
imgBMROff.src = '/images/bmrOff.gif';

imgVoiOn = new Image();
imgVoiOn.src = '/images/voiOn.gif';
imgVoiOff = new Image();
imgVoiOff.src = '/images/voiOff.gif';

imgHomeFooterOn = new Image();
imgHomeFooterOn.src = '/images/homeFooterOn.gif';
imgHomeFooterOff = new Image();
imgHomeFooterOff.src = '/images/homeFooter.gif';

imgBMRFooterOn = new Image();
imgBMRFooterOn.src = '/images/bmrFooterOn.gif';
imgBMRFooterOff = new Image();
imgBMRFooterOff.src = '/images/bmrFooter.gif';

imgVoiFooterOn = new Image();
imgVoiFooterOn.src = '/images/voiFooterOn.gif';
imgVoiFooterOff = new Image();
imgVoiFooterOff.src = '/images/voiFooter.gif';

imgHelpOn = new Image();
imgHelpOn.src = '/images/HelpOn.gif';
imgHelpOff = new Image();
imgHelpOff.src = '/images/HelpOff.gif';

imgGlossaryOn = new Image();
imgGlossaryOn.src = '/images/GlossaryOn.gif';
imgGlossaryOff = new Image();
imgGlossaryOff.src = '/images/GlossaryOff.gif';

//image rollover action
function imageRollover(imageID,action)
{
	if (document.images)
		{ document[imageID].src= eval(imageID + action + ".src"); }
}

/* This function works the same as trim in CF */
function trim(strString)
{
	//if the string is empty just return nothing
	if (strString.length > 0)
	{
		//loop over the string until a non-whitespace char is found
		for (i = 0;i < strString.length;i++)
		{
			strChar = strString.charAt(i);
			//if the character at this position is not whitespace
			if (strChar != ' ' && strChar != '\t' && strChar != '\r' && strChar != '\n')
			{
				intStartPos = i;
				break;
			}
			//this is in case the string is all whitespace
			if (i == strString.length-1)
				{ intStartPos = 0; }
		}
	
		//loop over the string backwards until a non-whitespace char is found
		for (i = strString.length-1; i >= 0; i--)
		{
			strChar = strString.charAt(i);
	
			//if the character at this position is not whitespace
			if (strChar != ' ' && strChar != '\t' && strChar != '\r' && strChar != '\n')
			{
				intEndPos = i
				break;
			}
			//This is in case the string is all whitespace
			if (i == 0)
				{ intEndPos = -1; }
		}
	
		//Get the trimmed string and return it to the user
		return strString.substring(intStartPos,intEndPos+1);
	}
	else
	{
		return '';
	}
}
//used to pop up the sample reports
function windowOpen(strLocation)
{
	msgWindow = window.open(strLocation,'msgWindow','width=820,height=520,scrollbars=1,location=0,status=0,resizable=1');
}