var img_name_parc = new Array("DSC00969.JPG", "DSC00971.JPG", "DSC00972.JPG", "DSC00976.JPG" , "DSC00978.JPG" , "DSC00979.JPG" , "DSC00981.JPG" , "DSC00986.JPG" , "DSC00988.JPG" );
var l_parc = img_name_parc.length;
var img_name_showroom = new Array("DSC01011.JPG", "DSC01012.JPG", "DSC01013.JPG", "DSC01014.JPG", "DSC01015.JPG", "DSC01018.JPG" );
var l_showroom = img_name_showroom.length;
var img_name_activitati = new Array("DSC01991.JPG", "DSC01994.JPG", "DSC01995.JPG", "DSC02002.JPG", "DSC02010.JPG", "DSC02013.JPG", "DSC02015.JPG", "DSC02018.JPG" );
var l_activitati = img_name_activitati.length;


var secs
var timerID = null
var timerRunning = false
var delay = 1000

function InitializeTimer()
{
    // Set the length of the timer, in seconds
    secs = 15
    StopTheClock()
    StartTheTimer()
}

function StopTheClock()
{
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function StartTheTimer()
{
    if (secs==0)
    {
        StopTheClock()
        // Here's where you put something useful that's
        // supposed to happen after the allotted time.
        // For example, you could display a message:
        var rnd_no_parc = Math.floor(l_parc*Math.random());
		document.getElementById("randomimage_parc").src = "/foto/parc_auto/" + img_name_parc[rnd_no_parc];
        var rnd_no_showroom = Math.floor(l_showroom*Math.random());
		document.getElementById("randomimage_showroom").src = "/foto/showroom/" + img_name_showroom[rnd_no_showroom];
        var rnd_no_activitati = Math.floor(l_activitati*Math.random());
		document.getElementById("randomimage_activitati").src = "/foto/spons/" + img_name_activitati[rnd_no_activitati];
		InitializeTimer()
    }
    else
    {
        self.status = secs
        secs = secs - 1
        timerRunning = true
        timerID = self.setTimeout("StartTheTimer()", delay)
    }
}

