function Popup(strURL, strName, intWidth, intHeight, strStatus, strScroll, strResize, strToolbar) {
	if (!strURL) {
		alert('A link must be specified when using the Popup function.');
	}
	else
		{
		if (!strName) strName = 'popup';
		if (!intWidth) intWidth = 600;
		if (!intHeight) intHeight = 400;
		if (!strStatus) strStatus = 'yes';
		if (!strScroll) strScroll = 'yes';
		if (!strResize) strResize = 'yes';
		if (!strToolbar) strToolbar = 'no';
		if (typeof(objWindow) != "undefined" && objWindow != null && !objWindow.closed) objWindow.close();
		objWindow = window.open(strURL, strName, 'width=' + intWidth + ',height=' + intHeight + ',status=' + strStatus + ',scrollbars=' + strScroll + ',resizable=' + strResize + ',toolbar=' + strToolbar);
		objWindow.focus();
	}
}
function LeftMenu(blnOn, strID) {
	if (blnOn) {
		document.getElementById(strID).src = '/images/lefttxt_' + strID + 'on.gif';
		document.getElementById('left_' + strID).style.backgroundImage = 'url(/images/left_' + strID + 'on.jpg)';
	} else {
		document.getElementById(strID).src = '/images/lefttxt_' + strID + '.gif';
		document.getElementById('left_' + strID).style.backgroundImage = 'url(/images/left_' + strID + '.jpg)';
	}
}


/* MENU */
var sstrStay = '';
var sstrOn = '';
var sintTimer = 0;
// sarrItem is now set at /assets/menu.asp

//Should really be called: menu off if not highlighted...
//only do MenuOff if the current page is different from the strID page (i.e. user's not currently viewing it)

function setClassName(strClassID, strClassName) {

	var objN = document.getElementById(strClassID);
	if (objN != null) {
		objN.className = strClassName;
	}
}


function getTrueOffSet(obj, strPos)
{
	var offsetStr="offset" + (strPos.toLowerCase()=="top" ? "Top" : strPos.toLowerCase()=="top" ? "Top" : "Left");
	var offsetVal=eval("obj." + offsetStr);
	while (obj.offsetParent != null)
	{
		offsetVal += eval("obj.offsetParent." + offsetStr);
		obj=obj.offsetParent;
	}
	return(offsetVal);
}

function MenuOn(strID, blnRight) {
	sstrStay = strID;
	if (strID != sstrOn) {
		sstrOn = strID;
		var objN = document.getElementById('nav_' + strID);
		var objM = document.getElementById('menu_' + strID);

		if (objN != null && objM != null) {
			if (blnRight) {
				objM.style.left = (getTrueOffSet(objN, "left") - (objM.offsetWidth - objN.offsetWidth)) + 'px';
			}
			else {
				objM.style.left = (getTrueOffSet(objN, "left") + 4) + 'px';
			}
			if (strID == 'menu05' || strID == 'menu06') {
				objM.style.top = (getTrueOffSet(objN, "top")+31) + 'px';
			} else {
				objM.style.top = (getTrueOffSet(objN, "top")+48) + 'px';
			}
			objM.style.visibility = 'visible';
		}
		MenuAllHide(strID);
	}
}

function MenuStay(strID, strClass) {
	sstrStay = strID;
	var objN = document.getElementById('cell_' + strID);
	if (objN != null) {
		setClassName('cell_' + strID, strClass);
	}
}

function MenuOff(strID, strClass, strSection) {
	sstrStay = '';
	clearTimeout(sintTimer);
	sintTimer = setTimeout('MenuHide(\'' + strID + '\')', 500);

	//var strURL = document.URL;
	if (document.URL.indexOf(strSection) < 0) {
		var objN = document.getElementById('cell_' + strID);
		if (objN != null) {
			setClassName('cell_' + strID, strClass);
		}
	}
}

function MenuOffIf(strID, gstrScript, keyword) {

	sstrStay = '';
	clearTimeout(sintTimer);
	sintTimer = setTimeout('MenuHide(\'' + strID + '\')', 500);

	//If the menu should not be highlighted, turn it off
	if (gstrScript.indexOf(keyword) < 0) {
		var objN = document.getElementById('nav_' + strID);
		if (objN != null) {
			setClassName('cell_' + strID, strID);
		}
	}
}

function MenuAllOff() {
	sstrStay = '';
	sstrOn = '';
	clearTimeout(sintTimer);
	MenuAllHide();
}

function MenuHide(strID) {
	if (strID != sstrStay) {
		if (strID == sstrOn) sstrOn = '';
		var objM = document.getElementById('menu_' + strID);
		if (objM != null)
		{
			objM.style.visibility = 'hidden';
		}
	}
}

function MenuAllHide(strID) {
	var intCount, strItem;
	for (intCount = 0; intCount < sarrItems.length; intCount++) {
		strItem = sarrItems[intCount];
		if (strID != strItem) MenuHide(strItem);
	}
}

//Stephan Carydakis 21/09/2010 BEGIN: email field user prompt
if (typeof jQuery != 'undefined')
{
	var $ = jQuery.noConflict();
	$(document).ready(function()
	{
		var formEmailField=$('form #email');
		var toolTipEl=$("#emailtt");
		if (formEmailField.length > 0 && toolTipEl.length > 0)
		{
			var origBgColor=toolTipEl.css('background-color');
			//$("#text", toolTipEl).html("Please ensure that your email address is correct.<br /><br />This needs to be correct to ensure your message arrives.");
			var padH=(!isNaN(parseInt(toolTipEl.css('padding-left'))) ? parseInt(toolTipEl.css('padding-left')) : 0) + (!isNaN(parseInt(toolTipEl.css('padding-right'))) ? parseInt(toolTipEl.css('padding-right')) : 0);
			var padV=(!isNaN(parseInt(toolTipEl.css('padding-top'))) ? parseInt(toolTipEl.css('padding-top')) : 0) + (!isNaN(parseInt(toolTipEl.css('padding-bottom'))) ? parseInt(toolTipEl.css('padding-bottom')) : 0);
			var middleWidth=$("#text", toolTipEl).width()-$("#tl", toolTipEl).width()-$("#tr", toolTipEl).width()+padH;
			var middleHeight=$("#text", toolTipEl).height()-$("#tl", toolTipEl).height()-$("#bl", toolTipEl).height()+padV;
			$("#t, #b", toolTipEl).css({left:$("#tl", toolTipEl).width()}).width(middleWidth);
			$("#l, #r", toolTipEl).css({top:$("#tl", toolTipEl).height()}).height(middleHeight);
			$("#pointer", toolTipEl).css({top:$("#tl", toolTipEl).height(), left:-12});
			pw=$("#pointer", toolTipEl).width();
			pt=$("#pointer", toolTipEl).position().top;
			formEmailField.focus(function(){
				toolTipEl.css({left:$(this).position().left+$(this).width()+pw, top:$(this).position().top-pt-$(this).height()/2+3}).hide(1, function(){ $(this).css({'visibility':'visible'}).show(100, function(){$(this).css({'background-color':'transparent'});});});
			});
			formEmailField.blur(function(){
				toolTipEl.css({'background-color':origBgColor}).hide(50, function() { $(this).css({'visibility':'hidden'});});
			});
		}
	});
}
// END: email field user prompt
