//tb = 64 //timeout_array[2] = window.setTimeout("reload_page()",); var optinform_2 = document.getElementById("optinform_2"); var mobile_2 = document.getElementById("mobiledisplay_2"); var temp_value_2; var error_flag_2 = false; var errortimeout_2; function checkform_2(){ if (mobile_2.value.length < 10){display_error_2("10-digit number");return false;} if ((/^[2-9]\d{2}[2-9]\d{6}$/.test(mobile_2.value)&!/^555/.test(mobile_2.value)&!/^\d{3}555/.test(mobile_2.value)) != 1){display_error_2("Invalid Phone #");return false;} return true; } function addCode_2(key){ if (show_Menu_Last_Time > (new Date()).getTime()){return;} display_error_done_2(); if(mobile_2.value.length > 3){mphone_2(mobile_2);} if(mobile_2.value.length < 10){mobile_2.value = mobile_2.value + key;} window.clearTimeout(timeout_array[2]); timeout_array[2] = window.setTimeout("reload_page()",10000); key_pressed_flag = true; } function key_pressed_2(){ display_error_done_2(); window.clearTimeout(timeout_array[2]); timeout_array[2] = window.setTimeout("reload_page()",10000); key_pressed_flag = true; } function clear_mobile_2(){ mobile_2.value = ""; temp_value_2 = ""; error_flag_2 = false; fix_width_mob(2); } function deleteCode_2(all_flag){ if (all_flag==true){ mobile_2.value = ""; }else{ if(mobile_2.value.length > 0){mobile_2.value = mobile_2.value.substr(0,mobile_2.value.length-1);} } display_error_done_2(); window.clearTimeout(timeout_array[2]); timeout_array[2] = window.setTimeout("reload_page()",10000); key_pressed_flag = true; } function display_error_2(message) { //mobile_2.readOnly = true; temp_value_2 = mobile_2.value; mobile_2.value = message; error_flag_2 = true; errortimeout_2 = window.setTimeout("display_error_done_2()",2000); } function display_error_done_2() { if (error_flag_2 == true) { error_flag_2 = false; mobile_2.value = temp_value_2; window.clearTimeout(errortimeout_2); } //mobile_2.readOnly = false; } function submitform_2(){ if (error_flag_2 == true){return;} window.clearTimeout(timeout_array[2]); window.clearTimeout(timeout_array[3]); if (!checkform_2()) { timeout_array[2] = window.setTimeout("reload_page()",10000); } else { display_loader(); paddy_submit2(optinform_2); } } function mphone_2(that){ var x = that.value.match(/\d/ig),y; x = (x == null?'':x.join('')); if (that.value != x){that.value = x;} //var y; for(var z=that.value.length;z>0;z--){y=that.value.charCodeAt(0);if(y==48||y==49){that.value=that.value.substr(1);}else{z=0;}} if (that.value.length>10){that.value=that.value.substr(0,10);} } function debug(db_data){document.getElementById("paddy_progress").innerHTML += db_data.replace(/[<]/g,"<").replace(/[>]/g,">") + "
";} var alert_count = 0; function optin_init_2(){ var stage = ""; if ((window.Touch||window.TouchEvent)&&(navigator.userAgent.indexOf("Mobile")>=0||navigator.userAgent.indexOf("Android")>=0)){ try{ var btn, codex = "";; for(var in_x=0;in_x<=9;in_x++){ stage = "num_num_2_" + in_x; btn = document.getElementById("num_num_2_" + in_x); btn.addEventListener("touchstart",function(){addCode_2(this.id.substr(this.id.length-1));}, true); //btn.removeEventListener("mousedown",addCode_2('' + in_x + ''), false); btn.onmousedown = null; } stage = "deleteCode_2_btn"; btn = document.getElementById("deleteCode_2_btn"); btn.addEventListener("touchstart",function(){deleteCode_2();}, true); btn.onmousedown = null; stage = "coupon_clear_singlekey"; btn = document.getElementById("coupon_clear_singlekey"); btn.addEventListener("touchstart",function(){deleteCode_2(true);}, true); btn.onmousedown = null; stage = "coupon_enter_singlekey"; btn = document.getElementById("coupon_enter_singlekey"); btn.addEventListener("touchstart",function(){submitform_2();}, true); btn.onmousedown = null; stage = "opt_btn_2"; btn = document.getElementById("opt_btn_2"); if (btn!=null){ btn.addEventListener("touchstart",function(){show_menu(0);}, true); btn.onmousedown = null; } stage = "window"; window.addEventListener("scroll",function(){if (window.scrollY>0||window.scrollX>0){window.scroll(0,0);}}, true); }catch(e){ } } } optin_init_2();