
	
	function categoryDescription( url )
	{
		DescriptionWindow = window.open( url, "Description", "width=390,height=290,scrollbars=yes" );
	}
	
	function Popup( url )
	{
		PopupWindow = window.open( url ); PopupWindow.focus();
	}
	
	function closeWindow()
	{
		window.close();
	}
	
	function prev()
	{
		history.back();
	}
	
	function stripSpaces(x) 
	{
	    while (x.substring(0,1) == ' ') x = x.substring(1);
	    return x;
	}

	function PopupBrowser( url, width, height )
	{
		PopupWindow = window.open( url, "PopupWindow", "width=" + width + ",height=" + height + ",location=no,scrollbars=yes,alwaysRaised=yes,status=yes,resizable=yes" ); PopupWindow.focus();
	}
	function PopupEx( url, width, height )
	{
		PopupWindow = window.open( url, "PopupWindow", "width=" + width + ",height=" + height + ",location=no" ); PopupWindow.focus();
	}
	function empty(x) 
	{ 
		var test = stripSpaces(x);
		
		if( test.length > 0 ) 
			return false; 
		else 
			return true; 
	}
	
	function isEmail(str) {
		// are regular expressions supported?
		var supported = 0;
		if (window.RegExp) {
		  var tempStr = "a";
		  var tempReg = new RegExp(tempStr);
		  if (tempReg.test(tempStr)) supported = 1;
		}
		if (!supported) 
		  return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
		var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
		var r2 = new RegExp("^[a-zA-Z0-9_\\-\\.]+@[a-zA-Z0-9_\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})$");
		return (!r1.test(str) && r2.test(str));
	}
               	
	
	function submitForm( theEmailForm )
	{
		var email = stripSpaces( theEmailForm.email.value );
		 
		if( !isEmail( email ) ) 
		{
			alert('Please enter a valid email address');
			
			return false
		}
		else
		{
			if( theEmailForm.NewsLetterType[0].checked == false &&
				theEmailForm.NewsLetterType[1].checked == false &&
				theEmailForm.NewsLetterType[2].checked == false)
			{
				alert('Please choose at least one newsletter to subscribe to.');
				
				return false
			}
			else
			{
				return true;
			}
		}
	}
	

