
$(document).ready(function() {
	
    var spt_current = 0;
    var spt_total = 3;
    
    var spt_headline = new Array();
    var spt_url = new Array();
    var spt_graphic = new Array();
    var spt_content = new Array();
    
    var t;
    var rotate_speed = 7000;
    
    $("#spotlight_0_clk").addClass("spotlight_clickable_over");
		
		spt_headline[0] = "Fully Automated Fragment Library System";
		spt_url[0] = "/products/spriworks_system_i.html";
		spt_graphic[0] = "/images/spotlight/easyway.gif";
		spt_content[0] = "<p>The SPRIworks Fragment Library System I, which simplifies&nbsp;and automates the construction of DNA&nbsp;libraries, saves time and increases efficiency.</p>";
        
        		spt_headline[1] = "Advalytix Now Part of Beckman Coulter Genomics";
		spt_url[1] = "http://www.advalytix.com/";
		spt_graphic[1] = "/images/spotlight/adv.jpg";
		spt_content[1] = "<p>The Advalytix product group of Beckman Coulter Genomics offers two unique product lines for life science research: The AmpliGrid platform for molecular analysis of single cells and 1&micro;L assays, and the Booster line of small volume non-invasive mixing solutions.</p>";
        
        		spt_headline[2] = "The Only Sample That Matters is Yours";
		spt_url[2] = "/genomic_services.html";
		spt_graphic[2] = "/images/spotlight/WGI.gif";
		spt_content[2] = "<p>Beckman Coulter Genomics is a collaborator that cares about&nbsp;your samples as much as you do. A partner with the most&nbsp;advanced technology. A resource that believes in personalized&nbsp;service. We get it. We&rsquo;ll&nbsp;make sure <strong><em>you</em></strong> get it.</p><p>&nbsp;</p>";
        
        

	$("#spotlight_headline").hover(function() {
    	cancelRotation();
	}, function() {
    	cancelRotation();
    	t = setTimeout(function(){ changeSpotlight(); }, (rotate_speed * .75)); 
	});
    
    $("#spotlight_graphic").hover(function() {
    	cancelRotation();
	}, function() {
    	cancelRotation();
    	t = setTimeout(function(){ changeSpotlight(); }, (rotate_speed * .75)); 
	});
     
    $("#spotlight_content").hover(function() {
    	cancelRotation();
	}, function() {
    	cancelRotation();
    	t = setTimeout(function(){ changeSpotlight(); }, (rotate_speed * .75)); 
	});

	$(".spotlight_clickable").hover(function() {
    	cancelRotation();
	}, function() {
    	cancelRotation();
    	t = setTimeout(function(){ changeSpotlight(); }, (rotate_speed * .75)); 
	});
    
 
    
    function cancelRotation() {
    	if (t) { clearTimeout(t); }
    }
    
    
    
	$(".spotlight_clickable").click(function() {
    		cancelRotation();
            
    		t = $(this).attr("id");
			tmp = t.split("_");
			which = tmp[1];
         
             if (which >= 0) {
        	spt_current = which - 1 ;
         } else { 
       		spt_current = spt_total - 1;
         } 
        
       changeSpotlight();
    
    });

 
    
	function changeSpotlight() {
    	cancelRotation();
 
 		spt_current++;
		if (spt_current >= spt_total) { spt_current = 0; }
 
    	$("#spotlight_headline").html(spt_headline[spt_current]);
    	$("#spotlight_content").html(spt_content[spt_current]);
		$("#spotlight_graphic").attr("src", spt_graphic[spt_current]);
    	$(".spotlight_url").attr("href", spt_url[spt_current]);

		$(".spotlight_clickable").removeClass("spotlight_clickable_over");
        $("#spotlight_"+spt_current+"_clk").addClass("spotlight_clickable_over");
        
        t = setTimeout(function(){ changeSpotlight(); }, rotate_speed); 
        
    }
 
		t = setTimeout(function(){ changeSpotlight(); }, rotate_speed); 

});
