function delayTimer(delay){
     var timer;
     return function(fn){
          timer=clearTimeout(timer);
          if(fn)
               timer=setTimeout(function(){
               fn();
               },delay);
          return timer;
     }
}

jQuery(document.body).ready(
    function()
    {
        
        //bad IE6 .... bad IE6 ..... bad.....
        if (jQuery.browser.msie && jQuery.browser.version < 7)
            return;
        
        var animatedTruck = jQuery('#animated-truck');
        
        //bring in the truck
        animatedTruck.animate({marginRight: '-20px'}, 2000);
        
        truckLeaving = delayTimer(5000);
        
        
        truckLeaving(
            function()
            {
                if (jQuery.browser.msie)
                {
                    var animationOptions = {marginLeft: '-2000px'};
                }
                else
                {
                    var animationOptions = {marginRight: '1000px'};
                }
                
                
                animatedTruck.animate(animationOptions, 3000);
                
                truckLeft = delayTimer(3500);
                
                truckLeft(
                    function()
                    {
                        jQuery('#phone').fadeIn(2000);
                        jQuery('#header-truck').fadeIn(2000);
                        if (jQuery('#see-more-pics') != undefined)
                        {
                            jQuery('#see-more-pics').fadeIn(2000);
                        }
                        
                        logoEnter = delayTimer(2500);
                        
                        logoEnter(
                            function()
                            {
                                jQuery('#logo').animate({marginLeft: '15px'}, 1000);
                            }
                        );
                        
                    }
                );
                
                
            }
        );
                            
    }
);


