var mmWindow;
var flashVar;
var requestedFlash = false;
function openPopupWindow(p_strUrl, p_width, p_height, p_sizeable, p_scroll)
{
	if (p_scroll == undefined) {
		p_scroll = "yes";
	}
		// is it already open ?
	if (!mmWindow || mmWindow.closed)
	{
		mmWindow = window.open(p_strUrl, "RTS", "status,height="+p_height+",width="+p_width+",scrollbars="+p_scroll+",resizable=" + p_sizeable);
		mmWindow.focus();
	}
	else if (mmWindow.focus)
	{   mmWindow.close();
		mmWindow = window.open(p_strUrl, "RTS", "status,height="+p_height+",width="+p_width+",scrollbars=yes,resizable" + p_sizeable);
		mmWindow.location = p_strUrl;
		mmWindow.focus();
	}
	
	if (IsPopupBlocker(mmWindow)) {
	alert('grrr! You seem to have a popup blocker! Please disable it to continue');
	}
}

function IsPopupBlocker(whichWindow) {
	if (whichWindow==null || typeof(whichWindow)=="undefined") {
		return true;
	} else {
		return false;
	}
}

function setFlashCookie(onOff) {
	var tenYear = new Date();
	tenYear.setFullYear(tenYear.getFullYear() + 10);
	document.cookie = "flashOnOff=" + onOff + "; expires=" + tenYear.toGMTString();
	setRequestedFlash(true);
}

function getFlashCookie() {
	flashVar = readCookie('flashOnOff');
	if (flashVar==null) {
		flashVar = 'true';
	} 
	
	return flashVar;
}

function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function setRequestedFlash(bool) {
	requestedFlash = bool;
}
function getRequestedFlash() {
	return requestedFlash;
}
function homepageImage() {
	return '<img src="i/header_1.jpg" width="634" height="215" border="0" alt="Trucks lined up in a row displaying the RTS logo on the body"/>';
}

function randomImage() {
	var imageArray = new Array();
	imageArray.push('<img src="i/header_1.jpg" width="634" height="215" border="0" alt="Trucks lined up in a row displaying the RTS logo on the body"/>');
	imageArray.push('<img src="i/header_2.jpg" width="634" height="215" border="0" alt="Trucks lined up in a row displaying the RTS logo on the body"/>');
	imageArray.push('<img src="i/header_3.jpg" width="634" height="215" border="0" alt="Trucks lined up in a row displaying the RTS logo on the body"/>');
	imageArray.push('<img src="i/header_4.jpg" width="634" height="215" border="0" alt="Trucks lined up in a row displaying the RTS logo on the body"/>');
	imageArray.push('<img src="i/header_5.jpg" width="634" height="215" border="0" alt="Trucks lined up in a row displaying the RTS logo on the body"/>');
	imageArray.push('<img src="i/header_6.jpg" width="634" height="215" border="0" alt="Trucks lined up in a row displaying the RTS logo on the body"/>');
	var newRandomNum = getRandomNumber(imageArray.length);
	return imageArray[newRandomNum];
}
function getRandomNumber(outOf) {
	var randomNumber = Math.floor(Math.random() * outOf);	
	return randomNumber;
}
function hideEmail(name, domain, subject) {
	return "mailto:" + name + "@" + domain + "?subject=" + subject;
}
	