$.fn.divSwitcher = function() 
{

	// show intro paragraph - is optional
	$("#intro").show();
	
	// add "switcher" class to children of the "container" div
	$('#diag-info').children('div').each(function(){
		$(this).addClass("switcherDiag");
		
	});
	
	// create array for div id's
	var itemNames=new Array();	

	// add unique id's to each of the divs with the "switcher class"  - is numerical index: 0,1,2,3 etc
	$(".switcherDiag").each(function(index, element){
		$(element).attr("id", "divSwitch"+index);
		itemNames.push("divSwitch"+index);
	});

	// hide items
	$(".click").removeClass("selected");
	$(".switcherDiag").hide();	
	
    // show the first item
    if (itemNames.length > 0)
    {
        $("#" + itemNames[0]).fadeIn(1400);
    }

	// pick up item click and determine which id	
	$(this).mouseenter(function(){      
		var showItem = this.id.replace(/Diag/,'');
			  
		// hide items
		$(".click").removeClass("selected");
	    $(".switcherDiag").hide();	
			
		// show target div
		$("#" + showItem).fadeIn(1400);
		$(this).addClass("selected");
			
	});	
	

	
};

$(document).ready(function() {
	$(".click").divSwitcher() // go!
});	