function Inicio(){
	Get = "";
	Movimiento = "";
	TextoNoticias = document.getElementById("Noticias").innerHTML;
	document.getElementById("Noticias").style.height=0;
	AlturaTexto=document.getElementById("Noticias").scrollHeight;
	document.getElementById("Noticias").style.height='100%';
	Panel();
}
function Transparentar(item){
	if (Opacidad <= 0) {
		Opacidad = 0; clearInterval(intervalo);
		DescargarTexto();
	};
	Opacidad = Opacidad - 10;
	document.getElementById(item).style.filter ="alpha(Opacity="+Opacidad+")";
}
function DesTransparentar(item){
	if (Opacidad >= 100) {
		Opacidad = 100; 
		clearInterval(intervalo);
	};
	Opacidad = Opacidad + 10;
	document.getElementById(item).style.filter ="alpha(Opacity="+Opacidad+")";
}
function CambiarTexto(){
	Opacidad= 100;
	intervalo=setInterval("Transparentar('Texto')",10);
}
function DescargarTexto(){
	Descargar(Idioma + "/texto.php","&rnd="+Aleatorio(),"Texto");
	intervalo=setInterval("DesTransparentar('Texto')",10);
}
function nuevoAjax(xmlhttp){
	var xmlhttp=false;
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}catch (E) {
			xmlhttp = false;
		}
	};
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		xmlhttp = new XMLHttpRequest();
	}return xmlhttp;
} 
function Aleatorio(){
	numPosibilidades = 65535;
	aleat = Math.random() * numPosibilidades ;
	aleat = Math.round(aleat);
	return  aleat ;
}
function PausarPlayer() {
	document.getElementById("dewplayer").dewpause();
}
function Panel(){
	if (Mobile == 'False'){
	document.getElementById("Centro").style.height=document.body.clientHeight-125+"px";
	document.getElementById("Lateral").style.height=document.body.clientHeight-125+"px";
	document.getElementById("Noticias").style.height=document.body.clientHeight-125+"px";
	if (AlturaTexto > document.getElementById("Noticias").clientHeight){
		document.getElementById("Noticias").innerHTML = TextoNoticias + TextoNoticias;
	};
	if (AlturaTexto <= document.getElementById("Noticias").clientHeight){
		document.getElementById("Noticias").innerHTML = TextoNoticias ;
	};clearInterval(Movimiento);Movimiento=setInterval('Mover()',30);
	};
}
function OMPanel(){
	if (document.getElementById("News").style.width =="189px"){
		document.getElementById("News").style.width = "10px";
		document.getElementById("Noticias").style.width = "0px";
		document.getElementById("Flecha").src="imagenes/fi.jpg";
		document.cookie="NoticiasAncho=10px";
	}else{
		document.getElementById("News").style.width = "189px";
		document.getElementById("Noticias").style.width = "189px";
		document.getElementById("Flecha").src="imagenes/fd.jpg";
		document.cookie="NoticiasAncho=189px";
	}
	Panel();
}
function Mover(){
	document.getElementById("Noticias").scrollTop = document.getElementById("Noticias").scrollTop +1;
	if (document.getElementById("Noticias").scrollTop == document.getElementById("Noticias").scrollHeight /2 ){
		document.getElementById("Noticias").scrollTop = 0;
	};
}
function Validar(id){
	document.getElementById(id).style.backgroundColor="";document.getElementById("E_"+id).style.visibility = "hidden"
}
function Enviar(){
	document.getElementById("Nombre").style.backgroundColor="";document.getElementById("E_Nombre").style.visibility = "hidden"
	document.getElementById("Apellidos").style.backgroundColor="";document.getElementById("E_Apellidos").style.visibility = "hidden"
	document.getElementById("Telefono").style.backgroundColor="";document.getElementById("E_Telefono").style.visibility = "hidden"
	document.getElementById("Email").style.backgroundColor="";document.getElementById("E_Email").style.visibility = "hidden"
	document.getElementById("Pais").style.backgroundColor="";document.getElementById("E_Pais").style.visibility = "hidden"
	document.getElementById("Mensaje").style.backgroundColor="";document.getElementById("E_Mensaje").style.visibility = "hidden"

	validado = true;
	if (document.getElementById("Nombre").value == "" ){validado = false;document.getElementById("Nombre").style.backgroundColor="#FF9595";document.getElementById("E_Nombre").style.visibility = "visible"}
	if (document.getElementById("Apellidos").value == "" ){validado = false;document.getElementById("Apellidos").style.backgroundColor="#FF9595"; document.getElementById("E_Apellidos").style.visibility = "visible"}
	if (document.getElementById("Telefono").value == "" ){validado = false;document.getElementById("Telefono").style.backgroundColor="#FF9595"; document.getElementById("E_Telefono").style.visibility = "visible"}
	if (document.getElementById("Email").value == "" ){validado = false;document.getElementById("Email").style.backgroundColor="#FF9595"; document.getElementById("E_Email").style.visibility = "visible"}
	if (document.getElementById("Pais").value == "" ){validado = false;document.getElementById("Pais").style.backgroundColor="#FF9595"; document.getElementById("E_Pais").style.visibility = "visible"}	
	if (document.getElementById("Mensaje").value == "" ){validado = false;document.getElementById("Mensaje").style.backgroundColor="#FF9595"; document.getElementById("E_Mensaje").style.visibility = "visible"}
	if (validado == true){
	document.getElementById("Boton").disabled = true;
	
	Contenido=nuevoAjax();
	Contenido.open("POST","contacto.php?rnd="+Aleatorio(),true);
	Contenido.setRequestHeader('User-Agent', 'www.irp.es');
	Contenido.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=ISO-8859-1');
	Contenido.onreadystatechange=function() {
		if (Contenido.readyState==4) {
			document.getElementById("Boton").disabled = false;
			if(Contenido.responseText=="OK"){window.location.href="?lng="+Idioma+"&modulo=enviado"};
			if(Contenido.responseText!="OK"){window.location.href="?lng="+Idioma+"&modulo=noenviado"};

			
		};
	};
	Contenido.send("nombre="+php_urlencode(document.getElementById("Nombre").value)+"&apellidos="+php_urlencode(document.getElementById("Apellidos").value)+"&telefono="+php_urlencode(document.getElementById("Telefono").value)+"&email="+php_urlencode(document.getElementById("Email").value)+"&pais="+php_urlencode(document.getElementById("Pais").value)+"&mensaje="+php_urlencode(document.getElementById("Mensaje").value));
	}
}
function php_urlencode (str) {
	
str = escape(str);
return str.replace(/[*+\/@]|%20/g,
function (s) {
switch (s) {
case "*": s = "%2A"; break;
case "+": s = "%2B"; break;
case "/": s = "%2F"; break;
case "@": s = "%40"; break;
case "%20": s = "+"; break;
}
return s;
}
);
}
function DescargarArchivo(archivo){
	var Contenido;
	Contenido=nuevoAjax(Contenido);
	Contenido.open( "GET", "guardarlog.php?rnd="+Aleatorio()+"&funcion=descargas&archivo="+archivo, true );
	Contenido.onreadystatechange=function() {
		if (Contenido.readyState==4) {
		};
	};
	Contenido.send(null);
}
function GuardaVisitas(){
	var Contenido;
	Contenido=nuevoAjax(Contenido);
	Contenido.open( "GET", "guardarlog.php?rnd="+Aleatorio()+"&funcion=visitas", true );
	Contenido.onreadystatechange=function() {
		if (Contenido.readyState==4) {
		};
	};
	Contenido.send(null);
};
window.onresize = function (){
	Panel();
}
function ActualizarOnline(){
	var Contenido;
	Contenido=nuevoAjax(Contenido);
	Contenido.open( "GET", "online.php?sesion=" + Sesion + "&rnd=" + Aleatorio(), true );
	Contenido.onreadystatechange=function() {
		if (Contenido.readyState==4) {
			Usuarios= Contenido.responseText;
			document.getElementById("online").innerHTML = Usuarios;
		};
	};
	Contenido.send(null);
};
Inicio();
