function emailValid(email)
{
	var pattern=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
    if(!email.match(pattern) || email.length == 0)
        return (false);
	else
	    return(true);
}
function trim(str)
{
	while(str.substring(0,1) == ' ')
		str = str.substring(1, str.length);
	while(str.substring(str.length-1, str.length) == ' ')
		str = str.substring(0,str.length-1);
	return str;
}
function jemail(user, domain, suffix, cssClass)
{
	if(cssClass)
	{
		document.write('<a class="' + cssClass + '" href="mailto:' + user + '@' + domain + '.' + suffix + '"' + '>' + user + '@' + domain + '.' + suffix + '<' + '/' + 'a' + '>');
	}
	else
	{
		document.write('<a href="mailto:' + user + '@' + domain + '.' + suffix + '"' + '>' + user + '@' + domain + '.' + suffix + '<' + '/' + 'a' + '>');
	}
}
function jemailArea(shape, coords, user, domain, suffix)
{
	document.write('<area shape="'+shape+'" coords="'+coords+'" href="mailto:' + user + '@' + domain + '.' + suffix + '" />');
}
function popUp(url, width, height, scrollbars)
{
	var width = (width == null) ? "400" : width;
	var height = (height == null) ? "400" : height;
	var scrollbars = (scrollbars == null || scrollbars == false) ? "0" : "1";
	var screenX = (window.screen.width/2) - (width)/2;
	var screenY = (window.screen.height/2) - (height)/2;
	var child = window.open(
		url,
		"child",
		"height="+height+",width="+width+",screenX="+screenX+",screenY="+screenY+",top="+screenY+",left="+screenX+",alwaysLowered=0,alwaysRaised=0,channelmode=0,dependent=0,directories=0,fullscreen=0,hotkeys=1,location=0,menubar=0,resizable=1,scrollbars="+scrollbars+",status=1,titlebar=0,toolbar=0,z-lock=0"
	);
	child.focus();
}
function printBookmarkLink()
{
	var chr = 'Ctrl+D';
	var agt=navigator.userAgent.toLowerCase();
	if(agt.indexOf("opera") != -1) chr = 'Ctrl+T';
	if (agt.indexOf("msie") != -1)
		document.write('<a href="javascript:window.external.addFavorite(self.location,document.title)">Click here to add this page to your Favorites<\/a>');
	else 
		document.write('Press '+chr+' to bookmark this page');
}
