//swfobject.registerObject("FlashID");
 
document.getElementById('menu-1').style.display = 'none';
document.getElementById('menu-2').style.display = 'none';
document.getElementById('menu-3').style.display = 'none';
 
var check,count = "0";
checkFront = $("body").hasClass("front");
checkLanding = $("body").hasClass("page-minivanssuvs-all-new-sportage");
function hidekan(t) { 
  if (t == 4) {
    if (checkFront) {
		$('#block-menu-menu-main-links ul').css({
			"background" : "url('/sites/all/themes/kiared/images/menu-top-tab-main.gif') no-repeat left bottom",
			"height" : "47px",
			"width" : "976px",
			"overflow" : "hidden",
			"padding-bottom" : "44px"
		})
    }
    else {
      if (checkLanding) {
        $('#block-menu-menu-main-links ul').css({
			"height" :"47px",
			"width" : "976px",
			"overflow" :"hidden"
		}) 
      }
      else {
        $('#block-menu-menu-main-links ul').css({
			"background" : "url('/sites/all/themes/kiared/images/menu-top-tab.gif') no-repeat left bottom",
			"height" : "47px",
			"width" : "976px",
			"overflow" : "hidden",
			"padding-bottom" : "44px" 
			})
      }
    }
    $('#menu-1').hide();
    $('#menu-2').hide();
    $('#menu-3').hide();
    check = 0;          
    count=0;            
  }
  else {
    for(a=1;a<=3;a++) {
      if (a != check) {
        $('#menu-'+a).css("z-index","10");    
      }
      else {
        $('#menu-'+check).css("z-index","11");
      }
    }
  }  
}
function showHidekan(t) {
    check = t;
    count++;
    if (count == 1) { 
      if (!checkLanding) {     
          $('#block-menu-menu-main-links ul').css("background","none");
      }   
      if (checkLanding) {     
         $('#block-menu-menu-main-links ul').css("height","47px"); 
      }
      $('#menu-1').css("margin-top","-46px");  
      $('#menu-2').css("margin-top","-46px");  
      $('#menu-3').css("margin-top","-46px");               
      $('#menu-'+t).css("overflow","hidden").slideDown();
    }
    else {
      $('#menu-'+check).hide();      
      $('#menu-'+t).css("z-index","999");
      $('#menu-'+t).show();
    }    
}
$("#block-menu-menu-main-links li a").mouseover(function(){
  getLink = $(this).attr("class");
  if ((getLink == "link1") || (getLink == "link1 active")) {
    showHidekan('1');
  }
  if ((getLink == "link2") || (getLink == "link2 active")) {
    showHidekan('2');
  }
  if ((getLink == "link3") || (getLink == "link3 active")) {
    showHidekan('3');
  }    
});
$("#block-menu-menu-main-links li a").mouseleave(function(){
  getLink = $(this).attr("class");
  if ((getLink == "link1") || (getLink == "link1 active")) {
    hidekan('1');
  }
  if ((getLink == "link2") || (getLink == "link2 active")) {
    hidekan('2');
  }
  if ((getLink == "link3") || (getLink == "link3 active")) {
    hidekan('3');
  }    
});
$('#header-blocks').mouseleave(function(){hidekan('4');});
$('#menu-1').removeAttr('onmouseover').removeAttr('onmouseout');
$('#menu-2').removeAttr('onmouseover').removeAttr('onmouseout');
$('#menu-3').removeAttr('onmouseover').removeAttr('onmouseout');

$('#menu-1').mouseleave(function(){hidekan('1')});
$('#menu-2').mouseleave(function(){hidekan('2')});
$('#menu-3').mouseleave(function(){hidekan('3')});

