$(document).ready(function(){


		// Custom jQuery InnerFade for Home Page
		// Download & Credits: http://www.stylephp.com/2009/01/17/customizing-jquery-innerfade-plug-in-adding-controls-navigation-and-caption/
	$('body.index ul#slideshow-panels').innerfade({
		speed					:	1000,
		timeout					:	8000,
		type					:	'sequence',
		animationtype			:	'fade',
		containerheight			:	'249px',
		slide_timer_on			:	'yes',
		slide_ui_parent			:	'slideshow-panels',
		slide_ui_text			:	'null',
		slide_nav_id			:	'slideshow-nav'
	});
	$.setOptionsButtonEvent();

		// Update the current displaying image and slide in it's corresponding text panel
	var slots = new Array(0,0,0,0,0,0,0,0,0,0);
	setInterval(function(){
		$("#slideshow-nav li").each(function(index){
			if ($(this).attr("id") == "button_selected") {
			
				if (slots[index] == 0) {
				
					setTimeout(function(){
						$("#slideshow-panels").find("li:not("+index+") span").css('margin-left','-700px');
						$("#slideshow-panels").find("li:eq("+index+") span").animate({"margin-left":"0"},1500,"swing");
					},100);
					
					slots[index] = 1;
				} else {
					for (var i=0; i<10; i++) {
						if (i != index) { slots[i] = 0; }
					}
				}
			}
	    });
	},250);

	
		// Display the bubble on roll-over
	$(".trigger").each(function(){
		var value = $(this).parent().find(".snippet").eq(-1).text();
		$(this).attr("title",value);
	});
	$(".trigger").tipTip({maxWidth: "350px", edgeOffset: 5, defaultPosition: "top"});


});

