function submit_optinform(){return LPG.submit_optinform();}var LPG={is_extended:false,opened:false,is_in:false,CountActive:true,CountStepper:-1,LeadingZero:true,SetTimeOutPeriod:0,obj:new Object(),jdata:null,init:function(){if(template_type=="1o"){if(document.forms.length==0){alert("No form found!\r\nIn order to use the Optin Page or Extended Optin Page, there must be at least one form!");}else{if($("optinform")==undefined&&template_type=="1o"){document.forms[0].id="optinform";document.forms[0].name="optinform";document.forms[0].method="POST";document.forms[0].onsubmit=submit_optinform;}else{$("optinform").name="optinform";$("optinform").method="POST";$("optinform").onsubmit=submit_optinform;}}}if(e_active=='1'){document.onmousemove=LPG.mmove;}Ajax.Responders.register({onCreate:function(request){request.timeoutId=window.setTimeout(function(){if(LPG.callInProgress(request.transport)){request.transport.abort();showFailureMessage();if(request.options.onFailure){request.options.onFailure(request.transport,request.json);}}},10000);},onComplete:function(request){window.clearTimeout(request.timeoutId);}});LPG.get_vars();},validate:function(type,e){if(type=="char"){var notallowed="1234567890!@#$%^&*;:'\",.?/\\|~`_-(){}[]<> ";}if(type=="charnum"){var notallowed="!@#$%^&*;:'\",.?/\\|~`_-(){}[]<> ";}if(type=="num"){var notallowed="abcdefghijklmnopqrstuvwxyz!@#$%^&*;:'\",.?/\\|~`_-(){}[]<> ";}var input=e.value.split("");for(i=0;i<input.length;i++){for(x=0;x<notallowed.length;x++){if(input[i]==notallowed.substr(x,1)){input.splice(i,1);i--;break;}}}e.value=input.join("");},hide_optinform:function(){$("optinform").style.display="none";},get_extended_optinform:function(){var post_data=$('optinform').serialize();var new_form=false;if(extended_optinform=="1"){if(extended_optinform_template==""){new_form=true;}}if(new_form){new Ajax.Request('index.php',{parameters:'project_id='+project_id+'&project_key='+project_key+'&template_type=1e&'+post_data,evalJSON:true,onLoading:function(){LPG.hide_optinform();$('ext_oform').innerHTML='Going to step 2...<BR /><img src=\"images/bar.gif\">';},method:'POST',onComplete:function(r){$('ext_oform').innerHTML=r.responseText;if(document.forms.length<2){alert("No form found!\r\nIn order to use the Optin Page or Extended Optin Page, there must be at least one form!");}else{if($("extended_optinform")==undefined){document.forms[1].id="extended_optinform";document.forms[1].name="extended_optinform";document.forms[1].method="POST";document.forms[1].onsubmit=submit_optinform;}else{$("extended_optinform").name="extended_optinform";$("extended_optinform").method="POST";$("extended_optinform").onsubmit=submit_optinform;}}}});}else{new Ajax.Request('index.php',{parameters:'project_id='+project_id+'&project_key='+project_key+'&template_type=6&template_id='+extended_optinform_template+'&'+post_data,evalJSON:true,onLoading:function(){LPG.hide_optinform();$('ext_oform').innerHTML='Going to step 2...<BR /><img src=\"images/bar.gif\">';},method:'POST',onComplete:function(r){$('ext_oform').innerHTML=r.responseText;if(document.forms.length<2){alert("No form found!\r\nIn order to use the Optin Page or Extended Optin Page, there must be at least one form!");}else{if($("extended_optinform")==undefined){document.forms[1].id="extended_optinform";document.forms[1].name="extended_optinform";document.forms[1].method="POST";document.forms[1].onsubmit=submit_optinform;}else{$("extended_optinform").name="extended_optinform";$("extended_optinform").method="POST";$("extended_optinform").onsubmit=submit_optinform;}}}});}return false;},submit_optinform:function(){if(LPG.is_extended){if(!LPG.checkform($("extended_optinform"))){return false;}}else{if(!LPG.checkform($("optinform"))){return false;}}if(extended_optinform=="1"&&!LPG.is_extended){LPG.get_extended_optinform();LPG.is_extended=true;return false;}else{var post_data=$('optinform').serialize();var post_data2="";if(extended_optinform=="1"){var post_data2=$('extended_optinform').serialize();}new Ajax.Request('index.php',{parameters:'sub=&project_id='+project_id+'&project_key='+project_key+'&redir='+redir+'&wh='+wh+'&cd='+cd+'&combo='+combo+'&template_id='+template_id+'&credit_combo='+credit_combo+'&u_id='+u_id+'&r='+escape(r)+'&template_type='+template_type+'&ip='+ip+'&Contact0Leadsource='+leadsource+'&Contact0_SEOType='+ana_type+'&user_agent='+escape(user_agent)+'&'+post_data+'&'+post_data2,evalJSON:true,method:'POST',onLoading:function(){$('Submit').disabled='disabled';$('ext_oform').innerHTML='Submitting data...<BR /><img src=\"images/bar.gif\">'},onComplete:function(r){$('o_form').innerHTML=r.responseText;LPG.create_cookie('optin_'+project_id,'true');LPG.create_cookie('status_'+project_id,'OKAY');document.optin_form.submit();}});return false;}},get_vars:function(){var q=window.location.search.substring(1);var q2=q.split('&');for(var i=0;i<q2.length;i++){var q3=q2[i].split('=');LPG.obj[q3[0]]=q3;}},readCookie:function(name){var nameEQ=name+'=';var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}return null;},get_ana_type:function(){if(LPG.obj['ppc']!=undefined){ana_type='ppc';}else{ana_type='organic';}},checkform:function(f){var error_message=new Object();var ok=true;for(z=0;z<f.length;z++){var type=f[z].type;var name="";if(f[z].name!=undefined){name=f[z].name;}else if(f[z].id!=undefined){name=f[z].id;}else{alert("extended_optinform error { must set attrubute NAME or ID }");ok=false;break;}if(type=='select-one'||type=='checkbox'||type=='radio'||type=='text'||type=='textarea'){error_message[name]=true;}}if(ok){for(i=0;i<f.length;i++){var value=f[i].value;var type=f[i].type;var name="";if(f[i].name!=undefined){name=f[i].name;}else if(f[i].id!=undefined){name=f[i].id;}if(type=='select-one'){if(f[i].options[f[i].selectedIndex].value!='-1'){error_message[name]=false;}}else if(type=='checkbox'||type=='radio'){if(f[i].checked==true){error_message[name]=false;}}else if(type=='text'){if(name=="email"){var RegExPattern=/^.+@.+\..{2,3}$/;if(value.match(RegExPattern)){error_message[name]=false;}}else{if(value!=''){error_message[name]=false;}}}else if(type=='textarea'){if(value!=''){error_message[name]=false;}}}var error=false;var message='Please correct the following problems...\r\n';for(x in error_message){if(error_message[x]){message+=x+'\r\n';error=true;}}if(error){alert(message);return false;}return true;}return false;},callInProgress:function(xmlhttp){switch(xmlhttp.readyState){case 1:case 2:case 3:return true;break;default:return false;break;}},showFailureMessage:function(){create_cookie('optin_'+project_id,'true');create_cookie('status_'+project_id,'FALIED');window.location='index.php?template_type=2';},create_cookie:function(c_name,c_data){var exdate=new Date();exdate.setDate(exdate.getDate()+365);document.cookie=c_name+'='+escape(c_data)+';path=/;expires='+exdate.toGMTString()+';domain='+server_domain;},mmove:function(e){if(LPG.opened)return true;if(typeof(window.innerWidth)=='number'){myWidth=window.innerWidth;myHeight=window.innerHeight;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){myWidth=document.documentElement.clientWidth;myHeight=document.documentElement.clientHeight;}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){myWidth=document.body.clientWidth;myHeight=document.body.clientHeight;}var posx=0;var posy=0;if(!e)var e=window.event;if(e.pageX||e.pageY){posx=e.pageX;posy=e.pageY;}else if(e.clientX||e.clientY){posx=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;posy=e.clientY+document.body.scrollTop+document.documentElement.scrollTop;}if(posy<10+document.body.scrollTop){if(!is_in)nrp++;is_in=true;LPG.opened=true;return GB_show(e_texttitle,e_htmlfile,e_height,e_width);return true;}else{is_in=false;}return true;},peel_away_code:function(){document.write('<style type="text/css">'+'#unlayout { top:-1000px; }');if(navigator.appVersion.indexOf('nd')!=-1||navigator.appName.indexOf('ro')!=-1){document.write('#cvlayout { top:'+top+'; right:'+right+'; } #unlayout { right:'+right+'; }');}else{document.write('#cvlayout { top:-1000px; right:'+right+'; } #unlayout { right:'+right+'; }');}document.write('</style>');document.write('<script language=\'javascript\'>function pguncover(command, args) {if (command == \'act_ppo\') {cvlayout.style.top = \'-1000px\';unlayout.style.top = top;}}function pgcover(command, args) {if (command == \'act_ppc\') {cvlayout.style.top = top;unlayout.style.top = \'-1000px\';}}function setpos(param1, param2, param3, param4, param5) {document.getElementById(param2).style.top = param3;document.getElementById(param4).style.top = param5;if (navigator.appName.indexOf(\'ro\') != -1) {window.resizeBy(-1, -1); window.resizeBy(1, 1);}}</script><div id="cvlayout" style="position:absolute; width:75px; height:75px; z-index:19001;">'+'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" id="cover" width="75" height="75">'+'<param name="allowScriptAccess" value="always"><param name="movie" value="smalltopr.swf"><param name="wmode" value="transparent"><param name="FlashVars" value="smallimg='+smallimg+'&scrolltxtsmall='+scrolltxtsmall+'&txtsizesmall='+txtsizesmall+'&textcolor='+textcolorsmall+'">'+'<embed src="smalltopr.swf" id="cover" name="cover" wmode="transparent" flashvars="smallimg='+smallimg+'&scrolltxtsmall='+scrolltxtsmall+'&txtsizesmall='+txtsizesmall+'&textcolor='+textcolorsmall+'"width="75" height="75" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>'+'</object>'+'</div>'+'<div id="unlayout" style="position:absolute; height:600px; width:800px; z-index:20000;">'+'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" id="uncover" width="800" height="600">'+'<param name="allowScriptAccess" value="always"><param name="movie" value="bigtopr.swf"><param name="wmode" value="transparent"><param name="FlashVars" value="bigimg='+bigimg+'&urlval='+urlval+'&window='+owindow+'&scrolltxtbig='+scrolltxtbig+'&txtsizebig='+txtsizebig+'&textcolor='+textcolorbig+'&yaxis=0">'+'<embed src="bigtopr.swf" wmode="transparent" width="800" height="600" flashvars="bigimg='+bigimg+'&urlval='+urlval+'&window='+owindow+'&scrolltxtbig='+scrolltxtbig+'&txtsizebig='+txtsizebig+'&textcolor='+textcolorbig+'&yaxis=0" id="uncover" name="uncover" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>'+'</object>'+'</div>');if(navigator.appName&&navigator.appName.indexOf('ro')!=-1&&navigator.userAgent.indexOf('nd')!=-1&&navigator.userAgent.indexOf('3.1')==-1){document.write('<script language="VBScript">\n'+'On Error Resume Next\n'+'Sub cover_FSCommand(ByVal command, ByVal args)\n'+'Call pguncover(command, args)\n'+'End Sub\n'+'Sub uncover_FSCommand(ByVal command, ByVal args)\n'+'Call pgcover(command, args)\n'+'End Sub\n'+'<\/script>');}},calcage:function(secs,num1,num2){s=((Math.floor(secs/num1))%num2).toString();if(LPG.LeadingZero&&s.length<2)s="0"+s;return"<b>"+s+"</b>";},CountBack:function(secs){if(secs<0){if(jdata.countdown_redirect_yes=="true"){if(jdata.countdown_delay!=0){document.getElementById("cntdwn").innerHTML=jdata.countdown_message;setTimeout("LPG.CountBack(0)",jdata.countdown_delay*1000);jdata.countdown_delay=0;}else{if(jdata.countdown_gb_yes=="true"){GB_show('',jdata.countdown_redirect_url,jdata.countdown_gb_height,jdata.countdown_gb_width);}else{window.location=jdata.countdown_redirect_url;}}}else{document.getElementById("cntdwn").innerHTML=jdata.countdown_message;}return;}DisplayFormat=jdata.countdown_format;DisplayStr=DisplayFormat.replace(/%%D%%/g,LPG.calcage(secs,86400,100000));DisplayStr=DisplayStr.replace(/%%H%%/g,LPG.calcage(secs,3600,24));DisplayStr=DisplayStr.replace(/%%M%%/g,LPG.calcage(secs,60,60));DisplayStr=DisplayStr.replace(/%%S%%/g,LPG.calcage(secs,1,60));document.getElementById("cntdwn").innerHTML=DisplayStr;if(LPG.CountActive)setTimeout("LPG.CountBack("+(secs+LPG.CountStepper)+")",LPG.SetTimeOutPeriod);},CountDownTimer:function(data){jdata=data.evalJSON();document.write("<span id=\'cntdwn\'></span>");if(jdata.countdown_redirect_url==""){jdata.countdown_redirect_url="../index.php?template_type=6&template_id="+jdata.countdown_template;}LPG.CountStepper=Math.ceil(LPG.CountStepper);if(LPG.CountStepper==0)LPG.CountActive=false;LPG.SetTimeOutPeriod=(Math.abs(LPG.CountStepper)-1)*1000+990;var dthen=new Date(jdata.countdown_start);var dnow=new Date();if(LPG.CountStepper>0){ddiff=new Date(dnow-dthen);}else{ddiff=new Date(dthen-dnow)}gsecs=Math.floor(ddiff.valueOf()/1000);LPG.CountBack(gsecs);}};