On another tab slideshow breakes
<p>I have created my site and its main slideshow is working when I am on the the same tab.
<br/>The <b>problem</b> is this: When I open <b>another</b> tab <b>(and leave my MAIN site tab open)</b> and go back to <b>my site</b> after 5 min or more my <b>slideshow</b> is not working anymore:( 
<br/>So I tried to solve this with <b>code below</b> and is working but now i have another <b>BIG problem</b>: <br/>My interval inside <code>$(window).focus</code>function starts after <b>1min</b> and <b>14sek</b> <br/>(because my <code>animateLogo()</code> needs that time to complete animation so i can't call it <b>right away</b> if i <b>CALL my <code>animateLogo();</code> function right away it ruins my slides</b>) so now user need's to <b>WAIT THAT LONG (74000 milisec)</b> to actually see the animation!! <br/><b><i>So is there a smart way to solve this?</i></b> 
<br/>I didn't set fiddle because there's a lot of code in my animation but you can go to my <a href="http://www.robertpeic.com/biznis%20people/design%20solutions.html#" rel="nofollow">SITE HERE</a>.  </p>

<pre><code>$(document).ready(function(){
animateLogo();//activate Logo animation ONCE!!!
var intervalID;


var intervalIDLogo;

//Activate newsticker
intervalID=setInterval(animiraj,18000);

//After animateLogo(); is completed set it's Interval (loop it)
intervalIDLogo=setInterval(animateLogo,74000);


//on window BLUR clear Interval and SET to ZERO!

$(window).blur(function(){
    //alert('blur');
    clearInterval(intervalIDLogo);
    intervalIDLogo = 0;

});
//on window FOCUS SetInterval AGAIN!!

    $(window).focus(function(){

    if(!intervalIDLogo){
        //animateLogo();//IF I CALL AGAIN THIS SLIDER IS MESSED UP!!

     //IF I CALL THIS USER HAVE TO WAIT 74000 milisec TO SEE THE SLIDES!!       
        intervalIDLogo=setInterval(animirajLogo,74000);
    }

    });


});
</code></pre>
