﻿var prod=document.getElementById("hfhp0").value;
            var nprod=document.getElementById("nhp").value;
            var prodact=0;
            var change=0;
            function Cambia(elem)
            {
                var i=0;
                for (i=0;i<=nprod;i++)
                {
                    if (i!=elem)
                    {
                        document.getElementById("ihp" + i).style.display="none";
                        document.getElementById("ihp" + i).style.visibility="hidden";
                        document.getElementById("ni" + i).style.color="#6F6F6F";
                        document.getElementById("ni" + i).style.borderColor="#6F6F6F";
                        document.getElementById("ni" + i).style.backgroundColor="Transparent";
                        document.getElementById("thp" + i).style.display="none";
                        document.getElementById("thp" + i).style.visibility="hidden";
                    }
                    else
                    {
                        document.getElementById("ihp" + elem).style.display="block";
                        document.getElementById("ihp" + elem).style.visibility="visible";
                        document.getElementById("ni" + elem).style.color="red";
                        document.getElementById("ni" + i).style.borderColor="red";
                        document.getElementById("ni" + elem).style.backgroundColor="red";
                        document.getElementById("thp" + elem).style.display="none";
                        document.getElementById("thp" + elem).style.visibility="hidden";
                        prod=document.getElementById("hfhp" + i).value;
                        prodact=i;
                        change++;
                        if (change!=prodact)
                        {
                            StopTheClock()
                        }
                    }
                }
            }
            function MuestraInfo()
            {
                document.getElementById("thp" + prodact).style.display="block";
                document.getElementById("thp" + prodact).style.visibility="visible";
            }
            function HPClick()
            {
                window.location="../division/producto.aspx?sec=55&id=" + prod + "&div=0"
            }
            var secs
            var timerID = null
            var timerRunning = false
            var delay = 1000

            function InitializeTimer()
            {
                // Set the length of the timer, in seconds
                secs = 2
                StopTheClock()
                StartTheTimer()
            }

            function StopTheClock()
            {
                if(timerRunning)
                    clearTimeout(timerID)
                timerRunning = false
            }
            
            function StartTheTimer()
            {
                if (secs==0)
                {
                    StopTheClock()
                    if(change != nprod)
                    {
                        Cambia(change+1)
                    }
                    else
                    {
                        change=-1
                        Cambia(0)
                    }
                    InitializeTimer()
                }
                else
                {
                    self.status = secs
                    secs = secs - 1
                    timerRunning = true
                    timerID = self.setTimeout("StartTheTimer()", delay)
                }
            }

InitializeTimer();