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 MouseOver(strId, blnOn) {
	if(!blnOn) { ChangeImage('img' + strId, 'http://www.saveoursleep.com/images/menu_' + strId + '_on.gif'); }
	document.getElementById('td_' + strId).className = 'textLeftmenuOn';
	document.getElementById('top1' + strId).style.backgroundColor = '#CEDDED';
	document.getElementById('top2' + strId).style.backgroundColor = '#FFFFFF';
	document.getElementById('bottom1' + strId).style.backgroundColor = '#FFFFFF';
	document.getElementById('bottom2' + strId).style.backgroundColor = '#CEDDED';
}	
function MouseOut(strId, blnOn) {
	if(!blnOn) { ChangeImage('img' + strId, 'http://www.saveoursleep.com/images/menu_' + strId + '.gif'); }
	document.getElementById('td_' + strId).className = 'textLeftmenu';
	document.getElementById('top1' + strId).style.backgroundColor = '#DEECF3';
	document.getElementById('top2' + strId).style.backgroundColor = '#DEECF3';
	document.getElementById('bottom2' + strId).style.backgroundColor = '#DEECF3';
	document.getElementById('bottom1' + strId).style.backgroundColor = '#DEECF3';
}	

function FieldMaxLength(objField, lngLength) {
	return (objField.value.length < lngLength);
}

function MaxLength(objField, lngLength) {
	if (objField.value.length > lngLength) objField.value = objField.value.substring(0, lngLength);
}
