// JavaScript Document
function trim (strVar) { 
	if(strVar.length >0)
	{
		while(strVar.charAt(0)==" ")						//remove left spaces
			strVar=strVar.substring(1,strVar.length);
		while(strVar.charAt(strVar.length-1)==" ")			//remove right spaces
			strVar=strVar.substring(0,strVar.length-1);
	}
	return strVar;
}
function checkEmail(email) 
{
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))
	{
		return (true);
	}
	return false;
}


function checkForm(thisForm)
{
	var description	= trim(thisForm.description.value);
	var name	= trim(thisForm.name.value);
	var email	= trim(thisForm.email.value);
	var country	= trim(thisForm.country.value);

	if(description.length==0)
	{
		alert("Please enter Resume!");
		thisForm.description.focus();
		return false;
	}
	if(name.length==0)
	{
		alert("Please enter your Name!");
		thisForm.name.focus();
		return false;
	}
	if(email.length==0)
	{
		alert("Please enter your E-mail!");
		thisForm.email.focus();
		return false;
	}

	if(checkEmail(email) == false)
	{
		alert("Invalid Email! Please re-enter.");
		thisForm.email.select();
		return false;
	}
	if(country.length==0)
	{
		alert("Please enter Country!");
		thisForm.country.focus();
		return false;
	}
	return true;
}