function ChangeImage(strName, strSource) {
	document.images[strName].src = strSource;
}

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';
		var objWindow = window.open(strURL, strName, 'width=' + intWidth + ',height=' + intHeight + ',status=' + strStatus + ',scrollbars=' + strScroll + ',resizable=' + strResize + ',toolbar=' + strToolbar);
		objWindow.focus();
	}
}

function FirstFieldFocus(strForm) {
	var objForm, intField, objField;
	var blnValid = false;
	if (strForm && document.forms[strForm]) {
		objForm = document.forms[strForm];
		blnValid = true;
	}
	else if (document.forms[0]) {
		objForm = document.forms[0];
		blnValid = true;
	}
	if (blnValid) {
		for (intField = 0; intField < objForm.elements.length; intField++) {
			objField = objForm.elements[intField];
			if (objField.type != 'hidden') {
				objField.focus();
				break;
			}
		}
	}
}

// DHTML Menu Code

var sstrMenu = '';
var sintTimer = 0;

function CalculatePos(strID) {
	var lngTemp, lngMove;
	var objD = document.getElementById('div_' + strID);
	if (objD.offsetLeft) lngTemp = (objD.offsetLeft - 2);
	// Calculates the approx' menu position for IE Mac
	else if (document.body.offsetWidth) {
		switch (strID) {
			case 'menu_services':
				lngMove = 395;
				break;
			case 'menu_products':
				lngMove = 504;
				break;
			case 'menu_home':
				lngMove = 286;
				break;
		}
		lngTemp = Math.round((document.body.offsetWidth - 740) * 0.3);
		if (lngTemp <= 0) lngTemp = 0;
		lngTemp += lngMove;
	}
	return lngTemp + 'px';
}

function MenuOn(strID) {
	sstrMenu = strID;
	var objM = document.getElementById(strID);
	objM.style.left = CalculatePos(strID);
	objM.style.visibility = 'visible';
	switch (strID) {
		case 'menu_services':
			MenuHide('menu_products');
			MenuHide('menu_home');
			break;
		case 'menu_products':
			MenuHide('menu_services');
			MenuHide('menu_home');
			break;
		case 'menu_home':
			MenuHide('menu_products');
			MenuHide('menu_services');
			break;
	}
}

function MenuOff(strID) {
	sstrMenu = '';
	clearTimeout(sintTimer);
	sintTimer = setTimeout('MenuHide(\'' + strID + '\')', 500);
}

function MenuAllOff() {
	sstrMenu = '';
	clearTimeout(sintTimer);
	MenuHide('menu_products');
	MenuHide('menu_services');
	MenuHide('menu_home');
}

function MenuHide(strID) {
	if (strID != sstrMenu) {
		var objM = document.getElementById(strID);
		objM.style.visibility = 'hidden';
	}
}
