function genaddress0( user, domain ) {
        var atsign = "&#64;";
        var addr = user + atsign + domain;
        document.write("<" + "a" + " " + "href=" + "mail" + "to:" + addr + ">" + addr + "<\/a>");
      }

function genaddress( user, domain, name ) {
        var atsign = "&#64;";
        var addr = user + atsign + domain;
        document.write("<" + "a" + " " + "href=" + "mail" + "to:" + addr + ">" + name + "<\/a>");
      }

function genaddress2( user, domain, name, color ) {
        var atsign = "&#64;";
        var addr = user + atsign + domain;
        document.write("<" + "a" + " " + "href=" + "mail" + "to:" + addr + "><font color=" + color + ">" + name + "<\/font><\/a>");
      }

function genaddress3( user, domain, name ) {
        var atsign = "&#64;";
        var addr = user + atsign + domain;
        document.write(addr);
      }
	  
function genaddress4( user, domain ) {
        var atsign = "&#64;";
        var addr = user + atsign + domain;
        document.write("<" + "a" + " " + "href=" + "mail" + "to:" + addr + ">" + addr + "<\/a>");
      }

function cleanCAPS(str) 
{
	capsallowed = 10; 
	do {
		eval("re = /([A-Z]{" + (capsallowed+1) + ",})/g;");
		myArray = str.match(re);
		if (myArray) {
			eval("re = /" + myArray[0] + "/;");
			str = str.replace(re, ""+myArray[0].toLowerCase());}
	} while (myArray);
	return str;
}

function openWindow(Vpage, Vheight, Vwidth) 
{
    Vtmp='toolbar=no,status=no,location=no,directories=no,menubar=no,scrollbars=yes,width='+Vwidth+',height='+Vheight
	floater=window.open(Vpage,"",Vtmp)     
}

function cfmbuttonclick(Vmsg) 
{if (confirm(Vmsg)) {return true} else {return false}}

function ComputeDues(Varoc,Vchapter)
{
Subtot=parseInt(Varoc)+parseInt(Vchapter);
return Subtot;
}


function cfmdelclass() 
{if (confirm("Do you really want to delete this classified ?")) {return true} else {return false}}

function cfmlaunch() 
{if (confirm("Do you really want to launch this program ?")) {return true} else {return false}}


function cfmdelgal() 
{if (confirm("Do you really want to delete this gallery entry ?")) {return true} else {return false}}

function cfmdelpost() 
{if (confirm("Do you really want to delete this post ?")) {return true} else {return false}}

function cfmdel() 
{if (confirm("Do you really want to delete this record ?")) {return true} else {return false}}

function cfmok() 
{if (confirm("Do you want to submit this form ?")) {return true} else {return false}}

function cfmcan() 
{if (confirm("Do you really want to cancel the changes made to this form ?")) {return true} else {return false}}

function cfmupload() 
{if (confirm("Do you really want to upload this file ?")) {return true} else {return false}}

function cfmsubprint() 
{if (confirm("Do you really want to submit this form ? Did you print a copy for your records ?")) {return true} else {return false}}


function MailCheck (emailStr, Vver1, Vver2, Vmsg) {
var checkTLD=1;
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("Email address seems incorrect (check @ and .'s)");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];
for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
alert("Email address error: username contains invalid characters.");
return false;
   }
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
alert("Email address error: domain name contains invalid characters.");
return false;
   }
}
if (user.match(userPat)==null) {
alert("Email address error: username doesn't seem to be valid.");
return false;
}
var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {
for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert("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("Email address error: domain name does not seem to be valid.");
return false;
   }
}
if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {
alert("Email address error: address must end in a well-known domain or two letter " + "country.");
return false;
}
if (len<2) {alert("Email address error: address is missing a hostname!");return false;}
Vver2=Vver2/3;
if (Vver1 != Vver2) {	alert ("\nWrong verification code,  please re-enter the code shown above the submit button.")
	return false;
	}
if (confirm(Vmsg)) {return true} else {return false}
return true;
}


function AppCheck (Vfn,Vln,Vad1,Vcit,Vsta,Vzip,emailStr, Vver1, Vver2, Vmsg) {
var checkTLD=1;
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("Email address empty or invalid : make sure you entered your email address and that it is valid (includes @  . and a valid domain extension)");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];
for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
alert("Email address error: username contains invalid characters.");
return false;
   }
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
alert("Email address error: domain name contains invalid characters.");
return false;
   }
}
if (user.match(userPat)==null) {
alert("Email address error: username doesn't seem to be valid.");
return false;
}
var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {
for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert("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("Email address error: domain name does not seem to be valid.");
return false;
   }
}
if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {
alert("Email address error: address must end in a well-known domain or two letter " + "country.");
return false;
}
if (len<2) {alert("Email address error: address is missing a hostname!");return false;}

