function checkEmail(value) {

    var result = false;



    // First, check for normal (non-quoted) email addresses

    // The username part of the RegEx is from Breaking Par (www.breakingpar.com)

    // For the domain part, I put an arbitrary but absurdly reasonable

    // limit of 6 sub-domains after the top level domain

    var check = value.match(/^([^<>()[\]:;@\\,"\s.]+(\.[^<>()[\]:;@\\,"\s.]+)*)@([a-zA-Z0-9][a-zA-Z0-9\-]{0,62}[a-zA-Z0-9]\.){1,6}[a-zA-Z]{2,64}$/);



    if (check != null) {

        // This is an arbitrary but reasonable limit of 100 characters for the local-part (username)

        if (check[1].length <= 100) {

            result = true;

        }

    } else {

        // If it didn't match that, see if the local-part is a quoted-string

        // (again, with a limit of 100 characters)

        check = value.match(/^"(.{1,100})"@([a-zA-Z0-9][a-zA-Z0-9\-]{0,62}[a-zA-Z0-9]\.){1,6}[a-zA-Z]{2,64}$/);

        if (check != null) {

            if (check[1].search(/[^\\]"/) == -1) {

                result = true;

            }

        }

    }



    return(result);

} // checkEmail()



function PDFPopup(url) {

    var PDFPopup = window.open(url, 'offSiteWindow',

         'width=750,height=500,scrollbars=yes,resizable=yes,menubar=yes,toolbar=yes,location=yes');

    if (typeof PDFPopup == 'object') {

        PDFPopup.focus();

    }

    return false;

}




function JPGPopup(url) {

    var JPGPopup = window.open(url, 'offSiteWindow',

         'width=500,height=500,scrollbars=yes,resizable=yes,menubar=no,toolbar=no,location=no');

    if (typeof JPGPopup == 'object') {

        JPGPopup.focus();

    }

    return false;

}



function globalOnLoad() {

    // Assign link events

    for (var i = 0; i < document.links.length; i++) {

        if (document.links[i].className.match('PDF')) {

            document.links[i].onclick =

                function() { PDFPopup(this.href); return false; }

        }

        if (document.links[i].className.match('JPG')) {

            document.links[i].onclick =

                function() { JPGPopup(this.href); return false; }

        }

    }

    // Run page onLoad function, if it exists

    if (typeof onLoad != 'undefined') {

        onLoad();

    }

}



// Every page should execute the global onload function

window.onload = globalOnLoad;




