function showCustomPopUp(theUrl,name,options) {
	window.open(theUrl,name,options);
}

function trimString (str) {
	while (str.charAt(0) == ' ') {
		str = str.substring(1);
	}
	while (str.charAt(str.length - 1) == ' ') {
		str = str.substring(0, str.length - 1);
	}
	return str;
}


function emailCheck(type) {
	var email = trimString(document.emailForm.emailAddress.value);

    if (!validEmail(email)) {
		alert('Please enter a valid e-mail address.');
		return false;
	}
	if (type == 1) {
		document.emailForm.submit();
	}
}

function validEmail(email) {
	var vAtSym    = email.indexOf('@')
	var vPeriod   = email.lastIndexOf('.')
	var vSpace    = email.indexOf(' ')
	var vLength   = email.length - 1   // Array is from 0 to length-1

	if (vAtSym < 1 ||                     // '@' cannot be in first position
		vPeriod <= vAtSym + 1 ||          // Must be atleast one valid char btwn '@' and '.'
		vPeriod == vLength  ||            // Must be atleast one valid char after '.'
		vSpace  != -1)                    // No empty spaces permitted
	{
		return false;
	}
	return true;
}