// JavaScript Document
var SegonsIniDef = 10; // Segons per defecte //
var SegonsIni = SegonsIniDef;
var Segons = -1;
var Interval = 975;
var IntervalSalt = 100;
var TextCont_ES = "Consultar la versi&oacute;n en catal&aacute;n";
var TextCont_EN = "Consult the Catalan version";
var TextCont = "";
var NomId = "Cont";

// if (window.location.search) {
// 	SegonsIni = parseInt(window.location.search.substring(1));
// 	if (isNaN(SegonsIni)) {SegonsIni = SegonsIniDef;}
// 	else if (SegonsIni < 0) {SegonsIni = 0}
// }

function Temporitzador() {
	var MiliSegs = Interval;
	if (Segons == 0) {
		window.location.replace(URLbyLanguage("ca"));
	}
	else if (Segons > 0) {
		Segons -= 1;
		MostrarTemps();
		if (Segons == 0) MiliSegs = IntervalSalt;
		setTimeout ("Temporitzador()", MiliSegs);
	}
	else {
		Segons = SegonsIni;
		MostrarTemps();
		if (Segons == 0) MiliSegs = IntervalSalt;
		setTimeout ("Temporitzador()", MiliSegs)}
}

function MostrarTemps() {
	var ES = document.getElementById(NomId);
	var Cadena = "";
	Cadena = " (" + Segons + ")";
	ES.innerHTML = TextCont + Cadena;
}


