// espOngov.js
window.onload=function(){init();}

// newFunction
function init() {
//alert(hey!);
//var formPrefix = "form1;";
//document.getElementById("form1:groupddl").style.visibility="visible";
}

function hideGroupTitles(thisObj, thisEvent) {
//var v = thisObj.value;
//if(v == "2"){
//document.getElementById("form1:groupddl").style.visibility="hidden";
//}else if(v == "1"){
//document.getElementById("form1:groupddl").style.visibility="visible";
//}
}


function popup(mylink, windowname,w,h,l,t) {
//mylink = what you're linking to
//windowname = used to identify the window to the programmer(optional)
//w=width
//h=heigth
//l=from left side
//t=from top
//get focus
if (! window.focus)return true;
var href;
var location;
location= "width=" + w + ",height=" + h + ",left=" + l + ",top="+ t + ",scrollbars=yes";
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
  window.open(href,windowname,location );
  return false;
}


// Email Validation Javascript
// copyright 23rd March 2003, by Stephen Chapman, Felgall Pty Ltd

// You have permission to copy and use this javascript provided that
// the content of the script is not changed in any way.

// Customized on 5th December 2008, by Ron Lewis, Onondaga County IT
// for espOngov.js integration.  Removed mandatory (man) and messages (db)
// boolean control input to echeck.  These are both true for esp.
// See email.js for original reference.

function echeck(str) {
if (str == null) {
   alert('email address is mandatory');
   return false;
}
if (str == '') {
   alert('email address is mandatory');
   return false;
}
var invalidChars = '\/\'\\ ",;:?!()[]\{\}^|';
for (i=0; i<invalidChars.length; i++) {
   if (str.indexOf(invalidChars.charAt(i),0) > -1) {
      alert('email address contains invalid characters');
      return false;
   }
}
for (i=0; i<str.length; i++) {
   if (str.charCodeAt(i)>127) {
      alert("email address contains non ascii characters.");
      return false;
   }
}

var atPos = str.indexOf('@',0);
if (atPos == -1) {
   alert('email address must contain an @');
   return false;
}
if (atPos == 0) {
   alert('email address must not start with @');
   return false;
}
if (str.indexOf('@', atPos + 1) > - 1) {
   alert('email address must contain only one @');
   return false;
}
if (str.indexOf('.', atPos) == -1) {
   alert('email address must contain a period in the domain name');
   return false;
}
if (str.indexOf('@.',0) != -1) {
   alert('period must not immediately follow @ in email address');
   return false;
}
if (str.indexOf('.@',0) != -1){
   alert('period must not immediately precede @ in email address');
   return false;
}
if (str.indexOf('..',0) != -1) {
   alert('two periods must not be adjacent in email address');
   return false;
}
var suffix = str.substring(str.lastIndexOf('.')+1);
if (suffix.length != 2 && suffix != 'com' && suffix != 'net' && suffix != 'org' && suffix != 'edu' && suffix != 'int' && suffix != 'mil' && suffix != 'gov' && suffix != 'arpa' && suffix != 'biz' && suffix != 'aero' && suffix != 'name' && suffix != 'coop' && suffix != 'info' && suffix != 'pro' && suffix != 'museum' && suffix != 'us' && suffix != 'ca' && suffix != 'firm') {
   alert('invalid primary domain in email address');
   return false;
}
return true;
}

function ValidateForm(){
	var emailID=document.getElementById("form1:emailAddress")
//	alert("here");
//	if ((emailID.value==null)||(emailID.value=="")){
//		alert("Please Enter your Email ID")
//		emailID.focus()
//		return false
//	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }

