$(document).ready(function(){

  $(":text").labelify();


function next(){
	
	var nitem = $('#carousel').find('ul li').eq(0);
	
	
	$(nitem).animate({marginLeft: '-130px'}, 250); 
	
	nitem.hide(0,function(){
		$(this).remove();	
		$('#carousel ul').append('<li>' + nitem.html() + '</li>');
	});
	
	
}


function prev(){
	
	var eqn = $('#carousel ul li').size() - 1;
	var pitem = $('#carousel').find('ul li').eq(eqn);
	

	
	//alert(pitem.html());
	
	pitem.hide(0, function(){
		$(this).remove();	
		$('#carousel ul').prepend('<li style="display:none; margin:0 0 0 -130px;">' + pitem.html() + '</li>');
		
		var first_item = $('#carousel').find('ul li').eq(0);		
		
		first_item.show().animate({marginLeft: '45px'}, 250);
		

		
		
		
		
		
	});	
	
	
}

$('#carousel .left').click(function(){  prev(); });
$('#carousel .right').click(function(){  next(); });


$('#hero-h1').show();


$('#hero .left li').live('mouseover mouseout', function(event){
	if (event.type == 'mouseover'){
		
		if ($(this).hasClass('selected')){
		} else {
		var hero = $(this).attr('id');
		$('#hero .left li').removeClass('selected');
		$(this).addClass('selected');
		
		$('#hero .right .hero-image').hide();
		
		$('#hero-' + hero).fadeIn(500);

		
		}
	}
});



});
