function resize_online(){
	h=(document.body.scrollHeight)


	a=parent.document.getElementById("iframe_online")
	a.height=h+"px"


// a veces el menu no sale porque el iframe termina de cargarse antes que la página, entonces h vale 0
// cuando h vale 0 espero 1 segundo y vuelvo a llamar a la funcion.

	if (h==0) setTimeout("resize_online()",1000)


}


function startTimer() {
        running = true
        now = new Date()
        now = now.getTime()
// cada 1 minutos
        endTime = now + (1000 * 60 * 1)
        showCountDown()
}






function showCountDown() {
        var now = new Date()
        now = now.getTime()
        if (endTime - now <= 0) {
                stopTimer()
                var result = unescape(window.location.href)

// cojo hasta ts=

		if (result.indexOf("ts=") != -1) {
			result = result.substring(0, result.indexOf("ts=")+3);
			d = new Date();
			result = result + d.getTime();
//			alert(result);
		}
		else{
			result = result + "?ts="
			d = new Date();
			result = result + d.getTime();
		}
		window.location=result
        } else {
                if (running) {
                        timerID = setTimeout("showCountDown()",1000)
                }
        }
}


function stopTimer() {
        clearTimeout(timerID)
        running = false
}



function enlace(pagina){
	d = new Date();
	document.location.href=pagina+"?ts="+d.getTime();
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Para cuando los tiempos tiran de la BD en sql
function cambiar(valor){
	d = new Date();
//	alert(valor.value)
	document.location = valor.value + ".html?ts="+ d.getTime();
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Para cuando termina el rally y se quedan las pag en html
/*
function cambiar(valor){ //tc_2_8
document.location = "tc_"+valor.value+"_"+tramo + ".html";
}

function cambiarasp(valor){
//	var tramo = parseInt(valor.value) + 1
	document.location = "tc_"+valor.value+"_"+tramo+".html" 
}
*/
/////////////////////////////////////////////////////////////////////////////////////////////////////////////

