                function PopUp(Dest, Name)
                 {
                     lov_win = window.open(Dest, Name, "width=700,height=400,scrollbars=yes,resizable=yes,menubar=no,location=no");
                     lov_win.opener = self;
                 }

               function PopUpMenu(Dest, Name)
                 {
                     lov_win = window.open(Dest, Name, "width=700,height=400,scrollbars=yes,resizable=yes,menubar=yes,location=no");
                     lov_win.opener = self;
                 }
                 
	function isBlank(val) {
	if (val==null) {return true;}
	for (var i=0; i<val.length; i++) {
	if ((val.charAt(i) != ' ') && (val.charAt(i) != "\t") && (val.charAt(i) != "\n")) {
	return false;}
	}
	return true;
	}

	function validRequired(formField, fieldLabel) {
	var result=true;
	if (isBlank(formField.value)) {
	alert('Please enter a value for the "'+fieldLabel+'" field.');
	formField.focus();
	result=false;
	}
	return result;
	}

	function validateRegForm(theForm) {
	if (!validRequired(theForm.firstname, "First Name"))
	return false;

	if (!validRequired(theForm.lastname, "Last Name"))
	return false;

	if (!validRequired(theForm.organization, "Organization"))
	return false;

	if (!validRequired(theForm.phone, "Phone"))
	return false;

	if (!validRequired(theForm.password, "Password"))
	return false;

	if (!validRequired(theForm.confirmPassword, "Confirm password"))
	return false;

	if (!compare(theForm.password, theForm.confirmPassword))
	return false;


	return true;
	}

	function validatePwFinderForm(theForm) {
	if (!validRequired(theForm.finderemail, "Email"))
	return false;

	return true;
	}

	function validateUpdateForm(theForm) {
	if (!validRequired(theForm.firstname, "First Name"))
	return false;

	if (!validRequired(theForm.lastname, "Last Name"))
	return false;

	if (!validRequired(theForm.organization, "Organization"))
	return false;

	if (!validRequired(theForm.phone, "Phone"))
	return false;

	return true;
	}

function emailCheck (emailStr) { 
var checkTLD=0; 
var knownDomsPat=/ ^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/; 
var emailPat=/^(.+)@(.+)$/; 
var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]"; 
var validChars="\[^\\s" + specialChars + "\]"; 
var quotedUser="(\"[^\"]*\")"; 
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/; 
var atom=validChars + '+'; 
var word="(" + atom + "|" + quotedUser + ")"; 
var userPat=new RegExp("^" + word + "(\\." + word + ")*$"); 
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$"); 
var matchArray=emailStr.match(emailPat); 
if (matchArray==null) { 
alert("The Email Address Is Invalid"); 
return false; 
} 
var user=matchArray[1]; 
var domain=matchArray[2]; 
for (i=0; i<user.length; i++) { 
if (user.charCodeAt(i)>127) { 
alert("The Username Contains Invalid Characters."); 
return false; 
} 
} 
for (i=0; i<domain.length; i++) { 
if (domain.charCodeAt(i)>127) { 
alert("Ths Domain Name Contains Invalid Characters."); 
return false; 
} 
} 
if (user.match(userPat)==null) { 
alert("The Username Is Invalid."); 
return false; 
} 
var IPArray=domain.match(ipDomainPat); 
if (IPArray!=null) { 
for (var i=1;i<=4;i++) { 
if (IPArray>255) { 
alert("The Destination IP Address Is Invalid."); 
return false; 
} 
} 
return true; 
} 
var atomPat=new RegExp("^" + atom + "$"); 
var domArr=domain.split("."); 
var len=domArr.length; 
for (i=0;i<len;i++) { 
if (domArr[i].search(atomPat)==-1) { 
alert("The Domain Name Is Invalid."); 
return false; 
} 
} 
if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) { 
alert("The Domain Name Extension Is Invalid"); 
return false; 
} 
if (len<2) { 
alert("The Address Is Missing A Hostname."); 
return false; 
}
return true;
} 

	function compare(formField1, formField2) {
	  if (formField1.value != formField2.value) {
	  alert('Your passwords don not match.');
	  formField1.value='';
	  formField2.value='';
	  formField1.focus();
	  return false;
	  }
	  return true;
	}


	function validateFirstRegForm(theForm) {
	if (!validRequired(theForm.email, "Email"))
	return false;

	if(!emailCheck(theForm.email.value)){
	theForm.email.focus();
	return false;
	}

	if (!validRequired(theForm.password, "Password"))
	return false;

	if (!validRequired(theForm.confirmPassword, "Confirm password"))
	return false;

	if (!compare(theForm.password, theForm.confirmPassword))
	return false;

	return true;
	}


	function validateChangePwForm(theForm) {
	if (!validRequired(theForm.oldPassword, "Old Password"))
	return false;

	if (!validRequired(theForm.newPassword, "New Password"))
	return false;

	if (!validRequired(theForm.confirmPassword, "Confirm password"))
	return false;

	if (!compare(theForm.newPassword, theForm.confirmPassword))
	return false;

	return true;
	}

	function validateLoginForm(theForm) {
	if (!validRequired(theForm.email, "Email"))
	return false;

	if(!emailCheck(theForm.email.value)){
	theForm.email.focus();
	return false;
	}

	return true;
	}

	function validateEmailExistForm(theForm) {
	if (!validRequired(theForm.password, "Password"))
	return false;

	return true;
	}

	function confirmSubmit(url) {
	var agree=confirm("Are you sure you wish to unsubscribe?");
	if (agree) {
		location.href=url;
		return true;
	}
	else 
		return false;
	}
	

