var DECIMAL = 10;

$(document).ready(function(){

	$('ul.menu li a').each(function(){

		var _this = $(this);

		$(_this).bind('mouseenter', function() {

			if (!$(this).hasClass('sel')) {
			
				$(this).css('backgroundPosition', '-254px 50%');
			}
		});

		$(_this).bind('mouseleave', function() {

			if (!$(this).hasClass('sel')) {
				
				$(this).css('backgroundPosition', '0% 50%');
			}
		});

		$(_this).bind('click', function() {
				
			if ($(_this).next('div').length) {
				
				if (!$(_this).next('div.open').length) {
				
					if (parseInt( $(_this).next('div').height(), DECIMAL ) > 0) {
	
						$(_this).next('div').animate({height: '0px'}, 400);
							
					} else {
							
						var
							_height = parseInt($(_this).next('div').children().height(), DECIMAL) + 'px';
						
						$(_this).next('div').animate({height: _height}, 400);
					}
				}	

				return false;		
			}		
		});
	});	
    
    if ($.browser.msie) {
    	
    	DD_belatedPNG.fix('.slidecontrolls a, .slidecontrolls a.active_item'); 
    }
    
    $('.slidecontrolls a').each(function(){
    	
    	var
    		_this = $(this)
    	
    	$(this).bind('mouseenter', function(){
    		
    		if (!$(_this).hasClass('active_item')) {
    		
    			$(_this).css('backgroundPosition', '50% 0%');
    		}
    	});
    	
     	$(this).bind('mouseleave', function(){
    		
     		if (!$(_this).hasClass('active_item')) {
     			
     			$(_this).css('backgroundPosition', '50% 100%');
     		}
    	});  	
    })

	Cufon.now();
	Cufon.replace('.path');
	Cufon.replace('.tab-repeat a');
	Cufon.replace('.tab-repeat-a a');
	Cufon.replace('ul.menu li a', {hover: true});
});
