// JavaScript Document
 
//Textbox validation
function validateTxtBox(fld) {
    var error = ""; 
 
	if ((fld.value == "") || (fld.value ==null) || (fld.value.length == 0) || (fld.value.match(/^\s+$/)) ) 
	{
        fld.style.background = 'Yellow'; 
        //error = "You didn't enter a username.\n";
		if (fld == document.forms.formEnquiry.txtName) 
		{
		   error = "You didn't enter a Username.\n";
		}    
 
		
	}
	else 
	{
		fld.style.background = 'White';
	
	}
    
    return error;
}
//For Email

function trim(s)
{
  return s.replace(/^\s+|\s+$/, '');
}

function validateEmail(fld) {
    var error="";
    var tfld = trim(fld.value);                        // value of field with whitespace trimmed off
    var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
    //var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ ;
	//var validEmail = "";
   
    if (fld.value == "") {
        fld.style.background = 'Yellow';
        error = "You didn't enter an email address.\n";
		//document.getElementById("lblEmail_empty").style.display = 'block';
		//document.getElementById("lblEmail_wrong").style.display = 'none';
		validEmail = false;
    } else if (!emailFilter.test(tfld)) {              //test email for illegal characters
        fld.style.background = 'Yellow';
        error = "Please enter a valid email address.\n";
		//document.getElementById("lblEmail_empty").style.display = 'none';
		//document.getElementById("lblEmail_wrong").style.display = 'block';
		//validEmail = false;
    } else {
        fld.style.background = 'White';
		//validEmail = true;
    }
 
    return error;
}



