/**********************************************
	This document is used to validate form's 
	fields to see if they meet requirements
**********************************************/
function validatePassword(formName)
{
	/*
		Validate if two input password valid are matched
	*/
	valid = true;
	x = document.getElementById(formName);
	passWord1 = x.passW.value;
	passWord2 = x.rePassW.value;

	if (passWord1 != passWord2 )
	{
		document.getElementById('passW').style.border = "solid thin #009900";
		document.getElementById('rePassW').style.border = "solid thin #009900";
		document.getElementById('passW_note').style.color = "#009900";
		valid = false;
	}
	return valid;
}

function validateSelect(selectName)
{
	/*
		Validate if the drop dowm menu is selected
	*/
	valid = true;
	selectMenu = document.getElementById(selectName).value;
	
	if(selectMenu == 0){
		document.getElementById(selectName).style.border = "solid thin #FF0000";
		document.getElementById('require_note').style.color = "#FF0000";
		valid = false;
	}
	return valid;
}

function validateName(fieldName)
{
	/*
		Check if name contain any special character or not
	*/
	valid = true;
	name = document.getElementById(fieldName).value;	
	nameConfirm = name.search(/[(,),",},{,']/);	
	
	if(name != '' && nameConfirm != -1)
	{
		document.getElementById(fieldName).style.border = "solid thin #009900";	
		document.getElementById('name_note').style.color = "#009900";
		valid = false;
	}
	
	return valid;
}