$(document).ready(function(){

  /*$("#left-site a").hover(
      function() {
        $("#left-help").stop().animate({
          opacity: 0.9,
          left: '10px',
          //"margin-right": '10px',
        }, 250);
      }, function() {
        $("#left-help").stop().animate({
          opacity: 0,
          //"margin-right": '220px',
          left: '-200px',
        }, 800);
      });

  $("#right-site a").hover(
      function() {
        $("#right-help").stop().animate({
          opacity: 0.9,
          //"margin-left": '10px',
          right: '10px',
        }, 250);
      },
      function() {
        $("#right-help").stop().animate({
          opacity: 0,
          //"margin-left": '220px',
          right: '-200px',
        }, 1200);
      });*/

$("#header img").delay(1000).fadeInSequence(400, -150);
});



(function(jQuery) {
jQuery.fn.fadeInSequence = function(fadeInTime, timeBetween)
{
    //Default Values
    timeBetween = typeof(timeBetween) == 'undefined' ? 0 : timeBetween;
     fadeInTime = typeof(fadeInTime) == 'undefined' ? 500 : fadeInTime;

    //The amount of remaining time until the animation is complete.
    //Initially set to the value of the entire animation duration.
    var remainingTime = jQuery(this).size() * (fadeInTime+timeBetween);

    var i=0; //Counter
    return jQuery(this).each(function()
    {
        //Wait until previous element has finished fading and timeBetween has elapsed
        jQuery(this).delay(i++*(fadeInTime+timeBetween));

        //Decrement remainingTime
        remainingTime -= (fadeInTime+timeBetween);

        if(jQuery(this).css('display') == 'none')
        {
            jQuery(this).fadeIn(fadeInTime);
        }
        else //If hidden by other means such as opacity: 0
        {
            jQuery(this).animate({'opacity' : 1, 'margin': '5px'}, fadeInTime);
        }

        //Delay until the animation is over to fill up the queue.
        jQuery(this).delay(remainingTime+timeBetween);

    });

};

})(jQuery);
