function validEmail(str) {
	if (str.match(/^[a-z0-9\-\_]+(\.[a-z0-9\-\_]+)*@[a-z0-9\-\_]+(\.[a-z0-9\-\_]+)*(\.[a-z]{2,6})$/i)) {
		return true;
	} else { return false; }
}

function validLink(str) {
	if (str.match(/^(https?):\/\/([a-z0-9\-\_]+\.)+([a-z]{1,5}[^\.])(\/[^<>]+)*$/i)) {
		return true;
	} else { return false; }
}

function isNumeric(str,usePeriod) {
	matchStr='/[^0-9';
	if (usePeriod) {
		matchStr+='\.';
	}
	matchStr=']/';

	if (str.match(matchStr)) { return false; }
	return true;
}

function validDate(theDate) {
	days=0;

	theDate=theDate.split("/");
	month=theDate[0];
	day=theDate[1];
	year=theDate[2];

	if (!isNumeric(month) || !isNumeric(day) || !isNumeric(year)) { return false; }

	if (month==1) { days=31; }
	else if (month==2) { if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) { days=29; } else { days=28; }}
	else if (month==3) { days=31; }
	else if (month==4) { days=30; }
	else if (month==5) { days=31; }
	else if (month==6) { days=30; }
	else if (month==7) { days=31; }
	else if (month==8) { days=31; }
	else if (month==9) { days=30; }
	else if (month==10) { days=31; }
	else if (month==11) { days=30; }
	else if (month==12) { days=31; }

	if (day>days || day==undefined || days==undefined || month==undefined || year==undefined || year.length<4) { return false; } else { return true; }
}

function showError(field,alertStr) {
	$(field).addClass('elem_error');
	$(field).focus();

// RJ: Too lazy to fix this right now
//	if($(field).get(0).type != "select-one") {
//		$(field).bind('onkeypress', clearElemError);
//	} else {
//		$(field).bind('onchange', clearElemError);
//	}

	if (alertStr!="") { alert(alertStr); }
	return false;
}

function clearElemError(evt) {
//	$(this).removeClass('elem_error');

//	if(this.type != "select-one") {
//		$(this).unbind('onkeypress', clearElemError);
//	} else {
//		$(this).unbind('onchange', clearElemError);
//	}
}
