/****************** Contact us  ****************/
/******************* checking for empty string  *****************/
function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}

/******************* (end) checking for empty string *****************/

/******************* checking for white space  *****************/

var whitespace = " \t\n\r";
function isWhitespace (s)
{ var i;
   if (isEmpty(s)) return true;
   for (i = 0; i < s.length; i++)
    {
    var c = s.charAt(i);
   if (whitespace.indexOf(c) == -1) return false;
   }
  return true;
}
/******************* (end) checking for white space  *****************/



function validate_contact_form()
{	
	
	if (isWhitespace(document.contact_us_form.first_name.value))
	{
		alert('First name is mandatory.');
		document.contact_us_form.first_name.focus();		
		return false;
	}
	
	if (isWhitespace(document.contact_us_form.last_name.value))
	{
		alert('Last name is mandatory.');
		document.contact_us_form.last_name.focus();		
		return false;
	}
	
	
	if (isWhitespace(document.contact_us_form.email.value))
	{
		alert('Email address is mandatory.');
		document.contact_us_form.email.focus();		
		return false;
	}

	if ((document.contact_us_form.email.value) != '')
	{
		check_mail=document.contact_us_form.email.value;
		if ((check_mail.indexOf('@', 0) == -1) || (check_mail.indexOf('.', 0) == -1) )
		{
			alert("Not a  valid e-mail address!");
			document.contact_us_form.email.focus();
			return false;
		}	
	}

	if (isWhitespace(document.contact_us_form.subject.value))
	{
		alert('Subject mandatory.');
		document.contact_us_form.subject.focus();		
		return false;
	}
	

	if (isWhitespace(document.contact_us_form.comment.value))
	{
		alert('Comment mandatory.');
		document.contact_us_form.comment.focus();		
		return false;
	}
	
}


