﻿// JScript File

/*
 Name            :       validateEmail
 Purpose         :
 Author          :       JohnD (Baudville)
 Date            :       8/20/2008
 */
function validateEmail(tbEm) {

    
    var blnReturn = false;
    if (tbEm.value.match(/^[a-z0-9][a-z0-9_\.-]{0,}[a-z0-9]@[a-z0-9][a-z0-9_\.-]{0,}[a-z0-9][\.][a-z0-9]{2,4}$/i))    {
    //if (tbEm.value.match(/^[\w\d!#$%&'*+-\/=?^`{|}~]+(\.[\w\d!#$%&'*+-\/=?^`{|}~]+)*@([a-z\d][-a-z\d]*[a-z\d]\.)*[a-z][-a-z\d]*[a-z]$/i))    {
        blnReturn = true;
    }
    
    return blnReturn
}

/*
 Name            :       onSignup
 Purpose         :
 Author          :       GregJ (Baudville)
 Date            :       9/3/2008
 */
         // Sign up click
        function onSignup(obj1)
        {
            // Make sure we have an object given to us
            if(obj1)
            {
                var obj = document.getElementById(obj1);
                // If the box is empty, we'll add back in our default value
                if (obj.value != '')
                {
                    if (validateEmail(obj))
                    {
                        if (navigator.appName == 'Netscape') {
                            if (navigator.userAgent.indexOf('Firefox')==-1){
                                //window.location="/emaillist/index.aspx?e=" + obj.value;
                                window.location="/emailsignup/" + obj.value;
                            }
                            else
                            {
                                location.replace("/emailsignup/" + obj.value);
                            }
                        }
                        else
                        {
                            window.location="/emailsignup/" + obj.value;
                        }
                    }
                    else
                    {
                        alert("Incorrect email format!")
                    }
                }
                else
                {
                    alert("Incorrect email format!")
                }
            }
        }