var len=Vfn.length;
if (len<1) {alert("Please enter your first name !");return false;}

var len=Vln.length;
if (len<1) {alert("Please enter your last name !");return false;}

var len=Vad1.length;
if (len<1) {alert("Incomplete address, please enter your address !");return false;}

var len=Vcit.length;
if (len<1) {alert("Incomplete address, please enter your city !");return false;}

var len=Vsta.length;
if (len<1) {alert("Incomplete address, please enter your state !");return false;}

var len=Vzip.length;
if (len<1) {alert("Incomplete address, please enter your Zip code !");return false;}



Vver2=Vver2/3;
if (Vver1 != Vver2) {	alert ("\nWrong verification code, please re-enter the code shown above the submit button.")
	return false;
	}
if (confirm(Vmsg)) {return true} else {return false}
return true;
}




function ForRegCheck (emailStr,pwd1,pwd2,uname) {

/* The following variable tells the rest of the function whether or not to verify that the address ends in a two-letter country or well-known TLD.  1 means check it, 0 means don't. */

var checkTLD=1;

/* The following is the list of known TLDs that an e-mail address must end with. */

var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;

/* The following pattern is used to check if the entered e-mail address fits the user@domain format.  It also is used to separate the username from the domain. */

var emailPat=/^(.+)@(.+)$/;

/* The following string represents the pattern for matching all special characters.  We don't want to allow special characters in the address.  These characters include ( ) < > @ , ; : \ " . [ ] */

var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";

/* The following string represents the range of characters allowed in a username or domainname.  It really states which chars aren't allowed.*/ 

var validChars="\[^\\s" + specialChars + "\]";

/* The following pattern applies if the "user" is a quoted string (in which case, there are no rules about which characters are allowed and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com is a legal e-mail address. */

var quotedUser="(\"[^\"]*\")";

/* The following pattern applies for domains that are IP addresses,rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal e-mail address. NOTE: The square brackets are required. */

var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

/* The following string represents an atom (basically a series of non-special characters.) */

var atom=validChars + '+';

/* The following string represents one word in the typical username. For example, in john.doe@somewhere.com, john and doe are words. Basically, a word is either an atom or quoted string. */

var word="(" + atom + "|" + quotedUser + ")";

// The following pattern describes the structure of the user

var userPat=new RegExp("^" + word + "(\\." + word + ")*$");

/* The following pattern describes the structure of a normal symbolic
domain, as opposed to ipDomainPat, shown above. */

var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

/* Finally, let's start trying to figure out if the supplied address is valid. */

/* Begin with the coarse pattern to simply break up user@domain into different pieces that are easy to analyze. */

var matchArray=emailStr.match(emailPat);

if (matchArray==null) {

/* Too many/few @'s or something; basically, this address doesn't even fit the general mould of a valid e-mail address. */

alert("Email address seems incorrect (check @ and .'s)");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];

// Start by checking that only basic ASCII characters are in the strings (0-127).

for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
alert("Email address error: username contains invalid characters.");
return false;
   }
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
alert("Email address error: domain name contains invalid characters.");
return false;
   }
}

// See if "user" is valid 

if (user.match(userPat)==null) {

// user is not valid

alert("Email address error: username doesn't seem to be valid.");
return false;
}

/* if the e-mail address is at an IP address (as opposed to a symbolic host name) make sure the IP address is valid. */

var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {

// this is an IP address

for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert("Destination IP address is invalid!");
return false;
   }
}
return true;
}

// Domain is symbolic name.  Check if it's valid.
 
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("Email address error: domain name does not seem to be valid.");
return false;
   }
}

/* domain name seems valid, but now make sure that it ends in a known top-level domain (like com, edu, gov) or a two-letter word, representing country (uk, nl), and that there's a hostname preceding  the domain or country. */

if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {
alert("Email address error: address must end in a well-known domain or two letter " + "country.");
return false;
}

// Make sure there's a host name preceding the domain.

if (len<2) {alert("Email address error: address is missing a hostname!");return false;}

if (pwd1 != pwd2) {	alert ("\nYour passwords do not match, please re-enter them.")
	return false;
	}

var lenpwd=pwd1.length;
if (lenpwd<1) {alert("Please enter a password !");return false;}
	
var lenuname=uname.length;
if (lenuname<1) {alert("Please enter your name !");return false;}

