<!-- 
//FUNCION PARA ABRIR UNA VENTANA CENTRADA EN LA PANTALLA 
//si las opciones por defecto no nos gustan las podemos cambiar, no poner espacios blancos 
//entre comas, sino le pasamos '' en opciones retorna el apuntador a esa ventana
function obrir_win(source,ancho,alto,nombre,opciones){
 var win_opt, xposition=0, yposition=0;
 if(parseInt(navigator.appVersion)>=4){xposition=(screen.width-ancho)/2;yposition=((screen.height-alto)/2)-25;}
 if (opciones==""){
  win_opt= "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=0,copyhistory=0,";
  win_opt+= "screenx=" + xposition + "," + "screeny=" + yposition + "," + "left=" + xposition + "," + "top=" + yposition + ",";
 } else {win_opt=opciones;}
  win_opt += "width=" + ancho + ",height=" + alto;
 return window.open(source,nombre,win_opt);
}

//FUNCION PARA HACER EL PRELOAD DE LAS IMAGENES
function preload(imgObj,imgSrc) {
  eval(imgObj+' = new Image()')
  eval(imgObj+'.src = "'+imgSrc+'"')
}

//FUNCION PARA REALIZAR EL DESPLAZAMIENTO DE CUALQUIER OBJETO DIV EN LA DIRECCION QUE SE QUIRA
function slide(obj,initx,inity,finx,finy,dir,inc) {
  if (document.layers) {
    eval("document."+obj+".top =" + parseInt(inity));
    eval("document."+obj+".left =" + parseInt(initx));
  }
  else { 
    if (document.all) {
      eval(obj+".style.pixelTop=" + parseInt(inity));
      eval(obj+".style.pixelLeft=" + parseInt(initx));
    }
 }
 if (dir=='directo') return true;
 if (dir=='arriba'){
  if (parseInt(inity)>parseInt(finy)){
    setTimeout("slide('"+obj+"',"+finx+","+(parseInt(inity)-parseInt(inc))+","+finx+","+finy+",'"+dir+"',"+inc+")",10)
  } 
 }
 if (dir=='abajo'){
  if (parseInt(inity)<parseInt(finy)){
    setTimeout("slide('"+obj+"',"+finx+","+(parseInt(inity)+parseInt(inc))+","+finx+","+finy+",'"+dir+"',"+inc+")",10)
  } 
 }
 if (dir=='izquierda'){
  if (parseInt(initx)>parseInt(finx)){
   setTimeout("slide('"+obj+"',"+(parseInt(initx)-parseInt(inc))+","+finy+","+finx+","+finy+",'"+dir+"',"+inc+")",10)
  } 
 }
 if (dir=='derecha'){
  if (parseInt(initx)<parseInt(finx)){
   setTimeout("slide('"+obj+"',"+(parseInt(initx)+parseInt(inc))+","+finy+","+finx+","+finy+",'"+dir+"',"+inc+")",10)
  } 
 }
 return true;
}

//FUNCION PARA DESPLAZAR DIVS EN LA DIRECCION QUE SE QUIERA A PARTIR DE DONDE ESTÁ
var salida=true;
function sliderel(obj,incx,incy,inc) {
  if (document.layers) {
    if (incy!=0) {
      eval("document."+obj+".top = document."+obj+".top + " + parseInt(inc));
      incy=incy-(Math.abs(inc));
    }
    if (incx!=0){
      eval("document."+obj+".left = document."+obj+".left +" + parseInt(inc));
      incx=incx-(Math.abs(inc));
    }
    if ((incx==0)&&(incy==0)) salida=true;
     else {salida=false;setTimeout("sliderel('"+obj+"',"+incx+","+incy+","+inc+")",10);}
  }
  else { 
    if (document.all) {
     if (incy!=0) {
      eval(obj+".style.pixelTop=" + obj + ".style.pixelTop +" + parseInt(inc));
      incy=incy-(Math.abs(inc));
     }
     if (incx!=0) {
      eval(obj+".style.pixelLeft=" + obj + ".style.pixelLeft +" + parseInt(inc));
      incx=incx-(Math.abs(inc));
     }
    if ((incx==0)&&(incy==0)) salida=true;
     else {salida=false;setTimeout("sliderel('"+obj+"',"+incx+","+incy+","+inc+")",10);}
   }
  }
}

//FUNCIONES PARA SABER CUAL ES LA POSICION DE UN LAYER
function whereisX(obj){
  if (document.layers) return eval("document."+obj+".left"); 
  else if (document.all) return eval(obj+".style.pixelLeft");
}

function whereisY(obj){
  if (document.layers) return eval("document."+obj+".top"); 
  else if (document.all) return eval(obj+".style.pixelTop");
}


//FUNCIONS PER CAMBIAR IMATGES SI TE LAYER
function changeimg (img1,img2){
 if (document.all){
 eval("document.images['imgdiv"+ img1 + "'].src="+ img2 +".src");
 }
 else if (document.layers){ 
  eval("document."+ img1 +".document['imgdiv"+ img1 + "'].src="+ img2 +".src");
 }
}

//FUNCIO PER CAMBIAR IMATGES CUAN NO TE LAYER
function changeimg2 (img1,img2){
 eval("document.images['"+ img1 + "'].src="+ img2 +".src");
}

//FUNCIO PER CAMBIAR EL TEXTE I TOT L'HTML SI ES VOL DE UN DIV
function change_text(divname, newtext) {
    if (document.layers) {
        document.layers[divname].document.write(newtext)
        document.layers[divname].document.close()
    }
    else if (document.all) document.all[divname].innerHTML = newtext
}

//FUNCION PARA REALIZAR UN FADEIN Y UN FADEOUT AL ENTRAR EN UNA PAGINA
//EJEMPLO:  onLoad="fade(100,0,0,255,255,255,64)" onUnload="fade(255,255,255,100,0,0,64)"
function fade(sred, sgreen, sblue, ered, egreen, eblue, step) {
 var hexCharacters = "0123456789ABCDEF"
 for(var i = 0; i <= step; ++i) {
  red = Math.floor(sred * ((step - i) / step) + ered * (i / step))
  green = Math.floor(sgreen * ((step - i) / step) + egreen * (i / step))
  blue = Math.floor(sblue * ((step - i) / step) + eblue * (i / step))
  redhex= hexCharacters.charAt(Math.floor(red / 16)) + hexCharacters.charAt(red % 16)
  greenhex= hexCharacters.charAt(Math.floor(green / 16)) + hexCharacters.charAt(green % 16)
  bluehex= hexCharacters.charAt(Math.floor(blue / 16)) + hexCharacters.charAt(blue % 16)
  document.bgColor = "#" + redhex + greenhex + bluehex
 }
}

//FUNCIONES QUE OCULTAN O MUESTRAN UN LAYER SEGUN NOS INTERESE O NOS RETORNA SU VISIBILIDAD
function show(obj) {
 if (document.layers) eval("document."+obj+".visibility = 'show'");
 else if (document.all) eval(obj+".style.visibility = 'visible'");
}
function hide(obj) {
 if (document.layers) eval("document."+obj+".visibility = 'hide'");
 else if (document.all) eval(obj+".style.visibility = 'hidden'");
}

function isVisible(obj){
 if (document.layers) {
  if (eval("document."+obj+".visibility == 'show'")) return true;
  else return false;
 }
 else if (document.all) {
  if (eval(obj+".style.visibility == 'visible'")) return true;
  else return false;
 }
}

//-->

