/*Ventanas*/
function ventana(src,ancho,alto){
  TopPosition=(screen.height)?(screen.height-alto)/2:100;LeftPosition=(screen.width)?(screen.width-ancho)/2:100
   window.open(src, 'ventana','scrollbars=1,resizable=no,width='+ancho+',height='+alto+',status=0,menubar=0,left='+LeftPosition+',top='+TopPosition+'');
}

/*Quitar todos los menus*/
function treuremenus(){
oTopMenu[0][1].slideUp(imageHeight,10,40,'oTopMenu['+0+'][0].clipTo(0,mwidth,oTopMenu['+0+'][1].y,0)','oTopMenu['+0+'][0].clipTo(0,mwidth,oTopMenu['+0+'][1].y-3,0)')
oTopMenu[1][1].slideUp(imageHeight,10,40,'oTopMenu['+1+'][0].clipTo(0,mwidth,oTopMenu['+1+'][1].y,0)','oTopMenu['+1+'][0].clipTo(0,mwidth,oTopMenu['+1+'][1].y-3,0)')
oTopMenu[2][1].slideUp(imageHeight,10,40,'oTopMenu['+2+'][0].clipTo(0,mwidth,oTopMenu['+2+'][1].y,0)','oTopMenu['+2+'][0].clipTo(0,mwidth,oTopMenu['+2+'][1].y-3,0)')
mensajepublico.style.display = 'none';
chatbuscador.style.display = 'none';
}

/*Cambiar imagen*/
function cambiimatge(g,altre) {
g.src=altre;
}

/*Abrir mini menus noticias*/
function minimenus(g) {
var rightedge=document.body.scrollLeft+event.clientX - (111/2)
var bottomedge=document.body.scrollTop+event.clientY + 10
    if (g.style.display =='') {
	  g.style.display = 'none';
	  g.style.left=rightedge;
	  g.style.top=bottomedge
    }
    else {
	  g.style.display='';
	  g.style.left=rightedge;
	  g.style.top=bottomedge
  }
}

/*Mostrar menu flash*/
function mostrarmenu(g) {
    if (g.style.display =='') {
      g.style.display = 'none';
    }
    else {
      g.style.display='';
    }
oTopMenu[0][1].slideUp(imageHeight,10,40,'oTopMenu['+0+'][0].clipTo(0,mwidth,oTopMenu['+0+'][1].y,0)','oTopMenu['+0+'][0].clipTo(0,mwidth,oTopMenu['+0+'][1].y-3,0)')
oTopMenu[1][1].slideUp(imageHeight,10,40,'oTopMenu['+1+'][0].clipTo(0,mwidth,oTopMenu['+1+'][1].y,0)','oTopMenu['+1+'][0].clipTo(0,mwidth,oTopMenu['+1+'][1].y-3,0)')
oTopMenu[2][1].slideUp(imageHeight,10,40,'oTopMenu['+2+'][0].clipTo(0,mwidth,oTopMenu['+2+'][1].y,0)','oTopMenu['+2+'][0].clipTo(0,mwidth,oTopMenu['+2+'][1].y-3,0)')
}

/*Mostrar posts foro*/
function mostrarmenu2(g) {
var rightedge=document.body.scrollLeft+event.clientX - 77
var bottomedge=document.body.scrollTop+event.clientY + 9
    if (g.style.display =='') {
	  g.style.display = 'none';
	  g.style.left=rightedge;
	  g.style.top=bottomedge
    }
    else {
	  g.style.display='';
	  g.style.left=rightedge;
	  g.style.top=bottomedge
  }
}

/*No error javascript*/
function stoperror(){
return true
}
window.onerror=stoperror

/*efecto fadein*/
nereidFadeObjects = new Object();
nereidFadeTimers = new Object();

function nereidFade(object, destOp, rate, delta){
if (!document.all)
return
    if (object != "[object]"){  //do this so I can take a string too
        setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0);
        return;
    }
        
    clearTimeout(nereidFadeTimers[object.sourceIndex]);
    
    diff = destOp-object.filters.alpha.opacity;
    direction = 1;
    if (object.filters.alpha.opacity > destOp){
        direction = -1;
    }
    delta=Math.min(direction*diff,delta);
    object.filters.alpha.opacity+=direction*delta;

    if (object.filters.alpha.opacity != destOp){
        nereidFadeObjects[object.sourceIndex]=object;
        nereidFadeTimers[object.sourceIndex]=setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);
    }
}

