// 
// Storey Homes 
// Main Javascript handlers for popup menu items
//
// Copyright (c) 2010 - Jon Grieve
// Southdown House Software Limited
// Contact: info@southdown.co.uk
//
function setImg(object, image)
{
	document.getElementById(object).src = image;
}

function hideLinks()
{
	document.getElementById('prop_links').style.display = 'none';
}


//
// Form validation functions
//
function notEmpty(elem, helperMsg)
{
	if(elem.value.length == 0)
	{
		alert(helperMsg); 
		elem.focus(); // set the focus to this input 
		return false; 
	}

	return true;
}

function madeSelection(elem, helperMsg)
{
	if(elem.value == "- Please Select from list -")
	{
		alert(helperMsg); 
		elem.focus(); 
		return false; 
	}

	return true;
}

function emailValidator(elem, helperMsg)
{
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(!elem.value.match(emailExp))
	{
		alert(helperMsg); 
		elem.focus(); 
		return false; 
	}

	return true;
}

