function unFocus()
{
	window.focus();
}

function mouseIn(message)
{
	window.status = message;
	return true;
}
	
function mouseOut()
{
	window.status = '';
	return true;
}

function enlargeImage(img, lbl, cap)
{
	window.open('../cgi-bin/tools/enlargeimage.cgi/'+img+'/'+escape(lbl)+'/'+escape(cap),'enlarge','toolbar=no,scrollbars=yes,resizable=yes,menubar=no,status=yes,directories=no,location=no,width=350,height=350');
}
	
function printPage()
{
	window.open('../cgi-bin/tools/printpage.cgi'+escape(window.document.location.pathname)+'?referer='+escape(window.document.location),'print','toolbar=yes,scrollbars=yes,resizable=no,menubar=yes,status=yes,directories=no,location=no,width=577,height=460');
}

function emailPage()
{
	window.open('../cgi-bin/tools/mailpage.cgi'+escape(window.document.location.pathname)+'?title='+escape(document.title)+'&referer='+escape(window.document.location),'mail','toolbar=no,scrollbars=no,resizable=no,menubar=no,status=yes,directories=no,location=no,width=500,height=460');
}
	
function popup(page)
{
	window.open(page,'info','scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,width=280,height=200');
}

function isInputEmpty( fieldName ) {
	var inputName = document.getElementById( fieldName );
	var labelName = document.getElementById( fieldName + "_label");
	if( inputName.value == null || inputName.value == "" ) {
		labelName.className = "formLabel_error";
		return true;
	}
	labelName.className = "formLabel";
	return false;
}

function isDropDownEmpty( fieldName ) {

	var selectBox = document.getElementById( fieldName );
	var user_input = selectBox.options[selectBox.selectedIndex].value;	
	//alert( 'province selected ' + user_input );
	
}

function checkCheckboxes() {
	var isSomethingChecked = 0;
	
	if( document.catalogRequest.TC_catalog.checked ) { 
		isSomethingChecked++;
	} else {
		var labelName = document.getElementById( "TC_catalog_label");
		labelName.className = "checkboxText_error";	
	}
	
	if( isSomethingChecked > 0 ) {
		return false;	
	}		
	return true;	
}

function validateEmail( fieldName ) {
	// check that the email field is not blank
	if( isInputEmpty( fieldName ) ) {
		return false;	
	}
	
	var usersEmail = document.getElementById( fieldName );
	var emailLabel = document.getElementById( fieldName + "_label");
	// check that the email contains an @ sign
	if( usersEmail.value.indexOf('@') ) {
		alert('The email address entered is invalid.\n It does not contain an @ symbol');
		emailLabel.className = "formLabel_error";
		return false;		
	}	
	return true;
}

// RESOLUTION SETTING
function resSet() {
	//alert('Res setting');
	var screenHeight = screen.height;
	var screenWidth = screen.width;
	var resTable = document.getElementById('resTable');
	var homeMainImage = document.getElementById('home_mainImage');
	
	//alert('screen height:' + screenHeight + ', width:' + screenWidth );
	// check for low resolution screens
	if( screenWidth < 1020 ) {
		resTable.width = 760;	   // decrease table size
		if( homeMainImage ) {
			homeMainImage.src = '../images/home_mainImage_lores.gif';    // load a smaller image
		}
		newsMarqueeBoxWidth = 558;   // fix news marquee
		var nMR = document.getElementById('newsMarqueeRef');
		if( nMR != null ) {
			nMR.style.width=newsMarqueeBoxWidth;
		}
	} else {
		if( homeMainImage ) {
			homeMainImage.src = '../images/home_mainImage_hires.gif';    // load a larger image
		}
	}
}