if (confirm("Do you want to save this data ?")) {return true} else {return false}
// If we've gotten this far, everything's valid!
return true;
}


function AppCheckS (emailStr,fn,ln,ad1,city,sta,zip,hnr,enr) {

if (enr<hnr) {alert("Please enter the validation number !");return false;}

var checkTLD=1;
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("Email address empty or invalid : make sure you entered your email address and that it is valid (includes @  . and a valid domain extension)");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];

for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
alert("Email address error: username contains invalid characters.");
return false;
   }
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
alert("Email address error: domain name contains invalid characters.");
return false;
   }
}

if (user.match(userPat)==null) {
alert("Email address error: username doesn't seem to be valid.");
return false;
}

var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {
for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert("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("Email address error: domain name does not seem to be valid.");
return false;
   }
}

if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {
alert("Email address error: address must end in a well-known domain or two letter " + "country.");
return false;
}

if (len<2) {alert("Email address error: address is missing a hostname!");return false;}

var lenfn=fn.length;
if (lenfn<1) {alert("Please enter a first name !");return false;}
	
var lenln=ln.length;
if (lenln<1) {alert("Please enter a last name !");return false;}

var lenad1=ad1.length;
if (lenad1<1) {alert("Please enter an address on the first address line !");return false;}

var lencit=city.length;
if (lencit<1) {alert("Please enter a city !");return false;}

var lensta=sta.length;
if (lensta<2) {alert("Please enter a state or province !");return false;}

var lenzip=zip.length;
if (lenzip<5) {alert("Please enter a zip or postal code !");return false;}

if (confirm("Do you want to submit this application ?")) {return true} else {return false}

return true;
}


function JCCCheck (emailStr,fn,ad1,city,sta,zip,phone) {

var checkTLD=1;
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("Email address empty or invalid : make sure you entered your email address and that it is valid (includes @  . and a valid domain extension)");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];

for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
alert("Email address error: username contains invalid characters.");
return false;
   }
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
alert("Email address error: domain name contains invalid characters.");
return false;
   }
}

if (user.match(userPat)==null) {
alert("Email address error: username doesn't seem to be valid.");
return false;
}

var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {
for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert("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("Email address error: domain name does not seem to be valid.");
return false;
   }
}

if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {
alert("Email address error: address must end in a well-known domain or two letter " + "country.");
return false;
}

if (len<2) {alert("Email address error: address is missing a hostname!");return false;}

var lenfn=fn.length;
if (lenfn<1) {alert("Please enter a first name !");return false;}

var lenad1=ad1.length;
if (lenad1<1) {alert("Please enter an address on the first address line !");return false;}

var lencit=city.length;
if (lencit<1) {alert("Please enter a city !");return false;}

var lensta=sta.length;
if (lensta<2) {alert("Please enter a state or province !");return false;}

var lenzip=zip.length;
if (lenzip<5) {alert("Please enter a zip or postal code !");return false;}

var lenphone=phone.length;
if (lenphone<5) {alert("Please enter a phone nr !");return false;}

if (confirm("Do you want to submit this entry ? Did you print it ? ")) {return true} else {return false}

return true;
}


function EvremCheck (msg) {

var lenmsg=msg.length;
if (lenmsg<21) {alert("Your message is empty, what's the point? Must be at least 20 characters long.");return false;}

if (confirm("Do you want to send this announcement ?")) {return true} else {return false}

return true;
}


function AnnCheck (subj,msg) {

var lensubj=subj.length;
if (lensubj<6) {alert("Please enter a subject ! Must be at least 5 characters long.");return false;}

var lenmsg=msg.length;
if (lenmsg<21) {alert("Your message is empty, what's the point? Must be at least 20 characters long.");return false;}

if (confirm("Do you want to send this announcement ?")) {return true} else {return false}

return true;
}



function PTSCheck (fn,ln,ad1,city,sta,zip) {


var lenfn=fn.length;
if (lenfn<1) {alert("Please enter a first name !");return false;}
	
var lenln=ln.length;
if (lenln<1) {alert("Please enter a last name !");return false;}

var lenad1=ad1.length;
if (lenad1<1) {alert("Please enter an address on the first address line !");return false;}

var lencit=city.length;
if (lencit<1) {alert("Please enter a city !");return false;}

var lensta=sta.length;
if (lensta<2) {alert("Please enter a state or province !");return false;}

var lenzip=zip.length;
if (lenzip<5) {alert("Please enter a zip or postal code !");return false;}


if (confirm("Do you want to save this data ?")) {return true} else {return false}

return true;
}