var timerID = null;          //Identidad del temporizador
var timerRunning = false;    //Flag para saber si el reloj esta activo

function stopTimer()
{        //Para el reloj       
if(timerRunning) 
	{                
	clearTimeout(timerID);
	timerRunning = false;
	}
} 

function startTimer(idioma)
	{     // Para el reloj, si esta activo y lo arranca.  
	stopTimer();
	runClock(idioma);
	}

function runClock(idioma)
	{        
	
	var Hora=timeNow();		// Solo para evitar hacer varias llamadas
	var Dia=fechahoy(idioma);
	// Mostrar la hora en los elementos que se desee
	window.document.getElementById("reloj").innerHTML= Dia + " " + Hora;
	//window.status=Dia + " " + Hora;
	//window.document.title=Dia + " " + Hora;	//Si no hay frames
	//top.document.title=Dia + " " + Hora;      //Por si hay frames
	timerID = setTimeout("runClock()",1000);	//setTimeout() se llama a si mismo.
	timerRunning = true;
	}

function timeNow() 
	{        //Toma la hora y la formatea        
	now = new Date();
	hours = now.getHours();
	minutes = now.getMinutes();
	seconds = now.getSeconds();
	timeStr = ((hours < 10) ? "0" : "") + hours;
	timeStr += ((minutes < 10) ? ":0" : ":") + minutes;
	timeStr += ((seconds < 10) ? ":0" : ":") + seconds;
	return timeStr;
	}

function fechahoy(idioma){
fecha = new Date()
mes = fecha.getMonth()
diaMes = fecha.getDate()
diaSemana = fecha.getDay()
anio = fecha.getFullYear()
if (idioma == 1){
	dias = new Array('Diumenge','Dilluns','Dimarts','Dimecres','Dijous','Divendres','Dissabte')
	meses = new Array('de Gener','de Febrer','de Març','d´Abril','de Maig','de Juny','de Juliol','d´Agost','de Setembre','d´Octubre','de Novembre',' de Desembre')
	conj = " de ";
	termin = "";
}
else if(idioma == 2){
	dias = new Array('Domingo','Lunes','Martes','Miercoles','Jueves','Viernes','Sábado')
	meses = new Array('de Enero','de Febrero','de Marzo','de Abril','de Mayo','de Junio','de Julio','de Agosto','de Septiembre','de Octubre','de Noviembre','de Diciembre')
	conj = " de ";
	termin = "";
}
else if (idioma == 3){
	dias = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday')
	meses = new Array('January','February','March','April','May','June','July','August','September','October','November','December')
	conj = " ";
	if (diaMes == 1 || diaMes == 11 || diaMes == 21 || diaMes == 31) termin = "st";
	else if (diaMes == 2 || diaMes == 22) termin = "nd";
	else if (diaMes == 3) termin = "rd";
	else termin = "th";
}
else if(idioma == 4){
	dias = new Array('Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi')
	meses = new Array('Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Décembre')
	conj = " de ";
	termin = "";
}

ahora = dias[diaSemana] + ", " + diaMes + termin + " " + meses[mes] + conj + anio;
return ahora;
}
	
function addBookmark(){ 
	direccion = "http://www.turismevalles.net";
	descripcion = "Consorci de Turisme del Vallès Oriental";
    if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>3)){ 
          window.external.AddFavorite(direccion,descripcion); 
    } 
    else if(navigator.appName == "Netscape") { 
       alert("Presione Crtl+D para agregar esta página a sus 'Bookmarks'"); 
    } 
   else{ 
      alert("su navegador no dispone de esta opción"); 
    } 
} 	
function enviaCerca(){
	document.forms.form0.submit();
}
