// STFC home page script
// Created 22 June 2010
// Last updated 19 October 2010 - change highlights for Fascination

// highlights

            var rootId = -1;
            var linkString;
            var scrollMe = true;
	        var shortPause = false;
	        var hIntervalId;            
             
            function showHighLight(id)        
                {   
                    document.getElementById("fsCaption").innerHTML = factSheetGubbins[id][1];   
                                        
                    elId = "url(/images/factsheets/f" + factSheetGubbins[id][0] + ".jpg)";  
                    document.getElementById("stfcFacts").style.backgroundImage = elId;  
                    document.getElementById("ctl00_cphMainContent_fsLinkCaption").innerHTML = factSheetGubbins[id][2];
                     document.getElementById("ctl00_cphMainContent_fsLinkCaption").title = factSheetGubbins[id][2];                   
                    document.getElementById("ctl00_cphMainContent_fsLinkCaption").href = factSheetGubbins[id][3] + ".aspx";    

                    // change to longer pause once running
                    if (shortPause == false)			    	
                     {
                      clearInterval(hIntervalId);
                      hIntervalId = setInterval("changeHighLight()", 5000);
                      shortPause = true;
                     } 
                 }
                
            function changeHighLight()
                {
                    if (scrollMe == true)
                    {
                        rootId = rootId + 1;
                        if (rootId > factSheetCount - 1)
                            {rootId = 0;}
                        showHighLight(rootId);   
                    }
                }            
	    
            // set starting display to 10 seconds - changed to 5 secs by first rotation in showHighLight()
            hIntervalId = setInterval("changeHighLight()", 10000)
            
            function showNews(id)
                {
                    for (i = 1; i < 5; i++)
                        {
                            elId = "n" + i;
                            {document.getElementById(elId).style.display = "none";}
                        } 
                    
                    if (id > 0)
                        {
                            elId = "n" + id; 
                            document.getElementById(elId).style.display = "block";                    
                        }                
                }
                
            function pauseScroller()
                {
                if (scrollMe == true)
                    {scrollMe = false;                    
                     document.getElementById("scrollControl").src = "/images/system2/parts/fsStartNav2.jpg"
                     document.getElementById("scrollControl").alt = "Resume spotlight scrolling";
                     document.getElementById("scrollControl").title = "Resume spotlight scrolling";}
                else
                    {scrollMe = true;
                     document.getElementById("scrollControl").src = "/images/system2/parts/fsPauseNav2.jpg"
                     document.getElementById("scrollControl").alt = "Pause spotlight scrolling";
                     document.getElementById("scrollControl").title = "Pause spotlight scrolling"}
                }  

// end highlights



