function validateEmail(emailad) {
	
	var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
	var check=/@[\w\-]+\./;
	var checkend=/\.[a-zA-Z]{2,3}$/;
	
		if(((emailad.search(exclude) != -1)||(emailad.search(check)) == -1)||(emailad.search(checkend) == -1)){
			return true;
		}
		else {
			return false;
		}
	}
	
	function LTrim(str) {
		var whitespace = new String(" \t\n\r");
		var s = new String(str);
		if (whitespace.indexOf(s.charAt(0)) != -1) {
		var j=0, i = s.length; 
		while (j < i && whitespace.indexOf(s.charAt(j)) != -1) 
		j++; 
		s = s.substring(j, i); } 
		return s; } 
	function RTrim(str) {
		var whitespace = new String(" \t\n\r"); 
		var s = new String(str); 
		if (whitespace.indexOf(s.charAt(s.length-1)) != -1){ 
		var i = s.length - 1; // Get length of string 
		while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
		i--; 
		s = s.substring(0, i+1); }
		return s; }
	function Trim(str) { return RTrim(LTrim(str)); }
	
	function validateEzineReg(form) {
	
		if (Trim(document.ezine.name.value).length<3){
			alert("You must fill in the following field: \n Please enter your name!");
			document.ezine.name.focus();
			return false;
		}
		else if (Trim(document.ezine.company.value).length<3){
			alert("You must fill in the following field: \n Please enter your company!");
			document.ezine.company.focus();
			return false;
		}
		else if(validateEmail(form.email.value)){
			alert("You must fill in the following field: \n Please enter a valid email address!");
			document.ezine.email.focus();
			return false;
		}
		else {
			return true;
		}
	}
	
	function validateCampaignMug(){
		if (Trim(document.frmcampaign.txtname.value).length<3){
			alert("You must fill in the following field: \n Please enter your name!");
			document.frmcampaign.txtname.focus();
			return false;
		}
		else if (Trim(document.frmcampaign.txtposition.value).length<3){
			alert("You must fill in the following field: \n Please enter your position!");
			document.frmcampaign.txtposition.focus();
			return false;
		}
		else if (Trim(document.frmcampaign.txtcompany.value).length<3){
			alert("You must fill in the following field: \n Please enter your company!");
			document.frmcampaign.txtcompany.focus();
			return false;
		}
		else if (Trim(document.frmcampaign.txtaddress.value).length<3){
			alert("You must fill in the following field: \n Please enter your address!");
			document.frmcampaign.txtaddress.focus();
			return false;
		}
		else if(validateEmail(document.frmcampaign.txtemail.value)){
			alert("You must fill in the following field: \n Please enter a valid email address!");
			document.frmcampaign.txtemail.focus();
			return false;
		}
		else if (document.frmcampaign.agreeterms.checked==false){
			alert("You must agree with the Terms and Conditions");
			document.frmcampaign.agreeterms.focus();
			return false;
		}
		else {
			return true;
		}
	}
	
function do_action(n) //select actions, keyed to option value
{
switch(n)
{
	default : undisplay('interestdetails'); break;
	case 'Media': case 'Other': display('interestdetails'); break;
}
}

function display() //show element
{
var id, el, a = 0;
for (a; a < arguments.length; ++a)
{
id = arguments[a];
if (el = document.getElementById(arguments[a]))
el.style.display = '';
}
}

function undisplay() //un-show element
{
var id, el, a = 0;
for (a; a < arguments.length; ++a)
{
id = arguments[a];
if (el = document.getElementById(arguments[a]))
el.style.display = 'none';
}
}