// JavaScript Document

function change(id, newClass) {

	
		identity=document.getElementById(id);

		identity.className=newClass;

		identity2=document.getElementById("navUL");
		identity2.className=newClass;
	
	
	if(document.layers)
	{
		alert('You are using NN 4');
	}
}

	
	
var windowOpen;

function fn_validateEmail(pFldValue,pType)

{

//////////////////////
///////// pType:
///////// 0 - strict (no whitespaces or blanks allowed)
///////// 1 - liberal (whitespaces and blanks are allowed)
//////////////////////

//////////////////////
// Error Codes returned:
// 0 - blank value
// 1 - whitespace(s)
// 2 - invalid email
//

	var l_strValue	=	pFldValue;
	var l_intType	=	pType;
	var l_intErrorCode;
	
	if(l_intType==0){
		
		if(l_strValue == "")
			return 0;
		
		if(l_strValue.match(/^\s*$/))
			return 1;
		
		if(!l_strValue.match(/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/)){
			return 2;
		}
		else
		{
			return 3;
		}
		
		
	}
	
	if(l_intType==1){
		
		if(!l_strValue=="" && !l_strValue.match(/^\s*$/)){
			if(!l_strValue.match(/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/))
				return 2;
		}
		
	}

}

function fn_CheckEmail()  
{
	var l_strResult = fn_validateEmail(document.frmNewsletter.txtEmail.value,0);
	
	
	switch (l_strResult){
		case 0:
			alert("ERROR: Please enter your email address!");
			document.frmNewsletter.txtEmail.focus();
			return false;
		break
		case 1:
			alert("ERROR: Email address cannot be composed of all spaces!");
			document.frmNewsletter.txtEmail.focus();
			return false;
		break
		
		case 2:
			alert("ERROR: Please enter a valid email address!");
			document.frmNewsletter.txtEmail.focus();
			return false;
		break;
	
	}
	
	var m_js_nTop=parseInt((screen.height-400)/2);
	var m_js_nLeft=parseInt((screen.width-400)/2);
	var stats="toolbar=no,location=no,directories=no,status=no,menubar=no,resizeable=no,width=445,height=280,top="+m_js_nTop+",left="+m_js_nLeft;
	windowOpen=window.open("http://www.elliottdist.com/subscribe.php?txtEmail="+document.frmNewsletter.txtEmail.value,'Subscription',stats);
	
//	return false;
	
}