// Settings
var case_path = "custom/case/";
var case_width = 793;
var case_height = 336;
var current_obj = 0;

// Set Gfx Object
$.fn.gfx_object = function(src, f){

	// Image object
	return this.each(function(){
		var i = new Image(case_width, case_height);
		i.src = src;
		i.onload = f;
		$(this).html(i);
	});
}

jQuery(document).ready(function(){
	
	// Set hover action on each thumb
	$("#customer_thumbs_content img").mouseover(function () {
		
		linked_obj = $(this).attr("alt");
		
		if (linked_obj != "" && linked_obj != current_obj) {
			
			$("#case_1").css("display", "none");
			
			new_src = case_path+linked_obj+".jpg";
			
			$("#case_1").gfx_object(new_src ,function(){

				$("#case_1").fadeIn("slow");
			});
			
			current_obj = linked_obj;
		}		
		
		$(this).animate({opacity: "1"}, 300); 
	});
	
	$("#customer_thumbs_content img").bind("mouseout", function() {

		$(this).animate({opacity: "0.4"}, 300); 
	});
})
