// JavaScript Document
// Eros.es

 var dominio = "www.eros.es";
 function LinksExternos() {
   var Externo;
   if (document.getElementsByTagName('a')) {
     for (var i = 0; (Externo = document.getElementsByTagName('a')[i]); i++) {
      if (Externo.href.indexOf(dominio) == -1 || Externo.href.indexOf(".pdf") != -1 ) { 
         Externo.setAttribute('target', '_blank');
       }
     }
   }
 }
 
function addEvent(obj, evType, fn){ 

	if(obj.addEventListener){ 
		obj.addEventListener(evType, fn, false); 
		return true; 
	}else if (obj.attachEvent){ 
		return obj.attachEvent("on" + evType, fn); 
	}else{ 
		return false; 
	} 
 
}

function PreferTaille(modif) {
t = modif;
document.getElementsByTagName("body")[0].style.fontSize = t + "em";
}

function date() {
var fecha_actual = new Date();
dia_mes = fecha_actual.getDate() - 1;
mes = fecha_actual.getMonth();
ano = fecha_actual.getFullYear();
if(ano==2007){ano="07"}
if(ano==2008){ano="08"}
if(ano==2009){ano="09"}
if(ano==2010){ano="10"}
if(ano==2011){ano="11"}

//ARRAYS GENERALS
var meses = new Array("ENERO", "FEB.", "MARZO", "ABRIL", "MAYO", "JUNIO", "JULIO", "AGOSTO", "SEPT.", "OCT.", "NOV.", "DIC.");
var numdias = new Array("01","02","03","04","05","06","07","08","09",10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31);

//DIBUIXA		
document.write("<div id='fechadia'>" + numdias[dia_mes] + "</div>");
document.write("<div id='fechames'>" + meses[mes] + " '" + ano + "</div>");
}


addEvent(window, 'load', LinksExternos);

function agregar(){
	var url="http://www.eros.es/";
	var title="EROS - PORNO GRATIS DIARIO";
	if (window.sidebar) {
		// Firefox
		window.sidebar.addPanel(title, url, '');
	} else if (window.opera && window.print) {
		// Opera
		var t = document.createElement('a');
		t.setAttribute('rel', 'sidebar');
		t.setAttribute('href', url);
		t.setAttribute('title', title);
		t.click();
	} else {
	 // IE
	 window.external.AddFavorite(url, title);
 	}
 	return false;

} 

function paginainicio(){
   if ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4)) {
	this.style.behavior='url(#default#homepage)';
	this.setHomePage('http://www.eros.es');
   } else {  
         alert("Opcion solo para Explorer. Tendras que hacerlo manualmente."); 
	}
} 

positionIt = function() {
var div = document.getElementById("divHome");
var x= Math.floor(document.body.clientWidth / 2) -495;
if(x<0){x=0;}

div.style.left = x + "px";
div.style.display = "block";
if ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4)) {
	div.style.position = "absolute";
	}
}



window.onload = positionIt;
window.onresize = positionIt;
