function sf_constantcontact_form($id,$p) {
return '<form id="'.$id.'_form" onsubmit="return '.$id.'_submit(this);" class="constantcontactwidget_form">'
.(empty($p['txt'])?'':('<p>'.$p['txt'].'</p>'))
.'<input type="hidden" name="grp" value="'.esc_attr($p['grp']).'" />'
.(empty($p['nam'])
?('<input type="text" name="eml" class="input" placeholder="'.__('Email').'"/>')
:('<p><label for="fnm">'.__('').'</label> <input type="text" name="fnm" placeholder="First Name" value="" class="input"/></p>'
.'<p><label for="lnm">'.__('').'</label> <input type="text" name="lnm" placeholder="Last Name" value="" class="input"/></p>'
.'<p><label for="eml">'.__('').'</label> <input type="text" name="eml" placeholder="E-mail" value="" class="input"/></p>'))
.(empty($p['req'])?'':('<p><input type="checkbox" name="req" class="input"> '.$p['req'].'</p>'))
.'<input type="submit" value="'.esc_attr($p['btn']).'" />'
.'</form>'
.'<script>function '.$id.'_submit(n){'
.'for(var a=n.querySelectorAll("input"),i=0,eml=false,val=["action=constantcontactadd"];i<a.length;i++)if(a[i].name){'
.'if(a[i].name=="req"){if(!a[i].checked){alert("'.__('Consent required').'");return false;}}'
.'else{if(!(a[i].name!="eml"||!a[i].value))eml=true;val.push(a[i].name+"="+encodeURIComponent(a[i].value));}'
.'}'
.'if(!eml){alert("'.__('Please enter an email address').'");return false;}'
.'var xml=new XMLHttpRequest();'
.'xml.open("POST","'.admin_url('admin-ajax.php').'",true);'
.'xml.setRequestHeader("Content-type","application/x-www-form-urlencoded");'
.'xml.onreadystatechange=function(){if(this.readyState==4){if(this.status==200){if(this.responseText)alert(this.responseText);else '.(preg_match('/^\/\/|^http:\/\/|^https:\/\//i',$p['msg'])?('setTimeout(\'window.location="'.esc_attr($p['msg']).'";\',100);'):('n.innerHTML="'.addslashes($p['msg']).'";')).'}else alert(this.statusText);}};'
.'xml.send(val.join(String.fromCharCode(38)));'
.'return false;'
.'}</script>';
}