/******************************************************************************************************************/
// CLOSE UP FUNCTIONS
/******************************************************************************************************************/

function slideItem(i){
	items = $('#closeup LI').size();
	
	w = items * 900;
	$('#closeup UL').width(w);
	
	offset = i * 900;
	offset = '-'+ offset +'px';
	
	$('#closeup UL').animate({ left: offset }, 800, 'easeOutExpo');
	
	i++;
	if (i >= items) i = 0;
	
	SliderTimerId = window.setTimeout('slideItem('+ i +')', 4000);
}

function handleCloseup(){
	items = $('#closeup LI').size();
	
	if (items > 1) {
		slideItem(0);
		
		$('#closeup LI').hover(function(){
			clearTimeout(SliderTimerId);
			index = $('#closeup LI').index(this);
		}, function(){
			SliderTimerId = window.setTimeout('slideItem('+ index +')', 0);
		});
	}
}

/******************************************************************************************************************/
// MENU & MACROS FUNCTIONS
/******************************************************************************************************************/

function menuFx() {
	$('#menu LI').hover(function(){
		index = $('#menu LI').index($('.sel'));
		$('#menu .sel').removeClass('sel');
	}, function(){
		$('#menu LI:eq('+ index +')').addClass('sel');
	});
}

function macrosFx(){
	$('#macros A').css({backgroundPosition: "0px 0px"});
	
	$('#macros A').hover(function(){
		$(this).stop().animate({ backgroundPosition:"(0px -90px)" }, { duration: 200 })
	}, function(){
		$(this).stop().animate({ backgroundPosition:"(0px 0px)"}, { duration: 250 })
	});
}

/******************************************************************************************************************/
// On document load...
/******************************************************************************************************************/

$(function(){
	// on search focus
	$('#search .input-txt').focus(function(){ $(this).attr('value','');	});
	
	// menu & macros fx
	menuFx();
	macrosFx();
	
	// close up handle
	handleCloseup();
});
