var mouseover_tid = [];
var mouseout_tid = [];

function navC(addC){
  if ($('#nav li').hasClass(addC)) 
    $('#nav li.' + addC).addClass('current');
  else 
    return false;
}

function ieBg(){
  if(typeof document.body.style.maxHeight === "undefined") {
    var link = $('#background img').attr('src');
    $('#background').css('backgroundImage', ('url(' + link + ')'));
  }
}

$(function(){

  $('a[rel="external"]').attr('target', '_blank');
  
  $('#header .logo img').remove();
  
  $('#header .logo').flash({
    swf: 'images/layout/edglogo.swf',
    wmode: "transparent",
    height: 120,
    width: 120
  });
  
  
  jQuery('#nav > ul > li').each(function(index){
    jQuery(this).hover(function(){
      var _self = this;
      clearTimeout(mouseout_tid[index]);
      mouseover_tid[index] = setTimeout(function(){
        jQuery(_self).find('div.sub:eq(0)').slideDown(300);
      }, 200);
    }, function(){
      var _self = this;
      clearTimeout(mouseover_tid[index]);
      mouseout_tid[index] = setTimeout(function(){
        jQuery(_self).find('div.sub:eq(0)').slideUp(200);
      }, 0);
    });
  });
  
  
  $('#footer li.zh').hover(function(){
    $(this).children('.sub').slideToggle(0);
  }, function(){
    $(this).children('.sub').slideToggle(0);
  })
  
  ieBg();
  
});

