
//function to validate passwords
function validatePassword(pwd1,pwd2)
{
	if 	(pwd1.value != pwd2.value) 
		{
			alert('Invalid password');
			return false;
		}
}


// function to check if atleast on of the checkboxes are selected
function validateCheckBoxes(obj, objName)
{

	var objValid = false;
	
	if (obj.length > 1) 
		{
			for (var i=0; i<obj.length; i++)
			{
				if (obj[i].checked == true) 
				{
					objValid = true;
					break;
				}
			}
		}
		
		else if (obj.checked == true) objValid = true;
	
	if (objValid != true) alert('You must select at least one ' + objName);
	return objValid;

}


// function to validate email address
function validateEmail(obj)
{

		if ((obj.value.indexOf('@') < 1) ||
			(obj.value.indexOf('.') == obj.value.length - 1) ||
			(obj.value.indexOf(' ') != -1) ||
			(obj.value.indexOf('..') != -1) 
		    )
			{
				alert('You have entered an Invalid e-mail address. Please try again.');
				return false;
				email.value.focus();
			}
		else return true;

}

