function checknewsf1(){
var em = document.newsform.newsemail.value;
var emailFilter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if(em.length<1 || !em.match(emailFilter))
{
 showErrMsg("Please type a valid email address",0,-30,"newscontainer");
 return false;
}
return true;
}

function showErrMsg(txt,left,top,cID){
var pos=getContainerPosition(cID);
var divE=document.createElement("div");
    divE.id="tempDivNews";
    divE.style.position="absolute";
    divE.style.zIndex="5";
    divE.style.textAlign="center";
    divE.style.backgroundColor="yellow";
    divE.style.fontWeight="bold";
    divE.style.fontStyle="italic";
    divE.style.top=pos.top+top+5+"px";
    divE.style.left=pos.left+left+"px";
    divE.style.fontSize="1.2em";
    divE.innerHTML=txt;
    document.body.appendChild(divE); 
    setTimeout("hideErrMsg()",2000);   
}

function getContainerPosition(stepid){
var parent=document.getElementById(stepid);
var leftt=0;
var topp=0;
while(parent){
                    leftt+=parent.offsetLeft;
					topp+=parent.offsetTop;
					parent=parent.offsetParent;
			}
if(navigator.userAgent.indexOf("Mac") != -1 && typeof document.body.leftMargin != "undefined"){
                    topp+=document.body.topMargin;
					leftt+=document.body.leftMargin;
					} 			
return {left:leftt,top:topp}
}

function hideErrMsg(){
  if(document.getElementById("tempDivNews")) document.body.removeChild(document.getElementById("tempDivNews"));
}

function checknewsf2()
{
var emailFilter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
var val = document.newsform.FNAME.value;
if(val.length<1){
 showErrMsg("Please type your first name",0,-30,"newscontainer");
 return false;
}
val = document.newsform.LNAME.value;
if(val.length<1){
 showErrMsg("Please type your last name",0,-30,"newscontainer");
 return false;
}
val = document.newsform.EMAIL.value;
if(val.length<1 || !val.match(emailFilter)){
 showErrMsg("Please type a valid email",0,-30,"newscontainer");
 return false;
}
var val2 = document.newsform.EMAIL2.value;
if(val != val2){
 showErrMsg("Please confirm the email address",0,-30,"newscontainer");
 return false;
}
val = document.newsform.STATE.value;
if(val.length<1){
 showErrMsg("Please select your state",0,-30,"newscontainer");
 return false;
}
return true;
}