JF.Menu = function(){

	this.menuList = {};

};

JF.Menu.prototype.add = function(className){
	
	$('div.'+className).hover(function(){
		$(this).attr({
			className : className+'_hover'
		});
	},function(){
		$(this).attr({
			className : className
		});
	});
};

JF.Menu.prototype.setEffect = function( container ){
	$(document).ready(function(){
		var rootElem = $( '#' + container + ' ul' );
		
		for( var i = 0, len = rootElem[0].childNodes.length; i < len; i++ ) {
			if ( rootElem[0].childNodes[i].className == 'active' )
				continue;
			$( rootElem[0].childNodes[i] ).hover(function(){
				var step = 17;
				var instance = this;
				var value = 34;
				var rIntv = window.setInterval(function(){
					step--;
					value = value - 2;
					$(instance).css( { backgroundPosition : '0px ' + value + 'px' } );
					if( step < 1 ) {
						window.clearInterval( rIntv );
					}
				}, 10);
			},function(){
				var step = 0;
				var instance = this;
				var value = 0;
				var rIntv = window.setInterval(function(){
					step++;
					value = value + 2;
					$(instance).css( { backgroundPosition : '0px ' + value + 'px' } );
					if( step >= 17 ) {
						window.clearInterval( rIntv );
					}
				}, 10);
			})
		}
	});
};

JF.Menu.prototype.categoryH = function( container ){
	$(document).ready(function(){
		var rootElem = $( '#' + container + ' ul' );
		
		for( var i = 0, len = rootElem[0].childNodes.length; i < len; i++ ) {
			if ( rootElem[0].childNodes[i].className == 'active' || rootElem[0].childNodes[i].className == 'bottom' )
				continue;
			$( rootElem[0].childNodes[i] ).hover(function(){
				$(this).animate({ paddingLeft : '16px' },200);
			},function(){
				$(this).animate({ paddingLeft : '6px' },200);
			})
		}
	});
};

JF.Menu.prototype.setEffectExternal = function( container ){
	$(document).ready(function(){
		var rootElem = $( '#' + container + ' ul' );
		
		for( var i = 0, len = rootElem[0].childNodes.length; i < len; i++ ) {
			if ( rootElem[0].childNodes[i].className == 'active' )
				continue;
			$( rootElem[0].childNodes[i] ).hover(function(){
				//console.log( $(this)[0].firstChild );
				$($(this)[0].firstChild).effect("shake", { times: 1, direction: 'up', distance: 3 }, 200);
			},function(){
			})
		}
	});
};


$$JF.M = new JF.Menu();