// Variables
var secs;
var timerID = null;
var timerRunning = false;

Event.observe(window, 'load', initScripts);

function initScripts()
{
	// $("content").hide();
	/*$("lastminute").style.opacity = 0.0;
	new Effect.BlindDown("content", 
		{ duration: 0.5,
		  from: 0.0,
			to: 1.0,
		} 
	);
	
	$("lastminute").show();
	new Effect.Fade("lastminute", 
		{ duration: 1.0,
		  from: 0.0,
			to: 1.0,
			queue: 'end'
		} 
	);
	
	Event.observe($("stones"), "mouseover", overStones);
	Event.observe($("stones"), "mouseout", overStones); */
  InitializeTimer();	
}

function overStones()
{
	var img = $("stonepix");
	var s = img.src.substr(img.src.length - 10, 10);
	
	if (s == "galets.png")
		img.setAttribute("src", "fileadmin/templates/main/pix/galets2.png");
	else
		img.setAttribute("src", "fileadmin/templates/main/pix/galets.png");
		
	// img.setAttribute("src", "pix/galets2.png");
	// img.src = "pix/galets2.png";
}

function popup(url, width, height) {
	window.open(url, "player", "width=" + width + ",height=" + height + ",scrollbars=no,menubar=no,status=no,location=no,resizable=no,toolbar=no");
}


function InitializeTimer()
{
    // Set the length of the timer, in seconds
    secs = 10;
    StopTheClock();
    StartTheTimer();
}

function StopTheClock()
{
    if(timerRunning)
        clearTimeout(timerID);
    timerRunning = false;
}

function StartTheTimer()
{
    if (secs == 0)
    {
        StopTheClock();
        
      	new Effect.Appear("infobulle",
      	  { duration: 0.5,
            from: 0.0,
            to: 1.0
          }
        );        
    }
    else
    {
        self.status = secs;
        secs = secs - 1;
        timerRunning = true;
        timerID = self.setTimeout("StartTheTimer()", 300);
    }
}