/*evitar estar en marcos*/
  if (window != window.top)
    top.location.href = location.href;

/*fechas*/
function countup(yr,m,d){ 
var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec") 
var today=new Date() 
var todayy=today.getYear() 
var todaym=today.getMonth() 
var todayd=today.getDate() 
var todaystring=montharray[todaym]+" "+todayd+", "+todayy 
var paststring=montharray[m-1]+" "+d+", "+yr 
var difference=((Math.round((Date.parse(todaystring)) - Date.parse(paststring))/(24*60*60*1000))*1)*(-1)

if (difference == 0){
document.write("Hoy es el día para ") 
}else{
document.write("Faltan <b>"+difference+"</b> días para ") 
}
}

/*mini fotos*/
    function minifoto(foto,ancho,alto) {
        de = (ancho / 2);
        su = (alto / 2);
        imagen="<br><center><a href=javascript:loadImage('"+foto+"','imagen')><img src='"+foto+"' width="+ de +" height="+ su +" class=rectangulo border=0 title='Haz click aquí para ampliar la imagen'></a></center><br>";
        document.write(imagen);
    }

/*Efecto pim i pam*/

function doBlink() 
{
var blink = document.all.tags("BLINK")
for (var i=0; i<blink.length; i++)
blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : ""
}

function startBlink() 
{
if (document.all)
setInterval("doBlink()",500)
}
window.onload = startBlink;

/*Error imagenes*/

function Error_Cargar() { 
window.event.srcElement.style.display = "None"; 
} 

/*SMS*/

function cerrarsms(fe,ra){
var ce = getObject(fe);
var ca = getObject(ra);
ce.style.visibility = 'hidden';
ca.style.visibility = 'visible';
}

function cambiar_img(nom,dire){
var pic = getObject(nom);
pic.src=dire;
}

function mourecapa(desti,desti2){
var capa = getObject(desti);
var capa2 = getObject(desti2);


if (ie4) {
var rightedge=(screen.width/2)-334;
} else {
var rightedge=(document.body.clientWidth/2)-324;
}

capa.style.left=rightedge;
capa2.style.left=rightedge;
}

/*Menu Ampliar Texto*/

function aumentarfont(){
if (texto.style.fontSize == 'large') {
texto.style.fontSize = 'x-large'
}
if (texto.style.fontSize == '') {
texto.style.fontSize = 'large'
}
}

function reducirfont(){
if (texto.style.fontSize == 'large') {
texto.style.fontSize = ''
}
if (texto.style.fontSize == 'x-large') {
texto.style.fontSize = 'large'
}
}

/*Menu Buscador*/

var IE4 = ((navigator.userAgent.indexOf("MSIE")!=-1) && navigator.appVersion.substring(0,1) >= 4);

function mostrarmenu(g) {
var rightedge=document.body.scrollLeft+event.clientX - 77
var bottomedge=document.body.scrollTop+event.clientY + 9
  if(IE4) {
    if (g.style.display =='') {
      g.style.display = 'none';
	  g.style.left=rightedge;
	  g.style.top=bottomedge
    }
    else {
      g.style.display='';
	  g.style.left=rightedge;
	  g.style.top=bottomedge
    }
  }
}

/*Nueva ventana*/

function ventana(src,ancho,alto){
  TopPosition=(screen.height)?(screen.height-alto)/2:100;LeftPosition=(screen.width)?(screen.width-ancho)/2:100
   window.open(src, 'ventana','scrollbars=1,resizable=no,width='+ancho+',height='+alto+',status=0,menubar=0,left='+LeftPosition+',top='+TopPosition+'');
}

function abrirchat(){
  TopPosition=(screen.height)?(screen.height-400)/2:100;LeftPosition=(screen.width)?(screen.width-640)/2:100
   window.open('modules/IRChat/login.php', 'chatirc','scrollbars=0,resizable=no,width=640,height=400,status=0,menubar=0,left='+LeftPosition+',top='+TopPosition+'');
}

