var site_url = 'http://my.affiliateclassroom.com/'; var redirect_url = site_url + 'ppcleads/optin_thanks.php'; function opt_validateEmail() { var emailRegEx = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; var email = document.getElementById('from').value; var name = document.getElementById('name').value; var error = ""; if(name == "" || name == null) { error += 'Please enter name.\n'; } if(!email.match(emailRegEx)) { error += 'Please enter a valid email address.'; } if(error != "") { alert(error); return false; } else { return true; } } function opt_do_form_submit() { if(opt_validateEmail()) { return false; } else { return false; } } function optUpdateForm() { custom_system_ids = document.getElementsByName('custom system_id'); for(var i = 0; i < custom_system_ids.length; i++) { custom_system_ids.item(i).value = optGetCookie('systemid'); } custom_aff_ids = document.getElementsByName('custom aff_id'); for(var i = 0; i < custom_aff_ids.length; i++) { sys = optGetCookie('systemid'); sys_affiliate = "sys_affiliate[" +sys + "]"; custom_aff_ids.item(i).value = optGetCookie(sys_affiliate); } custom_sub_ids = document.getElementsByName('custom sub_id'); for(var i = 0; i < custom_sub_ids.length; i++) { custom_sub_ids.item(i).value = ''; } redirects = document.getElementsByName('redirect'); transfer_urls = document.getElementsByName('custom transfer_url'); for(var i = 0; i < redirects.length; i++) { if(redirects.item(i).value!=redirect_url) { transfer_urls.item(i).value = redirects.item(i).value; redirects.item(i).value = redirect_url; } } } function optSetCookie(c_name,value,expiredays) { var exdate=new Date(); exdate.setDate(exdate.getDate()+expiredays); document.cookie=c_name+ "=" +escape(value)+ ((expiredays==null) ? "" : ";expires="+exdate.toGMTString()); } function optGetCookie(c_name) { if (document.cookie.length>0) { c_start=document.cookie.indexOf(c_name + "="); if (c_start!=-1) { c_start=c_start + c_name.length+1; c_end=document.cookie.indexOf(";",c_start); if (c_end==-1) c_end=document.cookie.length; return unescape(document.cookie.substring(c_start,c_end)); } } return ""; } function optLoad() { if (window.addEventListener) window.addEventListener("load", optUpdateForm, false) else if (window.attachEvent) window.attachEvent("onload", optUpdateForm) else window.onload = optUpdateForm; } optLoad();