var timer;
var arrIDs = new Array("_Canister", "Canister", "_SuctionPump", 
						"SuctionPump", "__Display", "_Display", "Display", "_USB", "USB",
						"Adapter","_Adapter", "Tubing","_Tubing");

function createTimer()
{
	var anId 		= '#' + arrIDs[ Math.round( Math.random() * (arrIDs.length-1)) ];
	var randomTime	= Math.round( Math.random() * 2000);
	$(anId).trigger("mouseover");
	window.setTimeout("clearHover('"+anId+"')", 1000);
	timer = window.setTimeout("createTimer()", randomTime);
}

function clearHover( id )
{
	$(id).trigger("mouseout");
}

$(document).ready( function()
{
	$("#Thopaz").mouseover( function() { clearTimeout( timer ); } );
	$("#Thopaz div, #Thopaz td").hover(
		function(){
			var idx = this.id.lastIndexOf("_") + 1;
			if ( idx > 0 )
				$("#" + this.id.substr(idx)).addClass("hovered");
			else
				$("#" + this.id).addClass("hovered");						
								
			$("#_" +this.id.substr(idx)).addClass("hightlight").show();
		},
		function(){
			var idx = this.id.lastIndexOf("_") + 1;
			if ( idx > 0 )
				$("#" + this.id.substr(idx)).removeClass("hovered");
			else
				$("#" + this.id).removeClass("hovered");						
			
			$("#_" + this.id.substr(idx)).removeClass("hightlight");
		}
	).click( function()
	{
		var idx 		= this.id.lastIndexOf("_") + 1;
		var myId 		= "#" + this.id.substr(idx);		
		var link		= $(myId + " a").attr("href");
		
		if ( link != undefined && link != "") location.href = link;
			
	});
	
	createTimer();
});