<!--
if (top.frames.length!=0) {
    if (window.location.href.replace)
        top.location.replace(self.location.href);
    else
        top.location.href=self.document.href;
}

String.prototype.capitalize = function() { 
    return this.replace(/\w+/g, function(a){
        return a.charAt(0).toUpperCase() + a.substr(1).toLowerCase();
    });
};

function img_ie(id) {
	var img = document.getElementById(id);
	img.onreadystatechange=function() {
		if(img.readyState=='loading') {
			oculta(id);
		}
		if(img.readyState=='complete') {
			if(img.width>350) img.width=img.width/2;
			muestra(id);
		}
	}
}

function img_moz(id) {
	oculta(id);
	var img = document.getElementById(id);
	if(img.width>350) img.width=img.width/2;
	muestra(id);
}

function navegador() {
	return navigator.appName;
}

function precarga(id) {
	oculta(id);
	var ancho=document.getElementById(id).width;
	if(ancho>350) document.getElementById(id).width=(ancho/2);
	if(ancho!=0) muestra(id);
}

function openClose(id) {
	var obj = document.getElementById(id).style;
	if(obj.display == "") {
		obj.display = "none";
		document.getElementById('spoiler_'+id).innerHTML='&raquo; Ocultar mi spoil ¬¬ &laquo;';
	} else {
		if(obj.display != "none") {
			obj.display = "none";
			document.getElementById('spoiler_'+id).innerHTML='&laquo; Ver mi spoil =) &raquo;';
		} else {
			document.getElementById('spoiler_'+id).innerHTML='&raquo; Ocultar mi spoil ¬¬ &laquo;';
			obj.display = "block";
		}
	}
}

function nuevoAjax() { 
	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 include(pagina,variable,entrada) {
	ajax=nuevoAjax();
	ajax.open("GET", ""+pagina+".php?"+variable+"="+entrada, true);
	pagina = quita_guion(pagina);
	entrada = quita_guion(entrada); 
	ajax.onreadystatechange=function() { 
		document.title='Anime Action Reaction [AnAcRe] v6 - '+pagina.capitalize()+' : "'+entrada+'"';
		if(ajax.readyState==1) document.getElementById("contenido").innerHTML='<center><img src="./images/loading.gif" border="0" /><h3>Cargando ...</h3></center>';
		if (ajax.readyState==4) { 
			document.getElementById("contenido").innerHTML=ajax.responseText;
			refresca();
		}
	}
	ajax.send(null);
}

function imagen(id) {
	oculta('img_'+id);
	var img = new Array();
	img[id]=nuevoAjax();
	img[id].open("GET", "imagen.php?imagen="+id, true);
	img[id].onreadystatechange=function() {
		if(img[id].readyState==1) document.getElementById('imagen_'+id).innerHTML='<img src="./www2/images/loading.gif" border="0" />';
		if(img[id].readyState==4) {
			document.getElementById('imagen_'+id).innerHTML='';
			document.getElementById('imagen_'+id).innerHTML=img[id].responseText;
		}
	}
	img[id].send(null);
}

function quita_guion(variable) {
	entrada = new String(variable);
	guion = new RegExp("_", "i");
	resulta = entrada.match(guion);
	if(resulta==null) salida=entrada.replace("_"," ");
	else salida=quita_guion(entrada.replace("_"," "));
	return salida;
}

function inicio() {
	window.location.href='index.html';
}

function refresca() {
window.parent.ads.location.reload();
window.parent.server_ads.location.reload();
// window.parent.anacrexchange.location.reload();
}

function elite() {
	elites=nuevoAjax();
	elites.open("GET", "elite.php", true);
	elites.onreadystatechange=function() { 
		if(elites.readyState==1) { 
			document.getElementById("elite_contenido").innerHTML='<img src="./images/loading.gif" border="0" /><br />Cargando ...';
		}
		if (elites.readyState==4) { 
			document.getElementById("elite_contenido").innerHTML=elites.responseText;
		}
	}
	elites.send(null);
}

function anitop() {
	anitopes=nuevoAjax();
	anitopes.open("GET", "anitop.php", true);
	anitopes.onreadystatechange=function() { 
		if(anitopes.readyState==1) { 
			document.getElementById("anitop_contenido").innerHTML='<img src="./images/loading.gif" border="0" /><br />Cargando ...';
		}
		if (anitopes.readyState==4) { 
			document.getElementById("anitop_contenido").innerHTML=anitopes.responseText;
		}
	}
	anitopes.send(null);
}

function afiliados() {
	afiliado=nuevoAjax();
	afiliado.open("GET", "afiliados.php", true);
	afiliado.onreadystatechange=function() { 
		if(afiliado.readyState==1) { 
			document.getElementById("afiliados_contenido").innerHTML='<img src="./images/loading.gif" border="0" /><br />Cargando ...';
		}
		if (afiliado.readyState==4) { 
			document.getElementById("afiliados_contenido").innerHTML=afiliado.responseText;
		}
	}
	afiliado.send(null);
}

function bloques() {
	elite();
	anitop();
	afiliados();
}

function muestra(capa) {
	document.getElementById(capa).style.display='';
}

function oculta(capa) {
	document.getElementById(capa).style.display='none';
}

function envia_afiliacion() {
	var error = 0;
	var primero = 0;
	var entrada = new Array('login','email','url','banner','titulo','tipo_web','tipo_afiliacion','extra');
	for(i=0;i<entrada.length;i++) {
		if(document.getElementById(entrada[i]).value.length==0) {
			if(primero==0) primero++;
			error++;
			document.getElementById(entrada[primero]).focus()
		}
	}
	if(error>0) {
		document.getElementById('alerta').innerHTML='Por favor, llena todos los campos para mandar la solicitud.';
		muestra('alerta');
	    return 0;
	} else {
		oculta('alerta');
		envia_mail(document.getElementById(entrada[0]).value,document.getElementById(entrada[1]).value,document.getElementById(entrada[2]).value,document.getElementById(entrada[3]).value,document.getElementById(entrada[4]).value,document.getElementById(entrada[5]).value,document.getElementById(entrada[6]).value,document.getElementById(entrada[7]).value);
	}
}

function envia_mail(login,email,url,banner,titulo,tipo,tipo_afiliacion,extra) {
	afilia=nuevoAjax();
	afilia.open("GET", "./www2/manda_mail.php?login="+login+"&email="+email+"&url="+url+"&banner="+banner+"&titulo="+titulo+"&tipo="+tipo+"&tipo_afiliacion="+tipo_afiliacion+"&extra="+extra, true);
	afilia.onreadystatechange=function() { 
		if(afilia.readyState==1) { 
			document.getElementById('contenido').innerHTML='<p align="center"><img src="./images/loading.gif" border="0" /><br />Enviando...</p>';
		}
		if (afilia.readyState==4) { 
			document.getElementById('contenido').innerHTML=afilia.responseText;
		}
	}
	afilia.send(null);
}
// -->