﻿/* emailInput = id of the input with the email to be submitted to CC
 * mval = value of the input where name="m" (should be customer specific)
 * pval = usually "oi" not sure why
 */
function submit_CCform(emailInput, mval, pval)
{
    var ccForm = document.createElement('form');
    ccForm.name = 'ccoptin';
    ccForm.target = '_blank';
    ccForm.action = 'http://visitor.constantcontact.com/d.jsp';
    ccForm.method = 'post';
    
    var m_elem = document.createElement('input');
    m_elem.type = 'hidden';
    m_elem.name = 'm';
    m_elem.value = mval;
    ccForm.appendChild(m_elem);
    
    var p_elem = document.createElement('input');
    p_elem.type = 'hidden';
    p_elem.name = 'p';
    p_elem.value = pval;
    ccForm.appendChild(p_elem);
    
    var ea_elem = document.createElement('input');
    ea_elem.type = 'text';
    ea_elem.name = 'ea';
    ccForm.appendChild(ea_elem);
    
    document.body.appendChild(ccForm);

    ea_elem.value = document.getElementById(emailInput).value;
    ccForm.submit();
}


