//Funcion para cargar contenido en un div
  var peticion = false;
  try {
  peticion = new XMLHttpRequest();
  } catch (trymicrosoft) {
  try {
		peticion = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (othermicrosoft) {
  try {
		peticion = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (failed) {
		peticion = false;
}
}
}

if (!peticion)
  alert("ERROR AL INICIALIZAR!");

function cargarFragmento(fragment_url, element_id) {
var element = document.getElementById(element_id);
element.innerHTML = '<p style="margin-top: 350px; text-align:center;"><img src="cargando.gif" /></p>';
peticion.open("GET", fragment_url);
//peticion.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );

peticion.onreadystatechange = function() {
if (peticion.readyState == 4) {
element.innerHTML = peticion.responseText;



if(fragment_url=='multimedia/fotos.php')
{
	
	perrito();
}   
if(fragment_url.indexOf('noticias/noticias.php') != -1)
{
	
	perrito();
}
if(fragment_url.indexOf('multimedia/mostrarfotos.php') != -1)
{
	
	perrito();
}

}
}
peticion.send(null);
}






 var peticion2 = false;
  try {
  peticion2 = new XMLHttpRequest();
  } catch (trymicrosoft) {
  try {
		peticion2 = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (othermicrosoft) {
  try {
		peticion2 = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (failed) {
		peticion2 = false;
}
}
}

if (!peticion)
  alert("ERROR AL INICIALIZAR!");

function cargarFragmentoNormal(fragment_url, element_id) {
var element = document.getElementById(element_id);
element.innerHTML = '<p style="margin-top: 100px; text-align:center;"><img src="cargando.gif" /></p>';
peticion2.open("GET", fragment_url);
//peticion2.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );

peticion2.onreadystatechange = function() {
if (peticion2.readyState == 4) {
element.innerHTML = peticion2.responseText;

if(fragment_url=='bannerHome.html')
{
	
	//fleXcrollInit();
	
}  

}
}
peticion2.send(null);
}



  var peticion3 = false;
  try {
  peticion3 = new XMLHttpRequest();
  } catch (trymicrosoft) {
  try {
		peticion3 = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (othermicrosoft) {
  try {
		peticion3 = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (failed) {
		peticion3 = false;
}
}
}

if (!peticion3)
  alert("ERROR AL INICIALIZAR!");

function cargarFragmentoMulti(fragment_url, element_id) {
var element = document.getElementById(element_id);
element.innerHTML = '<p style="margin-top: 100px; text-align:center;"><img src="cargando.gif" /></p>';
peticion3.open("GET", fragment_url);
//peticion.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );

peticion3.onreadystatechange = function() {
if (peticion3.readyState == 4) {
element.innerHTML = peticion3.responseText;
if(fragment_url=='multimedia/bannerMultimedia.html')
{
	
	resalteMenuMulti('iconoFotos');
}
}
}
peticion3.send(null);
}


function resalteMenu(id){
	document.getElementById('multimedia_btn').style.backgroundImage='';
	document.getElementById('noticias_btn').style.backgroundImage='';
	document.getElementById('quienes_btn').style.backgroundImage='';
	document.getElementById('comentarios_btn').style.backgroundImage='';
	document.getElementById('contacto_btn').style.backgroundImage='';
	document.getElementById('calendario_btn').style.backgroundImage='';
	document.getElementById('clasificaciones_btn').style.backgroundImage='';
	document.getElementById('campeonatos_btn').style.backgroundImage='';
	document.getElementById('reglamento_btn').style.backgroundImage='';
	
	if (id=='noticias_btn'){
	document.getElementById(id).style.backgroundImage='url(img/noticiasOver.jpg)';
	}
	if (id=='multimedia_btn'){
	document.getElementById(id).style.backgroundImage='url(img/multimediaOver.jpg)';
	}
	if (id=='quienes_btn'){
	document.getElementById(id).style.backgroundImage='url(img/quienesOver.jpg)';
	}
	if (id=='comentarios_btn'){
	document.getElementById(id).style.backgroundImage='url(img/comentariosOver.jpg)';
	}
	if (id=='contacto_btn'){
	document.getElementById(id).style.backgroundImage='url(img/contactoOver.jpg)';
	}
	if (id=='calendario_btn'){
	document.getElementById(id).style.backgroundImage='url(img/btnCalenOver.jpg)';
	}
	if (id=='clasificaciones_btn'){
	document.getElementById(id).style.backgroundImage='url(img/btnClasiOver.jpg)';
	}
	if (id=='campeonatos_btn'){
	document.getElementById(id).style.backgroundImage='url(img/btnCampOver.jpg)';
	}
	if (id=='reglamento_btn'){
	document.getElementById(id).style.backgroundImage='url(img/btnRegOver.jpg)';
	}
	
	
}

function resalteMenuMulti(id){
	
	document.getElementById('iconoFotos').style.backgroundImage='';
	document.getElementById('iconoVideos').style.backgroundImage='';
	document.getElementById('iconoJuegos').style.backgroundImage='';
	if (id=='iconoFotos'){
	document.getElementById(id).style.backgroundImage='url(img/fotografiasOver.jpg)';
	}
	if (id=='iconoVideos'){
	document.getElementById(id).style.backgroundImage='url(img/videosOver.jpg)';
	}
	if (id=='iconoJuegos'){
	document.getElementById(id).style.backgroundImage='url(img/juegosOver.jpg)';
	}
}

/*function validar(formulario)
{


if ((document.getElementById('email').value.indexOf ('@', 0) == -1)||(document.getElementById('email').value.length < 5)) { 
    alert("Escriba una dirección de correo válida en el campo \"Email\"."); 
   document.getElementById('email').focus();
    return (false); 
  }
if (document.getElementById('asunto').value == ""){
alert ("Debes escribir un asunto");
document.getElementById('asunto').focus();
return (false); 
}
if (document.getElementById('cuerpo').value == ""){
alert ("Debes escribir un mensaje");
document.getElementById('cuerpo').focus();
return (false); 
}
  

document.formulario.submit();
}
*/
function borrar(){
	document.getElementById('formulario').reset();
	
}


function carga_datos3()
{
	var str3;

	str3='nombre='+document.formulario.nombre.value;
	str3=str3+'&email='+document.formulario.email.value;
	str3=str3+'&mensaje='+document.formulario.mensaje.value;

	return str3;
}

function cargarFragmento3(fragment_url) {
	if (document.formulario.nombre.value == ''){
	alert ('Debes indicarnos tu nombre.');
	 }
	else if (document.formulario.email.value == ''){
	alert ('Debes indicarnos tu dirección de correo para poder contactar contigo.');
	}
	
	else if (document.formulario.mensaje.value == ''){
	alert ('Se te ha olvidado rellenar el mensaje.');
	}
	else{
var element = document.getElementById('datos');
element.innerHTML = '<p style="margin-top: 200px; text-align:center;><img src="img/cargando.gif" /></p>';
peticion.open("GET", fragment_url);
peticion.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );

peticion.onreadystatechange = function() {
if (peticion.readyState == 4) {
element.innerHTML = peticion.responseText;
}
}
peticion.send(null);
}
}	



function carga_datos4()
{
	
	var str4;

	str4='nick='+document.miform.nickEnvio.value;
	str4=str4+'&asunto='+document.miform.asuntoEnvio.value;
	str4=str4+'&comentario='+document.miform.comentarioEnvio.value;
	
	return str4;
	
}

function cargarFragmento4(fragment_url) {
	
	if (document.miform.nickEnvio.value == ''){
	alert ('Debes indicarnos un Nick.');
	 }
	else if (document.miform.asuntoEnvio.value == ''){
	alert ('Debes indicarnos un asunto para tu comentario.');
	}
	
	else if (document.miform.comentarioEnvio.value == ''){
	alert ('Se te ha olvidado rellenar el comentario.');
	}
	else{
		
var element = document.getElementById('banner');
element.innerHTML = '<p style="margin-top: 200px; text-align:center;><img src="cargando.gif" /></p>';
peticion.open("GET", fragment_url);
peticion.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );

peticion.onreadystatechange = function() {
if (peticion.readyState == 4) {
element.innerHTML = peticion.responseText;
}
}
peticion.send(null);

}
var aleatorio=Math.random();

setTimeout("cargarFragmentoNormal('comentarios/comentarios.php?aleatorio="+aleatorio+"','datos')",2000);

}	

function cargarComen(){
cargarFragmentoNormal('comentarios/comentarios.php','datos');
}

function popup(url){
	
	 window.open (url, "mywindow","status=0,location=0,menubar=0,scrollbars=0,width=400,height=300"); 
	
}