/*Proteccion de las paginas*/
/*Deshabilitar boton derecho del raton y teclado*/
//var messagen="";
//function clickIE() {if (document.all) {(messagen);return false}}
//function clickNS(e) {if 
//(document.layers||(document.getElementById&&!document.all)) {
//if (e.which==2||e.which==3) {(messagen);return false}}}
//if (document.layers) 
//{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS}
//else{document.onmouseup=clickNS;document.oncontextmenu=clickIE}

/*Efecto secciones*/
function mOvr(src) {
    if (!src.contains(event.fromElement)) {
	  src.style.cursor = 'hand';
	  src.bgColor = '#8C8C8C';
	  src.style.color = '#ffffff';
	}
  }

function mDow(src) {
    if (!src.contains(event.fromElement)) {
	  src.style.cursor = 'hand';
	  src.bgColor = '#666666';
	  src.style.color = '#ffffff';
	}
  }

function mOut(src) {
	if (!src.contains(event.toElement)) {
	  src.style.cursor = 'default';
	  src.bgColor = '';
	  src.style.color = '#000000';
	}
  }

function mClk(src) {
    if(event.srcElement.tagName=='TD'){
	  src.children.tags('A')[0].click();
    }
  }

function mOvr2(src) {
    if (!src.contains(event.fromElement)) {
	  src.style.cursor = 'hand';
	  src.bgColor = 'red';
	}
  }

function mDow2(src) {
    if (!src.contains(event.fromElement)) {
	  src.style.cursor = 'hand';
	  src.bgColor = '#a90000';
	}
  }

function mOut2(src) {
	if (!src.contains(event.toElement)) {
	  src.style.cursor = 'default';
	  src.bgColor = 'white';
	}
  }

/*Secciones no disponibles*/
function errorjava() { 
alert('Seccion aún no disponible, pronto estara terminada..')
}

/*nueva ventana de la imatge*/

function loadImage (imagen,winName){

  TopPosition=(screen.height)?(screen.height-508)/2:100;LeftPosition=(screen.width)?(screen.width-588)/2:100
  fin=window.open('NuevaVentana.htm?'+imagen,winName,'scrollbars=no,width=588,height=443,top='+TopPosition+',left='+LeftPosition+'')
}

/*Mouse Over*/
isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;
isHot=false;
 
function ddInit(e){
  topDog=isIE ? "BODY" : "HTML";
  whichDog=isIE ? document.all.theLayer : document.getElementById("theLayer");  
  hotDog=isIE ? event.srcElement : e.target;  
  while (hotDog.id!="titleBar"&&hotDog.tagName!=topDog){
    hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
  }  
  if (hotDog.id=="titleBar"){
    offsetx=isIE ? event.clientX : e.clientX;
    offsety=isIE ? event.clientY : e.clientY;
    nowX=parseInt(whichDog.style.left);
    nowY=parseInt(whichDog.style.top);
    ddEnabled=true;
    document.onmousemove=dd;
  }
}
 
function dd(e){
  if (!ddEnabled) return;
  whichDog.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx; 
  whichDog.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
  return false;  
}
 
function ddN4(whatDog){
  if (!isN4) return;
  N4=eval(whatDog);
  N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
  N4.onmousedown=function(e){
    N4.captureEvents(Event.MOUSEMOVE);
    N4x=e.x;
    N4y=e.y;
  }
  N4.onmousemove=function(e){
    if (isHot){
      N4.moveBy(e.x-N4x,e.y-N4y);
      return false;
    }
  }
  N4.onmouseup=function(){
    N4.releaseEvents(Event.MOUSEMOVE);
  }
}
 
function hideMe(){
  if (isIE||isNN) whichDog.style.visibility="hidden";
  else if (isN4) document.theLayer.visibility="hide";
}
 
function showMe(){
  if (isIE||isNN) whichDog.style.visibility="visible";
  else if (isN4) document.theLayer.visibility="show";
}
 
document.onmousedown=ddInit;
document.onmouseup=Function("ddEnabled=false");