function isEmail(s) {
	var email = s.split(',');
	for (var i = 0; i < email.length; i++) {
		if (!checkEmail(email[i])) {
			return false;
		}
	}
	
	return true;
}

function checkEmail(s) {
	if(s=="") // Email empty
		return true;
	if(s.indexOf(" ")>0) // Email having space
		return false;
	if(s.indexOf("@")==-1) // Email does not have @
		return false;
	var sLength=s.length;
	if(s.indexOf(".")==-1) // Email does not have '.'
		return false;
	if(s.indexOf("..")!=-1) // Email having  '..'
		return false;
	if(s.indexOf("@")!=s.lastIndexOf("@")) // Email having 2 @
		return false;
	if(s.lastIndexOf(".")==s.length-1) // Email having '.' end of sentence
		return false;

	return true; // Email is ok
}


$(document).ready(function(){
	$("#firstName").focus(function() {
		if($(this).val() == "First Name") {
			$(this).val("");
			$(this).addClass(" ActiveInput");
		}
	});
	$("#firstName").blur(function() {
		if($(this).val() == "") {
			$(this).val("First Name");
			$(this).removeClass(" ActiveInput");
		}
	});
	
	$("#lastName").focus(function() {
		if($(this).val() == "Last Name") {
			$(this).val("");
			$(this).addClass(" ActiveInput");
		}
	});
	$("#lastName").blur(function() {
		if($(this).val() == "") {
			$(this).val("Last Name");
			$(this).removeClass(" ActiveInput");
		}
	});
	
	$("#emailAddress").focus(function() {
		if($(this).val() == "E-mail Address") {
			$(this).val("");
			$(this).addClass(" ActiveInput");
		}
	});
	$("#emailAddress").blur(function() {
		if($(this).val() == "") {
			$(this).val("E-mail Address");
			$(this).removeClass(" ActiveInput");
		}
	});
	
	$("#questionComment").focus(function() {
		if($(this).val() == "Your question or comment") {
			$(this).val("");
			$(this).addClass(" ActiveInput");
		}
	});
	$("#questionComment").blur(function() {
		if($(this).val() == "") {
			$(this).val("Your question or comment");
			$(this).removeClass(" ActiveInput");
		}
	});
});