$(document).ready(function(){
  
    // Border of first carousel element
    $("#0").css('borderWidth','5px').css('margin','0px');
    $('#carousel_description').html($("#0").attr('title'));
    
 	$("#status").everyTime(5000,function(){	if ($("#status").html() == 'cycle')	$(this).trigger('click'); });
	
	$("#bc")
		.jCarouselLite({ 
			btnNext		: 	"#status", 
			speed		:	'4000',
			visible		:	1,
			btnGo		:	[ "#0", "#1", "#2", "#3", "#4", "#5", "#6"],
			afterEnd	: 	function(){ 
								$(".hold-items ul li").css('borderWidth','1px').css('margin','5px');
								var p = parseInt($(this).css('left'));
								p = (p*-1/700-1)%7;   // 700 = width of the main image, 7 = number of items
								$('#'+p).css('borderWidth','5px').css('margin','0px');
								$('#carousel_description').html($("#"+p).attr('title'));
							}
		})
		.hover(
			function(){	$('#status').html($(this).attr('id'));	},
			function(){	if ($('#status').html().substring(0,1) != '_') $('#status').html('cycle');	}
		)
	; 

	$(".hold-items ul li")
		.hover(	function(){
				$(".hold-items ul li").css('borderWidth','1px').css('margin','5px');
				$(this).css('borderWidth','5px').css('margin','0px').trigger('click');
				$('#status').html($(this).attr('id'));
				$('#carousel_description').html($(this).attr('title'));
			},
			function(){	if ($('#status').html().substring(0,1) != '_') $('#status').html('cycle');	}
		)
		.click( function(){	$('#status').html('_'+$('#status').html($(this).attr('id'))); })
	;	
});

function download() {
  location.href = '/?page_id=6';
}
