



/* sandazh menu animation, copy - me */



/**
 *
 * on page load - call activate menu:
 * function iterates through all menu items and creates on their places
 * animated menu blocks.
 * 
 * 
 */




$(document).ready(function(){
  
  
  // quick fix: disabling menu in ie6
  if (jQuery.browser.msie && (jQuery.browser.version == '6.0')) return;
  
  
  var menuspeed = 200;
  
  $('.headmenu .menuslideitemcontainer:not(.active)').mouseover(function(){
    
    
    var _this = this;
    
    $(_this).data().over = true;
    
    
    if (!$(_this).data().down && !$(_this).data().up){
      
      
      $(_this).data().up = true;
      
      
      $(_this).animate({top: -20}, menuspeed, null, function(){
        
        
        $(_this).data().up = false;
        
        $(_this).data().isup = true;
        
        
        if (!$(_this).data().over){
          
          
          $(_this).mouseout();
        }
      });
      
      
    } else if ( $(_this).data().down ){
      
      
      $(_this).data().down = false;
      
      $(_this).data().up = true;
      
      //$(_this).stop().css({top: -20}); $(_this).data().up = false; $(_this).data().isup = true;
      
      
      $(_this).stop().animate({top: -20}, menuspeed, null, function(){
        
        $(_this).data().up = false;
        $(_this).data().isup = true;
        
        if (!$(_this).data().over){
          
          $(_this).mouseout();
        }
      });
      
      
    }
    
    
  });
  
  
  $('.headmenu .menuslideitemcontainer:not(.active)').mouseout(function(){
    
    var _this = this;
    
    $(_this).data().over = false;
    
    if (!$(_this).data().up && !$(_this).data().down && $(_this).data().isup){
      
      $(_this).data().down = true;
      
      $(_this).animate({top: 0}, menuspeed, null, function(){
        
        $(_this).data().down = false;
        $(_this).data().isup = false;
      });
      
    }
  });
  
  
});















/*

$(document).ready(function(){
  
  
  
  // quick fix: disabling menu in ie6
  if (jQuery.browser.msie && (jQuery.browser.version == '6.0')) return;
  
  
  
  
  $('.headmenu .menuslideitemcontainer:not(.active)').mouseover(function(){
    
    
    var _this = this;
    
    $(_this).data().over = true;
    
    
    if (!$(_this).data().down && !$(_this).data().up){
      
      
      $(_this).data().up = true;
      
      
      $(_this).children('.menuslideitem').animate({top: -20}, 250, null, function(){
        
        
        $(_this).data().up = false;
        
        $(_this).data().isup = true;
        
        
        if (!$(_this).data().over){
          
          
          $(_this).mouseout();
          
          // $(_this).data().down = true;
          // $(_this).children('.menuslideitem').animate({top: 0}, 250, null, function(){$(_this).data().down = false;$(_this).data().isup = false;});
          
        }
        
        
      });
      
    }
    
    
  });
  
  
  $('.headmenu .menuslideitemcontainer:not(.active)').mouseout(function(){
    
    
    var _this = this;
    
    $(_this).data().over = false;
    
    
    if (!$(_this).data().up && !$(_this).data().down && $(_this).data().isup){
      
      
      if (true) {
          
          
        $(_this).data().down = true;
        
        
        var cbcount = 0; // counting callbacks, becouse animating two blocks, waiting for secont callback
        
        $(_this).children('.menuslideitem').animate({top: 0}, 250, null, function(){
          
          
          cbcount++;
          
          if (cbcount == 2){
            
            $(_this).data().down = false;
            
            $(_this).data().isup = false;
            
            //if ($(_this).data().over) $(_this).mouseover();
            
          }
          
          
        });
        
        
      }
      
      
    }
    
    
  });
  
  
  
  
});


*/





























