﻿function exclusivesSubmit(emailAddressField)
{
    if (validateEmailAddress(emailAddressField))
        submitSubscription(emailAddressField);
    else
        return false;
}

function submitSubscription(emailAddressField) 
{
    var email = document.getElementById(emailAddressField).value;

    if (email=="")
        alert("Please enter e-mail for subscription.");    
    else
    {
        var newWin;
         newWin=window.open('','subscription', 'width=650,height=650'
           +',menubar=0'
           +',toolbar=0'
           +',status=0'
           +',scrollbars=1'
           +',resizable=1');
           
         //HEAD
         newWin.document.write("<html><head><title></title>");
         newWin.document.write("</head>");
         
         //BODY         
         newWin.document.write('<body>');
         newWin.document.write('<form method="post" action="http://app.icontact.com/icp/signup.php" name="icpsignup" accept-charset="UTF-8" onsubmit="return verifyRequired();">');
         newWin.document.write('<input type="hidden" name="redirect" value="http://www.icontact.com//www/signup/thanks.html" />');
         newWin.document.write('<input type="hidden" name="errorredirect" value="http://www.icontact.com//www/signup/error.html" />');
         newWin.document.write("<input type='text' name='fields_email' VALUE='" + email + "' style='display:none;' />");
         
         newWin.document.write('<input type="hidden" name="listid" value="9893137">');
         newWin.document.write('<input type="hidden" name="specialid:9893137" value="TCVI">');
         newWin.document.write('<input type="hidden" name="clientid" value="425968">');
         newWin.document.write('<input type="hidden" name="formid" value="4231">');
         newWin.document.write('<input type="hidden" name="reallistid" value="1">');
         newWin.document.write('<input type="hidden" name="doubleopt" value="0">');         
         newWin.document.write("</form></body></html>");

         newWin.document.write("<script language='javascript'>document.icpsignup.submit();</script>");
         
         newWin.document.close();
    } 
}
    
function verifyRequired() 
{
    if (document.icpsignup["fields_email"].value == "") 
    {
        document.icpsignup["fields_email"].focus();
        alert("Email field is required.");
        return false;
    }
  
    return true;
}
