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' + '>');
	}
}
var child;
function popUp(url, width, height, scrollbars, allNormalExtras, windowToCloseFirst)
{
	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 menubar = '0';
	var location = '0';
	var titlebar = '0';
	var toolbar = '0';
	if(allNormalExtras != null && allNormalExtras == true)
	{
		var menubar = '1';
		var location = '1';
		var titlebar = '1';
		var toolbar = '1';
	}
	if(windowToCloseFirst)
		windowToCloseFirst.close();
	child = window.open(
		url,
		"",
		"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="+location+",menubar="+menubar+",resizable=1,scrollbars="+scrollbars+",status=1,titlebar="+titlebar+",toolbar="+toolbar+",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');
}

//SafeOnload()
isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;
NS4 = (document.layers) ? true : false;
IEmac = ((document.all)&&(isMac)) ? true : false;
IE4plus = (document.all) ? true : false;
IE4 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 4.")!=-1)) ? true : false;
IE5 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 5.")!=-1)) ? true : false;
ver4 = (NS4 || IE4plus) ? true : false;
NS6 = (!document.layers) && (navigator.userAgent.indexOf('Netscape')!=-1)?true:false;
// Body onload utility (supports multiple onload functions)
var gSafeOnload = new Array();
function SafeAddOnload(f)
{
	if(IEmac && IE4) // IE 4.5 blows out on testing window.onload
	{
		window.onload = SafeOnload;
		gSafeOnload[gSafeOnload.length] = f;
	}
	else if (window.onload)
	{
		if (window.onload != SafeOnload)
		{
			gSafeOnload[0] = window.onload;
			window.onload = SafeOnload;
		}
		gSafeOnload[gSafeOnload.length] = f;
	}
	else
		window.onload = f;
}
function SafeOnload()
{
	for(var i=0;i<gSafeOnload.length;i++)
		gSafeOnload[i]();
}

