// email obfuscator to confuse spiders looking to harvest email addresses
function jemail(user,domain,suffix,linkText,cssClass){
	var cssText = "";
	if(cssClass){
		cssText = ' class="'+cssClass+'"';
	}
	if(linkText){
		document.write('<a href="'+'mailto:'+user+'@'+domain+'.'+suffix+'"'+cssText+'>'+linkText+'</a>');
	} else{
		document.write('<a href="'+'mailto:'+user+'@'+domain+'.'+suffix+'"'+cssText+'>'+user+'@'+domain+'.'+suffix+'</a>');
	}
}


// this function will validate form elements and determine if an error message is needed
// a = array of elements to be checked
// b = the name of the form we are looking at
function validateForm(a,b){
	result = 1;
	errorString = '';
	oForm = document.forms[b];
	orig = oForm.elements['go'].value;
	oForm.elements['go'].value = "Please Wait...";
	for(x in a){
		if(a[x].indexOf("content") >= 0){
			val = tinyMCE.get(a[x]).getContent();	// this is needed to specifically check the tiny mce fields
		}else{
			val = oForm.elements[a[x]].value;
		}
		if(val == '' || val == 'Name*' || val == 'Email*' || val == 'Comments*'){
			result = 0;
			str = a[x];
			str = str.replace(/_/," ");
			errorString += '- '+str+'\n';
			if(b != "login"){
				document.getElementById([a[x]]).style.color="#ff0000";
			}
		}else{
			if(b != "login"){
				document.getElementById([a[x]]).style.color="#ffffff";
			}
		}
	}
	if(result == 0){
		alert("FORM ERROR\n\nThe following form elements are required to continue:\n"+errorString+"\n\nNOTE: the titles of fields with errors have been highlighted red");
		oForm.elements['go'].value = orig;
		return result;
	}else{
		return result;
	}
}
