// jQuery crossfade
// by Adam Perry
// Free for use under the GNU GPL (http://www.gnu.org/licenses/gpl.html)
$(document).ready(function() { 
   $('.cycle').each(function() { if ($(this).css('position') != 'absolute') $(this).css('position', 'relative'); });
   $('.cycle').find('img').css({position: 'absolute', top:0, left:0}).each(function(i) { 
      $(this).css('z-index', 1 - $(this).parent().children().index(this));
   });
   $('.cycle').children().css({position: 'absolute', top:0, left:0}).each(function(i) { 
      $(this).css('z-index', 1 - $(this).parent().children().index(this));
   });
   $('.cycle').hover(function() {
      var label = 'img';
      if ($(this).find('img').length == 0) label = 'div';
      $(this).find(label).stop();
      $(this).find(label + ':first').animate({opacity:0});
   }, function() {
      var label = 'img';
      if ($(this).find('img').length == 0) label = 'div';
      $(this).find(label).stop();
      $(this).find(label + ':first').animate({opacity:1});});
   // Stupid hack for IE8
   if ($(window).width() % 2) {
      $('#header-right').width($('#header-left').width() - 1);
   } else {
      $('#header-right').width($('#header-left').width());
   }
   $(window).resize(function() {
      if ($(window).width() % 2) {
         $('#header-right').width($('#header-left').width() - 1);
      } else {
         $('#header-right').width($('#header-left').width());
      }
   });
});
