﻿function HideAllSections()
    {
        $("div#divproductsall").fadeOut("slow");
        $("div#divproductsprinter").fadeOut("slow");
        $("div#divproductsenterprise").fadeOut("slow");
        $("div#divproductscommercial").fadeOut("slow");
        $("div#divproductsindependant").fadeOut("slow");
        $("div#divproductstelecom").fadeOut("slow"); 
        
        $("div#generalnews").fadeOut("slow");
        $("div#printernews").fadeOut("slow");
        $("div#enterprisenews").fadeOut("slow");
        $("div#commercialnews").fadeOut("slow");
        $("div#independentnews").fadeOut("slow");
        $("div#faxnews").fadeOut("slow"); 
        
        $("div#hright").fadeOut("slow");
        $("div#printermfpright").fadeOut("slow");
        $("div#enterpriseright").fadeOut("slow");
        $("div#commercialright").fadeOut("slow");
        $("div#independentright").fadeOut("slow");
        $("div#telecomright").fadeOut("slow");  
        
              
        
        return false;
    }
    
    
    
    function DelayShowSection(elSectionHeaderLI, SectionID, SectionHeaderAncID, FeaturedProductID, LatestNewsID)
    {
        if(document.getElementById(SectionID) != null)
        {            
            //use the title as a flag. this is so we can see if that the mouseout has been triggered before 5 secounds
            elSectionHeaderLI.className  = "IsHovered";        
            
            //delay 5 seconds and then execute the ShowSection function.
            setTimeout("ShowSection(document.getElementById('"+elSectionHeaderLI.id+"'), '"+SectionID+"', '"+SectionHeaderAncID+"','"+FeaturedProductID+"', '"+LatestNewsID+"')",500);            
        }
        
    }
    
    function ShowSection(elSectionHeaderLI, SectionID, SectionHeaderAncID, FeaturedProductID,LatestNewsID)
    {    
       
        if(document.getElementById(SectionID).style.display == 'none' && elSectionHeaderLI.className == "IsHovered")
        {        
            //check if the header has been moused over for more than .5 seconds and it isnt already selected
            HighlightSectionHeader(elSectionHeaderLI, SectionHeaderAncID);
            HideAllSections();           
                          
            $("div#" + SectionID).fadeIn("slow");
                                   
            //put the fade in on a delay so that it looks right
            setTimeout("$('div#" + LatestNewsID + "').fadeIn('slow');",500);
            setTimeout("$('div#" + FeaturedProductID + "').fadeIn('slow');",500);
        }
    }
    
    function HighlightSectionHeader(elSectionHeaderLI, SectionHeaderAncID)
    {
        //set highlighted style
        elSectionHeaderLI.style.float = "left";
        elSectionHeaderLI.style.width = "149px";
        elSectionHeaderLI.style.height = "36px";
        //elSectionHeaderLI.style.paddingTop = "3px";
        elSectionHeaderLI.style.color = "#fff";
        elSectionHeaderLI.style.fontSize = "12px";
        elSectionHeaderLI.style.fontWeight = "bold";
        elSectionHeaderLI.style.textDecoration = "none";
        
        //unhighlight nav anchors
        document.getElementById("ctl00_cphnav_mainNav_navbg1").style.background = "url(/images/navbg3off.jpg) 0 0 no-repeat";
        document.getElementById("ctl00_cphnav_mainNav_navbg2").style.background = "url(/images/navbg2off.jpg) 0 0 no-repeat";
        document.getElementById("ctl00_cphnav_mainNav_navbg3").style.background = "url(/images/navbg1off.jpg) 0 0 no-repeat";
        document.getElementById("ctl00_cphnav_mainNav_navbg4").style.background = "url(/images/navbg5off.jpg) 0 0 no-repeat";
        document.getElementById("ctl00_cphnav_mainNav_navbg5").style.background = "url(/images/navbg4off.jpg) 0 0 no-repeat";
        
        
        
        //highlight the selected one
        var tempz;
	if(SectionHeaderAncID.substring(21) == 'navbg1')
		tempz = 'navbg3';
	if(SectionHeaderAncID.substring(21) == 'navbg2')
		tempz = 'navbg2';
	if(SectionHeaderAncID.substring(21) == 'navbg3')
		tempz = 'navbg1';
	if(SectionHeaderAncID.substring(21) == 'navbg4')
		tempz = 'navbg5';
	if(SectionHeaderAncID.substring(21) == 'navbg5')
		tempz = 'navbg4';

	document.getElementById(SectionHeaderAncID).style.background="url(/images/"+tempz+"on.gif) 0 0 no-repeat";

	//document.getElementById(SectionHeaderAncID).style.background="url(/images/"+SectionHeaderAncID.substring(21)+"on.gif) 0 0 no-repeat";

       
    }
    
    


