﻿function AutoText(controlId1, controlId2) {
    var control1 = document.getElementById(controlId1);
    var control2 = document.getElementById(controlId2);
    control2.innerHTML = control1.value
}




function ValidateSubscribeInjectedForm(firstNameControlId, emailControlId) {

    // Find Controls
    var FirstNameControl = document.getElementById(firstNameControlId);
    var EmailControl = document.getElementById(emailControlId);

    // Validate Email Format
    var emailPat = /^(\".*\"|[A-Za-z]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z]\w*(\.[A-Za-z]\w*)+)$/;
    var emailid = EmailControl.value;
    var matchArray = emailid.match(emailPat);
    
    // Check for First Name
    if (FirstNameControl.value == "") {
        alert("Your First Name is Required");
        FirstNameControl.focus();
        return false;
    }
    
    // Check for Email Address
    if (EmailControl.value == "") {
        alert("Email Address is Required");
        EmailControl.focus();
        return false;
    }  
   
    // Check Email Address Format
    if (matchArray == null) {
        alert("Your Email Address format is Invalid.");
        EmailControl.focus();
        return false;
    }   
   
    return true;
}

