function loadball5 () { $( ".ball5result" ).css ("display" , "none"); $( ".ball5result" ).load( "ajax/ball5.php?token=f6e06644c3fb17c52be6bd0421b599b9", function( response, status, xhr ) { console.log (status); if ( status == "error" ) { setTimeout(function(){ loadball5 (); }, 2000); } else { $( ".ball5result" ).fadeIn(300); } }); } function loadball10 () { $( ".ball10result" ).css ("display" , "none"); $( ".ball10result" ).load( "ajax/ball10.php?token=f6e06644c3fb17c52be6bd0421b599b9", function( response, status, xhr ) { console.log (status); if ( status == "error" ) { setTimeout(function(){ loadball10 (); }, 2000); } else { $( ".ball10result" ).fadeIn(300); } }); } function sbloadball10 () { $( ".sbball10result" ).css ("display" , "none"); $( ".sbball10result" ).load( "ajax/sbball10.php?token=f6e06644c3fb17c52be6bd0421b599b9", function( response, status, xhr ) { console.log (status); if ( status == "error" ) { setTimeout(function(){ sbloadball10 (); }, 2000); } else { $( ".sbball10result" ).fadeIn(300); } }); } function mark6 () { $( ".mark6result" ).css ("display" , "none"); $( ".mark6result" ).load( "ajax/mark6.php?token=f6e06644c3fb17c52be6bd0421b599b9", function( response, status, xhr ) { console.log (status); if ( status == "error" ) { setTimeout(function(){ mark6 (); }, 2000); } else { $( ".mark6result" ).fadeIn(300); } }); } function loadball3 () { $( ".ball3result" ).css ("display" , "none"); $( ".ball3result" ).load( "ajax/ball3.php?token=f6e06644c3fb17c52be6bd0421b599b9", function( response, status, xhr ) { console.log (status); if ( status == "error" ) { setTimeout(function(){ loadball3 (); }, 2000); } else { $( ".ball3result" ).fadeIn(300); } }); } function loadball8 () { $( ".ball8result" ).css ("display" , "none"); $( ".ball8result" ).load( "ajax/ball8.php?token=f6e06644c3fb17c52be6bd0421b599b9", function( response, status, xhr ) { console.log (status); if ( status == "error" ) { setTimeout(function(){ loadball8 (); }, 2000); } else { $( ".ball8result" ).fadeIn(300); } }); } function loadball20 () { $( ".ball20result" ).css ("display" , "none"); $( ".ball20result" ).load( "ajax/ball20.php?token=f6e06644c3fb17c52be6bd0421b599b9", function( response, status, xhr ) { console.log (status); if ( status == "error" ) { setTimeout(function(){ loadball20 (); }, 2000); } else { $( ".ball20result" ).fadeIn(300); } }); } function loadball11 () { $( ".ball11result" ).css ("display" , "none"); $( ".ball11result" ).load( "ajax/ball11.php?token=f6e06644c3fb17c52be6bd0421b599b9", function( response, status, xhr ) { console.log (status); if ( status == "error" ) { setTimeout(function(){ loadball11 (); }, 2000); } else { $( ".ball11result" ).fadeIn(300); } }); } var timeLeft1; var timeLeft3; var timeLeft4; var timeLeft5; var timeLeft6; var timeLeft7; var timeLeft8; var timeLeft9; function convertTime (num) { var shownum = String (num); var countnum = shownum.length; if (countnum == 1) { shownum = "0" + shownum; return shownum; } else { return shownum; } } function countdown (sec,countdiv) { var minute = sec /60; minute = Math.floor(minute); if (minute == 0) { var showminute = "00"; } else { var showminute = String (minute); showminute = convertTime (showminute); } var second = sec - (minute * 60); var showsec = convertTime (second); if (sec < 0) { $(".countdown" + countdiv).html ("00:00"); } else { $(".countdown" + countdiv).html (showminute + ":" + showsec); } } function timeleft () { if (timeLeft1 == 0) { countdown (timeLeft1, "1"); setTimeout(function(){ loadball5 (); }, 7000); } else { countdown (timeLeft1, "1"); } timeLeft1 --; } function timeleft2 () { if (timeLeft3 == 0) { countdown (timeLeft3, "3"); setTimeout(function(){ loadball10 (); }, 10000); } else { countdown (timeLeft3, "3"); } timeLeft3 --; } function timeleft3 () { if (timeLeft4 == 0) { countdown (timeLeft4, "4"); setTimeout(function(){ sbloadball10 (); }, 10000); } else { countdown (timeLeft4, "4"); } timeLeft4 --; } function timeleft5 () { if (timeLeft5 == 0) { countdown (timeLeft5, "5"); setTimeout(function(){ mark6 (); }, 10000); } else { countdown (timeLeft5, "5"); } timeLeft5 --; } function timeleft6 () { if (timeLeft6 == 0) { countdown (timeLeft6, "6"); setTimeout(function(){ loadball3 (); }, 10000); } else { countdown (timeLeft6, "6"); } timeLeft6 --; } function timeleft7 () { if (timeLeft7 == 0) { countdown (timeLeft7, "7"); setTimeout(function(){ loadball8 (); }, 10000); } else { countdown (timeLeft7, "7"); } timeLeft7 --; } function timeleft8 () { if (timeLeft8 == 0) { countdown (timeLeft8, "8"); setTimeout(function(){ loadball20 (); }, 10000); } else { countdown (timeLeft8, "8"); } timeLeft8 --; } function timeleft9 () { if (timeLeft9 == 0) { countdown (timeLeft9, "9"); setTimeout(function(){ loadball11 (); }, 10000); } else { countdown (timeLeft9, "9"); } timeLeft9 --; } setInterval(function(){ timeleft(); timeleft2(); timeleft3(); timeleft5(); timeleft6(); timeleft7(); timeleft8(); timeleft9(); }, 1000); loadball5 (); loadball10 (); sbloadball10 (); mark6 (); loadball3 (); loadball8 (); loadball20 (); loadball11 ();