function validate_fdbkform ()
{
    valid = true;
  
    if ( document.fdbkform.fname.value == "" )
    {
        changeText('Please fill in the your full name');
        valid = false;
    }
	else if ( document.fdbkform.email.value == "" )
    {
        changeText('Please fill in the your email address');
        valid = false;
    }
	else if(checkEmail() == false){
		changeText('Please enter a valid email address');
        valid = false;
    }
	else if ( document.fdbkform.comments.value == "" )
    {
        changeText('Please fill in the your comments');
        valid = false;
    }
       else if ( document.fdbkform.comments.value.length > 3000 )
    {
        changeText('Comment must not exceed 3000 char');
        valid = false;
    }
      else if ( hasHTML(document.fdbkform.comments.value ))
    {
       changeText('HTML text not allowed');
       valid = false;
    }

    return valid;
}


function checkEmail() {

	email = document.fdbkform.email.value
	AtPos = email.indexOf("@")
	StopPos = email.lastIndexOf(".")

	if (AtPos == -1 || StopPos == -1) {
		return false;
        }

}


function changeText(txt){
   var textContent = document.getElementById('errortext');
   textContent.firstChild.data=txt;
}


function hasHTML(elementVal){
        if(elementVal.match(/([\<])([^\>]{1,})*([\>])/i)==null)
          return false;
        else
          return true;
}

