// script de Idioma

function traducir(){
	if (location.href.indexOf('galego')!=-1){
		document.write('<a href="http://')
		document.write('www.vtelevision.es' + document.location.pathname + '" ');
		document.write('>castellano</a> ')
		document.write('<a href="http://galego.vtelevision.es' + document.location.pathname + '" ');
		document.write('class="act">gallego</a>');
	}else{
		document.write('<a href="http://')
		document.write('www.vtelevision.es' + document.location.pathname + '" ');
		document.write('class="act">castellano</a> ')
		document.write('<a href="http://galego.vtelevision.es' + document.location.pathname + '" ');
		document.write('>gallego</a>');
	}
}

function CrearCookie(Nombre, Valor) {
	var Dia = new Date();
	Dia.setDate(Dia.getDate() + 365); //caduca en un aņo
	document.cookie = Nombre + "=" + Valor + "; expires=" + Dia.toGMTString() + "; path=/";
}

function LeerCookie(NombreDeCookie) {
	var NumDeCookies = document.cookie.length;
	var NombreParaCookie = NombreDeCookie + "=";
	var LongDeCookie = NombreParaCookie.length;
	var x = 0;
	while (x <= NumDeCookies) {
		var y = (x + LongDeCookie);
		if (document.cookie.substring(x, y) == NombreParaCookie)
		return (ExtraeValorDeCookie(y));
		x = document.cookie.indexOf(" ", x) + 1;
		if (x == 0)
		break;
	}
	var vacio="?";
	return (vacio);
}

function ExtraeValorDeCookie(val) {
	var FinalDeCookie;
	if ((FinalDeCookie = document.cookie.indexOf(";", val)) == -1) {
		FinalDeCookie = document.cookie.length;
	}
	return unescape(document.cookie.substring(val,FinalDeCookie));
}
