// General JS functions

function enewsform(field){
if(document.getElementById(field).value == ""){
return false;
} else {
	f5 = document.getElementById(field).value;
	checkemailnow = 0;
  		at="@";
		dot=".";
		lat= f5.indexOf(at);
		lstr= f5.length;
		ldot= f5.indexOf(dot);
		if (f5.indexOf(at)==-1){
		   checkemailnow++;
		}

		if (f5.indexOf(at)==-1 || f5.indexOf(at)==0 || f5.indexOf(at)==lstr){
		   checkemailnow++;
		}

		if (f5.indexOf(dot)==-1 || f5.indexOf(dot)==0 || f5.indexOf(dot)==lstr){
		    checkemailnow++;
		}

		 if (f5.indexOf(at,(lat+1))!=-1){
		    checkemailnow++;
		 }

		 if (f5.substring(lat-1,lat)==dot || f5.substring(lat+1,lat+2)==dot){
		    checkemailnow++;
		 }

		 if (f5.indexOf(dot,(lat+2))==-1){
		    checkemailnow++;
		 }
		
		 if (f5.indexOf(" ")!=-1){
		    checkemailnow++;
		 }
		 
		if (checkemailnow > 0){
				document.getElementById(field).value = "";
				document.getElementById('email').style.borderColor = "red";
				document.getElementById('email').style.backgroundColor = "yellow";
				return false
		} else{
			document.getElementById('email').style.borderColor = "#888888";
			document.getElementById('email').style.backgroundColor = "white";
			document.enews.action = "NEWStracsprocess.php";
			document.enews.submit();
			return true
		}
}

}

function enewsformemail(field){
document.getElementById(field).style.backgroundPosition = "0px -30px";
}
function enewsformemail2(field){
var f5 = document.getElementById(field).value;
if(document.getElementById(field).value == ""){
document.getElementById(field).style.backgroundPosition = "0px 0px";
} else{
checkemailnow = 0;
  		at="@";
		dot=".";
		lat= f5.indexOf(at);
		lstr= f5.length;
		ldot= f5.indexOf(dot);
		if (f5.indexOf(at)==-1){
		   checkemailnow++;
		}

		if (f5.indexOf(at)==-1 || f5.indexOf(at)==0 || f5.indexOf(at)==lstr){
		   checkemailnow++;
		}

		if (f5.indexOf(dot)==-1 || f5.indexOf(dot)==0 || f5.indexOf(dot)==lstr){
		    checkemailnow++;
		}

		 if (f5.indexOf(at,(lat+1))!=-1){
		    checkemailnow++;
		 }

		 if (f5.substring(lat-1,lat)==dot || f5.substring(lat+1,lat+2)==dot){
		    checkemailnow++;
		 }

		 if (f5.indexOf(dot,(lat+2))==-1){
		    checkemailnow++;
		 }
		
		 if (f5.indexOf(" ")!=-1){
		    checkemailnow++;
		 }
		 
		if (checkemailnow > 0){
				document.getElementById(field).value = "";
				document.getElementById('email').style.borderColor = "red";
				document.getElementById('email').style.backgroundColor = "yellow";
		} else{
			document.getElementById('email').style.borderColor = "#888888";
			document.getElementById('email').style.backgroundColor = "white";
		}
}
}