$(document).ready(function($){ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-58455333-1', 'auto'); ga('send', 'pageview'); $("body").hide(); var ansList = []; var angle = 0; var paid = false; var plan_choose = false; var telco_choose = false; var postpaid_list = []; var prepaid_list = ["telco_hotlink", "telco_xpax", "telco_digi", "telco_umobile"]; var postpaid_list = ["telco_maxis", "telco_celcom", "telco_digi", "telco_umobile"]; var hotlink_list = ["btn_prepaid_hotlink30"]; var xpax_list = ["btn_prepaid_xpax28", "btn_prepaid_xpax38"]; var digi_prepaid_list = ["btn_prepaid_DIGI_XL28", "btn_prepaid_DIGI_XL38", "btn_prepaid_DIGI20", "btn_prepaid_DIGI30", "btn_prepaid_DIGI48"]; var umobile_prepaid_list = ["btn_prepaid_UMI18", "btn_prepaid_UMI28", "btn_prepaid_UMI38", "btn_prepaid_UMI48"]; var maxis_list = ["btn_postpaid_maxisoneplan", "btn_postpaid_maxisoneplanlite", "btn_postpaid_maxissurfmore50", "btn_postpaid_maxissurfmore75", "btn_postpaid_maxistalkmore28"]; var celcom_list = ["btn_postpaid_celcomcallsms", "btn_postpaid_celcominternet"]; var digi_postpaid_list = ["btn_postpaid_dgsimple1gb", "btn_postpaid_dgsimple2gb","btn_postpaid_dgsmartplan50","btn_postpaid_dgsmartplan78","btn_postpaid_dgsmartplan108"]; var umobile_postpaid_list = ["btn_postpaid_umobile50", "btn_postpaid_umobile80"]; var win_h = $(window).height(); jQuery(window).load(function () { $("body").fadeIn(); $("#shout_boy").animate({right: "0"}, 1000, "easeOutBounce"); place_char(); }); $("#btn_startnow").click(function() { $(".logo1").fadeOut(); ga('send', 'event', 'button', 'click', 'Start Now'); $("#shout_boy").animate({right: "-460"}, 1000, "easeInElastic", function() { $("#shout_boy").hide(); }); $(".page1").fadeOut( "slow", function() { $(".page2, .masthead").fadeIn(); document.getElementById("amout_txt").focus(); }); $("#amout_txt").val(""); $('.cycle-slideshow').cycle('goto', 1); }); $(".pg2_next").click(function() { $(".error_txt").text(""); var num = Number($("#amout_txt").val()); if ($("#amout_txt").val() == "" || $("#amout_txt").val() == null || num == 0){ $(".error_txt").text("enter your amount la~"); }else if (num > 1000){ $(".error_txt").text("Woi, don't play play lah, we not Bodoh okay, if your average bill is more than RM 1,000, you are not fit for this test :P"); }else{ $(".page2").fadeOut( "slow", function() { $(".page3").fadeIn(); }); ga('send', 'event', 'button', 'click', 'Amount Button'); $('.cycle-slideshow').cycle('goto', 2); ansList[0] = num; if (num < 100){ $("#char_head").attr("src", "images/character1.png"); } else if (num >= 100 && num <=200){ $("#char_head").attr("src", "images/character2.png"); } else if (num >= 201 && num <=500){ $("#char_head").attr("src", "images/character3.png"); } else if (num >= 501 && num <=1000){ $("#char_head").attr("src", "images/character4.png"); } } }); $(".btn_prepaid, .btn_postpaid").click(function() { //if (!paid){ paid = true; $(".plan_select, .btn_showmedeal").hide(); var id = this.id; if (id == "btn_postpaid"){ ansList[1] = "postpaid"; for (i=1; i<=postpaid_list.length; i++){ $(".telco"+i).css("background", "url(images/"+postpaid_list[i-1]+".png)"); } }else{ ansList[1] = "prepaid"; for (i=1; i<=prepaid_list.length; i++){ $(".telco"+i).css("background", "url(images/"+prepaid_list[i-1]+".png)"); } } $("#btn_prepaid").attr("src", "images/btn_prepaid.png"); $("#btn_postpaid").attr("src", "images/btn_postpaid.png"); $(this).attr("src", "images/btn_"+ansList[1]+"2.png"); $(".telco_select").fadeIn("fast"); //$("#btn_postpaid").removeClass("btn_postpaid"); //$("#btn_prepaid").removeClass("btn_prepaid"); //} }); $(".btn_prepaid, .btn_postpaid").mouseover(function() { var src = $(this).attr('src').split('/'); var img_name = src[src.length - 1]; var img = img_name.split('.png', 1); $(this).attr("src", "images/"+img+"2.png"); }); $(".btn_prepaid, .btn_postpaid").mouseout(function() { var src = $(this).attr('src').split('/'); var img_name = src[src.length - 1]; var img = String(img_name.split('2.png', 1)); var ans = img.split("btn_"); if (ansList[1] != ans[1]){ $(this).attr("src", "images/"+img+".png"); } }); $(".telco1, .telco2, .telco3, .telco4").click(function() { //if (!telco_choose){ telco_choose = true; $(".btn_showmedeal").hide(); var icon_name = $(this).css('background-image'); var cleanup = /\"|\'|\)/g; var img_name = icon_name.split('/').pop().replace(cleanup, ''); var img = String(img_name.split('2.png', 1)); var ans = img.split("telco_"); ansList[2] = ans[1]; if (ansList[1] == "postpaid"){ for (i=1; i<=postpaid_list.length; i++){ $(".telco"+i).css("background", "url(images/"+postpaid_list[i-1]+".png)"); } }else{ for (i=1; i<=prepaid_list.length; i++){ $(".telco"+i).css("background", "url(images/"+prepaid_list[i-1]+".png)"); } } $(this).css("background", "url(images/"+img+"2.png)"); $(".plan_select").fadeIn("fast"); arrangePlan(); $('html, body').scrollTop( $(document).height() ); //} }); $( ".telco_icon" ).mouseover(function() { //if (!telco_choose){ var icon_name = $(this).css('background-image'); var cleanup = /\"|\'|\)/g; var img_name = icon_name.split('/').pop().replace(cleanup, ''); var img = String(img_name.split('.png', 1)); var ans = img.split("telco_"); var tempAns = ansList[2] + "2"; if (tempAns != ans[1]){ $(this).css("background", "url(images/"+img+"2.png)"); } //} }); $( ".telco_icon" ).mouseout(function() { //if (!telco_choose){ var icon_name = $(this).css('background-image'); var cleanup = /\"|\'|\)/g; var img_name = icon_name.split('/').pop().replace(cleanup, ''); var img = String(img_name.split('2.png', 1)); var ans = img.split("telco_"); if (ansList[2] != ans[1]){ $(this).css("background", "url(images/"+img+".png)"); } //} }); $(".btn_plan").click(function() { //if (!plan_choose){ plan_choose = true; arrangePlan(); var src = $(this).attr('src').split('/'); var img_name = src[src.length - 1]; var img = String(img_name.split('.png', 1)); var ans = img.split("btn_"); ansList[3] = ans[1]; $(this).attr("src", "images/"+img+"_2.png"); $(".btn_showmedeal").fadeIn("fast"); $('html, body').scrollTop( $(document).height() ); //} }); $( ".btn_plan" ).mouseover(function() { //if (!plan_choose){ var src = $(this).attr('src').split('/'); var img_name = src[src.length - 1]; var img = String(img_name.split('.png', 1)); var ans = img.split("btn_"); var tempAns = ansList[3] + "_2"; if (tempAns != ans[1]){ $(this).attr("src", "images/"+img+"_2.png"); } //} }); $( ".btn_plan" ).mouseout(function() { //if (!plan_choose){ var src = $(this).attr('src').split('/'); var img_name = src[src.length - 1]; var img = String(img_name.split('_2.png', 1)); var ans = img.split("btn_"); if (ansList[3] != ans[1]){ $(this).attr("src", "images/"+img+".png"); } //} }); $("#btn_showmedeal").click(function() { $(".page3").fadeOut( "slow", function() { $(".page4").fadeIn(); $('html,body').scrollTop(0); loadingAni(); $(".sta1").delay( 200 ).fadeIn(); $(".sta2").delay( 600 ).fadeIn(); $(".sta3").delay( 1000 ).fadeIn(); $(".sta4").delay( 1400 ).fadeIn(); }); ga('send', 'event', 'button', 'click', 'Show Loading'); $(".other_plan_type").hide(); if (ansList[1] == "postpaid"){ $("#my_plan").attr("src", "images/postpaid/"+ansList[3]+".png"); } else if (ansList[1] == "prepaid"){ $("#my_plan").attr("src", "images/prepaid/"+ansList[3]+".png"); } if (ansList[3] == "prepaid_UMI18"){ $(".op1").show(); $("#other_plan1").attr("src", "images/prepaid/prepaid_DIGI20.png"); } else if (ansList[3] == "prepaid_DIGI20"){ $(".op1").show(); $("#other_plan1").attr("src", "images/prepaid/prepaid_UMI18.png"); } else if (ansList[3] == "prepaid_UMI28"){ $(".op1, .op2, .op3, .op4").show(); $("#other_plan1").attr("src", "images/prepaid/prepaid_DIGI_XL28.png"); $("#other_plan2").attr("src", "images/prepaid/prepaid_DIGI30.png"); $("#other_plan3").attr("src", "images/prepaid/prepaid_xpax28.png"); $("#other_plan4").attr("src", "images/prepaid/prepaid_hotlink30.png"); } else if (ansList[3] == "prepaid_DIGI_XL28"){ $(".op1, .op2, .op3, .op4").show(); $("#other_plan1").attr("src", "images/prepaid/prepaid_UMI28.png"); $("#other_plan2").attr("src", "images/prepaid/prepaid_DIGI30.png"); $("#other_plan3").attr("src", "images/prepaid/prepaid_xpax28.png"); $("#other_plan4").attr("src", "images/prepaid/prepaid_hotlink30.png"); } else if (ansList[3] == "prepaid_DIGI30"){ $(".op1, .op2, .op3, .op4").show(); $("#other_plan1").attr("src", "images/prepaid/prepaid_UMI28.png"); $("#other_plan2").attr("src", "images/prepaid/prepaid_DIGI_XL28.png"); $("#other_plan3").attr("src", "images/prepaid/prepaid_xpax28.png"); $("#other_plan4").attr("src", "images/prepaid/prepaid_hotlink30.png"); } else if (ansList[3] == "prepaid_xpax28"){ $(".op1, .op2, .op3, .op4").show(); $("#other_plan1").attr("src", "images/prepaid/prepaid_UMI28.png"); $("#other_plan2").attr("src", "images/prepaid/prepaid_DIGI_XL28.png"); $("#other_plan3").attr("src", "images/prepaid/prepaid_DIGI30.png"); $("#other_plan4").attr("src", "images/prepaid/prepaid_hotlink30.png"); } else if (ansList[3] == "prepaid_hotlink30"){ $(".op1, .op2, .op3, .op4").show(); $("#other_plan1").attr("src", "images/prepaid/prepaid_UMI28.png"); $("#other_plan2").attr("src", "images/prepaid/prepaid_DIGI_XL28.png"); $("#other_plan3").attr("src", "images/prepaid/prepaid_DIGI30.png"); $("#other_plan4").attr("src", "images/prepaid/prepaid_xpax28.png"); } else if (ansList[3] == "prepaid_DIGI_XL38"){ $(".op1, .op2").show(); $("#other_plan1").attr("src", "images/prepaid/prepaid_UMI38.png"); $("#other_plan2").attr("src", "images/prepaid/prepaid_xpax38.png"); } else if (ansList[3] == "prepaid_UMI38"){ $(".op1, .op2").show(); $("#other_plan1").attr("src", "images/prepaid/prepaid_DIGI_XL38.png"); $("#other_plan2").attr("src", "images/prepaid/prepaid_xpax38.png"); } else if (ansList[3] == "prepaid_xpax38"){ $(".op1, .op2").show(); $("#other_plan1").attr("src", "images/prepaid/prepaid_DIGI_XL38.png"); $("#other_plan2").attr("src", "images/prepaid/prepaid_UMI38.png"); } else if (ansList[3] == "prepaid_UMI48"){ $(".op1").show(); $("#other_plan1").attr("src", "images/prepaid/prepaid_DIGI48.png"); } else if (ansList[3] == "prepaid_DIGI48"){ $(".op1").show(); $("#other_plan1").attr("src", "images/prepaid/prepaid_UMI48.png"); } else if (ansList[3] == "postpaid_dgsmartplan50"){ $(".op1, .op2, .op3, .op4, .op5").show(); $("#other_plan1").attr("src", "images/postpaid/postpaid_umobile50.png"); $("#other_plan2").attr("src", "images/postpaid/postpaid_maxissurfmore50.png"); $("#other_plan3").attr("src", "images/postpaid/postpaid_celcomcallsms.png"); $("#other_plan4").attr("src", "images/postpaid/postpaid_maxisoneplanlite.png"); $("#other_plan5").attr("src", "images/postpaid/postpaid_dgsimple1gb.png"); } else if (ansList[3] == "postpaid_umobile50"){ $(".op1, .op2, .op3, .op4, .op5").show(); $("#other_plan1").attr("src", "images/postpaid/postpaid_dgsmartplan50.png"); $("#other_plan2").attr("src", "images/postpaid/postpaid_maxissurfmore50.png"); $("#other_plan3").attr("src", "images/postpaid/postpaid_celcomcallsms.png"); $("#other_plan4").attr("src", "images/postpaid/postpaid_maxisoneplanlite.png"); $("#other_plan5").attr("src", "images/postpaid/postpaid_dgsimple1gb.png"); } else if (ansList[3] == "postpaid_maxissurfmore50"){ $(".op1, .op2, .op3, .op4, .op5").show(); $("#other_plan1").attr("src", "images/postpaid/postpaid_dgsmartplan50.png"); $("#other_plan2").attr("src", "images/postpaid/postpaid_umobile50.png"); $("#other_plan3").attr("src", "images/postpaid/postpaid_celcomcallsms.png"); $("#other_plan4").attr("src", "images/postpaid/postpaid_maxisoneplanlite.png"); $("#other_plan5").attr("src", "images/postpaid/postpaid_dgsimple1gb.png"); } else if (ansList[3] == "postpaid_celcomcallsms"){ $(".op1, .op2, .op3, .op4, .op5").show(); $("#other_plan1").attr("src", "images/postpaid/postpaid_dgsmartplan50.png"); $("#other_plan2").attr("src", "images/postpaid/postpaid_umobile50.png"); $("#other_plan3").attr("src", "images/postpaid/postpaid_maxissurfmore50.png"); $("#other_plan4").attr("src", "images/postpaid/postpaid_maxisoneplanlite.png"); $("#other_plan5").attr("src", "images/postpaid/postpaid_dgsimple1gb.png"); } else if (ansList[3] == "postpaid_maxisoneplanlite"){ $(".op1, .op2, .op3, .op4, .op5").show(); $("#other_plan1").attr("src", "images/postpaid/postpaid_dgsmartplan50.png"); $("#other_plan2").attr("src", "images/postpaid/postpaid_umobile50.png"); $("#other_plan3").attr("src", "images/postpaid/postpaid_maxissurfmore50.png"); $("#other_plan4").attr("src", "images/postpaid/postpaid_celcomcallsms.png"); $("#other_plan5").attr("src", "images/postpaid/postpaid_dgsimple1gb.png"); } else if (ansList[3] == "postpaid_dgsimple1gb"){ $(".op1, .op2, .op3, .op4, .op5").show(); $("#other_plan1").attr("src", "images/postpaid/postpaid_dgsmartplan50.png"); $("#other_plan2").attr("src", "images/postpaid/postpaid_umobile50.png"); $("#other_plan3").attr("src", "images/postpaid/postpaid_maxissurfmore50.png"); $("#other_plan4").attr("src", "images/postpaid/postpaid_celcomcallsms.png"); $("#other_plan5").attr("src", "images/postpaid/postpaid_maxisoneplanlite.png"); } else if (ansList[3] == "postpaid_umobile80"){ $(".other_plan_type").show(); $("#other_plan1").attr("src", "images/postpaid/postpaid_dgsmartplan108.png"); $("#other_plan2").attr("src", "images/postpaid/postpaid_celcominternet.png"); $("#other_plan3").attr("src", "images/postpaid/postpaid_maxissurfmore75.png"); $("#other_plan4").attr("src", "images/postpaid/postpaid_dgsmartplan78.png"); $("#other_plan5").attr("src", "images/postpaid/postpaid_maxistalkmore28.png"); $("#other_plan6").attr("src", "images/postpaid/postpaid_maxisoneplan.png"); $("#other_plan7").attr("src", "images/postpaid/postpaid_dgsimple2gb.png"); } else if (ansList[3] == "postpaid_dgsmartplan108"){ $(".other_plan_type").show(); $("#other_plan1").attr("src", "images/postpaid/postpaid_umobile80.png"); $("#other_plan2").attr("src", "images/postpaid/postpaid_celcominternet.png"); $("#other_plan3").attr("src", "images/postpaid/postpaid_maxissurfmore75.png"); $("#other_plan4").attr("src", "images/postpaid/postpaid_dgsmartplan78.png"); $("#other_plan5").attr("src", "images/postpaid/postpaid_maxistalkmore28.png"); $("#other_plan6").attr("src", "images/postpaid/postpaid_maxisoneplan.png"); $("#other_plan7").attr("src", "images/postpaid/postpaid_dgsimple2gb.png"); } else if (ansList[3] == "postpaid_celcominternet"){ $(".other_plan_type").show(); $("#other_plan1").attr("src", "images/postpaid/postpaid_umobile80.png"); $("#other_plan2").attr("src", "images/postpaid/postpaid_dgsmartplan108.png"); $("#other_plan3").attr("src", "images/postpaid/postpaid_maxissurfmore75.png"); $("#other_plan4").attr("src", "images/postpaid/postpaid_dgsmartplan78.png"); $("#other_plan5").attr("src", "images/postpaid/postpaid_maxistalkmore28.png"); $("#other_plan6").attr("src", "images/postpaid/postpaid_maxisoneplan.png"); $("#other_plan7").attr("src", "images/postpaid/postpaid_dgsimple2gb.png"); } else if (ansList[3] == "postpaid_maxissurfmore75"){ $(".other_plan_type").show(); $("#other_plan1").attr("src", "images/postpaid/postpaid_umobile80.png"); $("#other_plan2").attr("src", "images/postpaid/postpaid_dgsmartplan108.png"); $("#other_plan3").attr("src", "images/postpaid/postpaid_celcominternet.png"); $("#other_plan4").attr("src", "images/postpaid/postpaid_dgsmartplan78.png"); $("#other_plan5").attr("src", "images/postpaid/postpaid_maxistalkmore28.png"); $("#other_plan6").attr("src", "images/postpaid/postpaid_maxisoneplan.png"); $("#other_plan7").attr("src", "images/postpaid/postpaid_dgsimple2gb.png"); } else if (ansList[3] == "postpaid_dgsmartplan78"){ $(".other_plan_type").show(); $("#other_plan1").attr("src", "images/postpaid/postpaid_umobile80.png"); $("#other_plan2").attr("src", "images/postpaid/postpaid_dgsmartplan108.png"); $("#other_plan3").attr("src", "images/postpaid/postpaid_celcominternet.png"); $("#other_plan4").attr("src", "images/postpaid/postpaid_maxissurfmore75.png"); $("#other_plan5").attr("src", "images/postpaid/postpaid_maxistalkmore28.png"); $("#other_plan6").attr("src", "images/postpaid/postpaid_maxisoneplan.png"); $("#other_plan7").attr("src", "images/postpaid/postpaid_dgsimple2gb.png"); } else if (ansList[3] == "postpaid_maxistalkmore28"){ $(".other_plan_type").show(); $("#other_plan1").attr("src", "images/postpaid/postpaid_umobile80.png"); $("#other_plan2").attr("src", "images/postpaid/postpaid_dgsmartplan108.png"); $("#other_plan3").attr("src", "images/postpaid/postpaid_celcominternet.png"); $("#other_plan4").attr("src", "images/postpaid/postpaid_maxissurfmore75.png"); $("#other_plan5").attr("src", "images/postpaid/postpaid_dgsmartplan78.png"); $("#other_plan6").attr("src", "images/postpaid/postpaid_maxisoneplan.png"); $("#other_plan7").attr("src", "images/postpaid/postpaid_dgsimple2gb.png"); } else if (ansList[3] == "postpaid_maxisoneplan"){ $(".other_plan_type").show(); $("#other_plan1").attr("src", "images/postpaid/postpaid_umobile80.png"); $("#other_plan2").attr("src", "images/postpaid/postpaid_dgsmartplan108.png"); $("#other_plan3").attr("src", "images/postpaid/postpaid_celcominternet.png"); $("#other_plan4").attr("src", "images/postpaid/postpaid_maxissurfmore75.png"); $("#other_plan5").attr("src", "images/postpaid/postpaid_dgsmartplan78.png"); $("#other_plan6").attr("src", "images/postpaid/postpaid_maxistalkmore28.png"); $("#other_plan7").attr("src", "images/postpaid/postpaid_dgsimple2gb.png"); } else if (ansList[3] == "postpaid_dgsimple2gb"){ $(".other_plan_type").show(); $("#other_plan1").attr("src", "images/postpaid/postpaid_umobile80.png"); $("#other_plan2").attr("src", "images/postpaid/postpaid_dgsmartplan108.png"); $("#other_plan3").attr("src", "images/postpaid/postpaid_celcominternet.png"); $("#other_plan4").attr("src", "images/postpaid/postpaid_maxissurfmore75.png"); $("#other_plan5").attr("src", "images/postpaid/postpaid_dgsmartplan78.png"); $("#other_plan6").attr("src", "images/postpaid/postpaid_maxistalkmore28.png"); $("#other_plan7").attr("src", "images/postpaid/postpaid_maxisoneplan.png"); } }); function arrangePlan(){ $(".plan_icon").hide(); if (ansList[1] == "prepaid" && ansList[2] == "hotlink"){ for (i=1; i<=hotlink_list.length; i++){ $(".plan_prepaid" + i).attr("src", "images/"+hotlink_list[i-1]+".png"); $(".p" + i).show(); } } else if (ansList[1] == "prepaid" && ansList[2] == "xpax"){ for (i=1; i<=xpax_list.length; i++){ $(".plan_prepaid" + i).attr("src", "images/"+xpax_list[i-1]+".png"); $(".p" + i).show(); } } else if (ansList[1] == "prepaid" && ansList[2] == "digi"){ for (i=1; i<=digi_prepaid_list.length; i++){ $(".plan_prepaid" + i).attr("src", "images/"+digi_prepaid_list[i-1]+".png"); $(".p" + i).show(); } } else if (ansList[1] == "prepaid" && ansList[2] == "umobile"){ for (i=1; i<=umobile_prepaid_list.length; i++){ $(".plan_prepaid" + i).attr("src", "images/"+umobile_prepaid_list[i-1]+".png"); $(".p" + i).show(); } } else if (ansList[1] == "postpaid" && ansList[2] == "maxis"){ for (i=1; i<=maxis_list.length; i++){ $(".plan_prepaid" + i).attr("src", "images/"+maxis_list[i-1]+".png"); $(".p" + i).show(); } } else if (ansList[1] == "postpaid" && ansList[2] == "celcom"){ for (i=1; i<=celcom_list.length; i++){ $(".plan_prepaid" + i).attr("src", "images/"+celcom_list[i-1]+".png"); $(".p" + i).show(); } } else if (ansList[1] == "postpaid" && ansList[2] == "digi"){ for (i=1; i<=digi_postpaid_list.length; i++){ $(".plan_prepaid" + i).attr("src", "images/"+digi_postpaid_list[i-1]+".png"); $(".p" + i).show(); } } else if (ansList[1] == "postpaid" && ansList[2] == "umobile"){ for (i=1; i<=umobile_postpaid_list.length; i++){ $(".plan_prepaid" + i).attr("src", "images/"+umobile_postpaid_list[i-1]+".png"); $(".p" + i).show(); } } } function loadingAni(){ var rotate_int = setInterval(function(){ angle-=3; $("#loading_animation").rotate(angle); if (angle <= -1500){ clearInterval(rotate_int); $("#loading").fadeOut( "fast", function() { $(".loading_next").fadeIn("fast"); }); } },10); } $(".pg4_next").click(function() { $(".page4").fadeOut( "slow", function() { $(".page5").fadeIn(); $('html,body').scrollTop(0); }); ga('send', 'event', 'button', 'click', 'Show Deal'); $('.cycle-slideshow').cycle('goto', 3); }); $(".pg5_next").click(function() { $(".page5").fadeOut( "slow", function() { $(".page6").fadeIn(); $('html,body').scrollTop(0); }); ga('send', 'event', 'button', 'click', 'Show End Page'); $('.cycle-slideshow').cycle('goto', 5); }); $("#amout_txt").keydown(function (e) { // Allow: backspace, delete, tab, escape, enter and . if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 || // Allow: Ctrl+A (e.keyCode == 65 && e.ctrlKey === true) || // Allow: home, end, left, right (e.keyCode >= 35 && e.keyCode <= 39)) { // let it happen, don't do anything return; } // Ensure that it is a number and stop the keypress if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) { e.preventDefault(); } }); $("#btn_share_result").click(function() { ga('send', 'event', 'button', 'click', 'Share Result'); var src = $("#char_head").attr('src').split('/'); var img_name = src[src.length - 1]; var url = "https://www.facebook.com/sharer/sharer.php?u=http://dontbodoh.com/result.php?char="+img_name; window.open(url, 'mywin', 'width=700,height=450,toolbar=0,resizable=true'); return false; }); function place_char(){ if (win_h >= 786){ var _mh = $(".masthead").height(); var _aa = (win_h - _mh - 251); $("#pg6_wrapper").height(_aa); } } }); function doOverImg(n){ var imgID = n.id; var imgSrc = n.src; var imgExt = imgSrc.split('.').pop(); $("." + imgID).attr("src", "images/"+imgID+"2."+imgExt); } function doOutImg(n){ var imgID = n.id; var imgSrc = n.src; var imgExt = imgSrc.split('.').pop(); $("." + imgID).attr("src", "images/"+imgID+"."+imgExt); } function getUrlVars(){ var vars = {}; var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) { vars[key] = value; }); return vars; }