
// ********************************
// ********************************
// User-defined JavaScript
// ********************************
// ********************************



// ********************
// Function to validate Email address

function validate_email(form,field,val) {	with (field) {		apos=value.indexOf("@")		dotpos=value.lastIndexOf(".")		onlyone=value.split("@")		var illegalChars= /[\(\)\{\}\<\>\, \$\%\!\#\|\`\;\:\\\/\"\[\]]/		if (apos<1||dotpos-apos<2) {			alert("Not a valid e-mail address!");			return false		} else if (onlyone.length>2) {			alert("Please enter only one email at a time");			return false		} else if (value.match(illegalChars)) {			alert("This email address contains illegal characters. Please try again");			return false		} else {			return true					}		}}function validate_Eform(thisform) {	with(thisform) {		if (validate_email(this,email,email.value)==false) {			email.focus();			return false		}	}}

// End Function Validate_email..
// **********************************************************************





// ********************
// Function to Track clicks (weblink clicks, sidebar ad) (header add uses form structure in Application file)

function trackReferral (RefcontactID)
{
	var SPing = new Image();
	SPing.src = ('/weblinks/track_webreferrals.cfm?contactID='+ RefcontactID);
	return;
}





// ********************
// Function to toggle sections open and closed

	function toggleDiv(divid, link, action) {

		// action is optional. 1 = show it. 0 = hide it.

		action = action || (document.getElementById(divid).style.display == 'none')

		if(action){
			document.getElementById(divid).style.display = 'block';
			document.getElementById(link).innerHTML = 'hide';
 		}else{
			document.getElementById(divid).style.display = 'none';
			document.getElementById(link).innerHTML = 'show';
    		}

  	}



