function ValidateEmail(obj){ 
     string = obj.value; 
     var emailFilter=/^\s*[\w\.-]+@[\w\.-]+\.[a-z]{2,4}\s*$/i; 
     var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/ 
     return (emailFilter.test(string) && !string.match(illegalChars) && (string != "")); 
      
}

function ValidateUrl(obj){ 
     string = obj.value; 

     if (!string.match(/^https?\:\/\//i)) { string = 'http://' + string; }
     if (!string.match(/^(https?\:\/\/)(www\.)?[a-zA-Z0-9\.-]+\.+[\w]{2,4}/)) { 
         return false; 
     } else {
		obj.value = string;
		return true; 
	}
}

function ValidateReg() {
	var oU = document.getElementById('txtRegUsername');
	if (trim(oU.value).length < 5) {
		alert('Please enter a valid username of at least 5 characters.');
		oU.focus()
		return false;
	}
	if (!oU.value.match(/^[\w\_ \-]+$/)) {
		alert('Sorry, there are invalid characters in your username. Please try again.\nUsernames can contain letters, numbers, dashes and underscores.');
		oU.focus();
		return false;
	}

	var oE = document.getElementById('txtRegEmail');
	if (!ValidateEmail(oE)) {
		alert('Please enter a valid email address.');
		oE.focus();
		return false;
	}
	return true;
}



