

/* This function is pulled from a generic validation file from
some other site (probably developer.netscape.com) and strips out
characters you don't want */

function stripCharsInBag (s, bag) {
	var i;
    var returnString = "";

    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.

    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}
// End of stripCharsInBag function
// This function just makes sure the comment field is not empty

function valForm(frm) {
	badChars = "<[]>{}";

	if(frm.usrFName.value == "") {
		alert("Please fill in your first name.");
		return false;

	}else if(frm.usrLName.value == "") {
		alert("Please fill in your last name.");
		return false;

	}else if(frm.usrEmail.value == "") {
		alert("Please fill in your e-mail address.");
		return false;
		
	}else if(frm.usrPasswd.value == "") {
		alert("Please fill in your Password.");
		return false; 

	}else if(frm.usrNation.value == "") {
		alert("Please fill in your country of residence.");
		return false;
		
	}else if (frm.usrPasswd.value!=frm.usrPasswd_r.value){
		alert("Passwords do not match. Enter again");
		frm.usrPasswd.focus();
		return false;
	
	} else {
		frm.usrFName.value = stripCharsInBag(frm.usrFname.value, badChars);
		frm.usrLName.value = stripCharsInBag(frm.usrLName.value, badChars);
		frm.usrEmail.value = stripCharsInBag(frm.usrEmail.value, badChars);
		frm.usrPasswd.value = stripCharsInBag(frm.usrPasswd.value, badChars);
		frm.usrState.value = stripCharsInBag(frm.usrState.value, badChars);
		frm.usrNation.value = stripCharsInBag(frm.usrNation.value, badChars);
		return true;
	}
}
// End of valForm function
//usrSubject,usrEmail,usrPhone,usrFName, usrLName,usrCompany,usrState,usrCountry,usrQuery

function validateForm(frm) {
	badChars = "<[]>{}";

	if(frm.usrSubject.value == "") {
		alert("Please fill in the subject of your query.");
		return false;

	}else if(frm.usrEmail.value == "") {
		alert("Please fill in your e-mail address.");
		return false;

	}else if(frm.usrFName.value == "") {
		alert("Please fill in your first name.");
		return false;

	}else if(frm.usrLName.value == "") {
		alert("Please fill in your last name.");
		return false;
	
	}else if(frm.usrCountry.value == "") {
		alert("Please fill in your country of residence.");
		return false;

	}else if(frm.usrQuery.value == "") {
		alert("Please fill in your query.");
		return false;


	} else {
		frm.usrSubject.value = stripCharsInBag(frm.usrSubject.value, badChars);
		frm.usrEmail.value = stripCharsInBag(frm.usrEmail.value, badChars);
		frm.usrPhone.value = stripCharsInBag(frm.usrPhone.value, badChars);
		frm.usrFName.value = stripCharsInBag(frm.usrFName.value, badChars);
		frm.usrLName.value = stripCharsInBag(frm.usrLName.value, badChars);
		frm.usrCompany.value = stripCharsInBag(frm.usrCompany.value, badChars);
		frm.usrState.value = stripCharsInBag(frm.usrState.value, badChars);
		frm.usrCountry.value = stripCharsInBag(frm.usrCountry.value, badChars);
		frm.usrQuery.value = stripCharsInBag(frm.usrQuery.value, badChars);
		//alert("Please read the blinking message.");
		return true;

	}
}  

//End of 



