function is_valid_email(email) {
	var emailRegEx = /^([a-zA-Z0-9])([a-zA-Z0-9\._-])*@(([a-zA-Z0-9])+(\.))+([a-zA-Z]{2,4})+$/ ;
	//var address = s[email].value;
	if(email.search(emailRegEx) ==-1) {
		//alert('Invalid Email Address');
		return false;
	} else {
		return true;
	}
}



function jqvalidate(selector, field_type, invalid_message, valid_message) {

	if (field_type == "email") {
		$(selector).wrap(document.createElement("div")).after("&nbsp;&nbsp;&nbsp;<span></span>");
		$(selector).parent().each(function() {
			$(this).addClass("errorOnDemand");
		});
		$(selector).keyup(function() {
			if (!is_valid_email($(this).val())) {
				$(this).parent().find(":nth-child(2)").addClass("errorMessage").html(invalid_message);
			} else {
				$(this).parent().find(":nth-child(2)").removeClass("errorMessage").html(valid_message);
			}
		});

	}//if (field_type == "email") {


}//function validate() {







// JavaScript Document


function strippedTable() {
	$(".stripeMe tr").mouseover(function() {$(this).addClass("over");}).mouseout(function() {$(this).removeClass("over");});
	$(".stripeMe tr:even").addClass("alt");
}




function limitChars(textid, limit, infodiv) {
	var text = $('#'+textid).val(); 
	var textlength = text.length;
	if(textlength > limit) {
		$('#' + infodiv).html('You cannot write more then '+limit+' characters!');
		$('#'+textid).val(text.substr(0,limit));
		return false;
	} else {
		$('#' + infodiv).html('You have '+ (limit - textlength) +' characters left.');
		return true;
	}
}

