function doNewsletterSignup() {
	
	var e = document.getElementById('newsSignup').value;
	if (ts(e).length < 1) {
		alert('Please enter your email address.');
	} else {
		
		if (isValidEmail(e)) {
			location.href='newsletter_register.php?e='+e;
		} else {
			alert('It appears that the email address that you entered is not valid. Please enter a valid email address.');
			document.getElementById('newsSignup').value='';
		}
	}
}

function doSiteSearch() {
	
	var q = document.getElementById('siteSearch').value;
	if (ts(q).length > 1) {
		location.href='search.php?q='+q;
	} else {
		alert('Please enter a keyword.');
	}
	
}

// Trim a string
function ts(sInString) {
  sInString = sInString.replace( /^\s+/g, "" );// strip leading
  return sInString.replace( /\s+$/g, "" );// strip trailing
}

function isValidEmail(str) {
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);

}

function newsCastWindow(url, name) {
	popupWin = window.open(url, name, 'menubar=no, status=no, toolbars=no, resizable=yes, scrollbars=yes, width=320,height=277, screenX=50, left=50, screenY=50, top=50');
	popupWin.focus();
}

function connWarmingWin(url, name) {
	popupWin = window.open(url, name, 'menubar=no, status=no, toolbars=no, resizable=yes, scrollbars=yes, width=700,height=680, screenX=50, left=50, screenY=50, top=50');
	popupWin.focus();
}