Vez1 = false;
PosInicial = 0;
AlturaCapa = 0;
AlturaPantalla = 0;
LongitudScroll = 0;
function Principio(browserNom) {
  if (browserNom == "NS") {
    PosY = document.layers["Ecran"].top;
    RangoY = PosInicial - PosY;
    if (RangoY > 0) {
      for (var i=0;i<RangoY;i++) {
	document.layers["Ecran"].top = PosY + i;
	document.layers["Ecran"].clip.top = PosInicial - PosY - i;
	document.layers["Ecran"].clip.height = AlturaPantalla;
      }
    }
  } else {
    PosY = document.all["Ecran"].style.posTop;
    RangoY = parseInt(document.all["Ecran"].currentStyle.clipTop);
    if (RangoY > 0) {
        document.all["Ecran"].style.posTop = PosY + RangoY;
        tmp1 = parseInt(document.all["Ecran"].currentStyle.clipTop) - RangoY;
        tmp2 = parseInt(document.all["Ecran"].currentStyle.clipBottom) - RangoY;
        document.all["Ecran"].style.clip = "rect(" + tmp1 + "px 423px " + tmp2 + "px 0px)";
    }
  }
}
function Subir(browserNom) {
  if (browserNom == "NS") {
    PosY = document.layers["Ecran"].top;
    RangoY = PosInicial - PosY;
    if (RangoY > 0) {
      RangoY = (RangoY > LongitudScroll)?LongitudScroll:RangoY;
      for (var i=0;i<RangoY;i++) {
	document.layers["Ecran"].top = PosY + i;
	document.layers["Ecran"].clip.top = PosInicial - PosY - i;
	document.layers["Ecran"].clip.height = AlturaPantalla;
      }
    }
  } else {
    PosY = document.all["Ecran"].style.posTop;
    RangoY = parseInt(document.all["Ecran"].currentStyle.clipTop);
    if (RangoY > 0) {
      RangoY = (RangoY > LongitudScroll)?LongitudScroll:RangoY;
      document.all["Ecran"].style.posTop = PosY + RangoY;
      tmp1 = parseInt(document.all["Ecran"].currentStyle.clipTop) - RangoY;
      tmp2 = parseInt(document.all["Ecran"].currentStyle.clipBottom) - RangoY;
      document.all["Ecran"].style.clip = "rect(" + tmp1 + "px 423px " + tmp2 + "px 0px)";
    }
  }
}
function Bajar(browserNom) {
  if (!Vez1) {
    if (browserNom == "NS") {
      PosInicial = document.layers["Ecran"].top;
      AlturaCapa = document.layers["Ecran"].document.height;
      AlturaPantalla = document.layers["Ecran"].clip.height;
      LongitudScroll = AlturaPantalla - 10;
    } else {
      PosInicial = parseInt(document.all["Ecran"].style.top);
      AlturaCapa = document.all["Ecran"].clientHeight;
      AlturaPantalla = parseInt(document.all["Ecran"].currentStyle.clipBottom) - parseInt(document.all["Ecran"].currentStyle.clipTop);
      LongitudScroll = AlturaPantalla - 10;
    }
    Vez1 = true;
  }
  if (browserNom == "NS") {
    PosY = document.layers["Ecran"].top;
    RangoY = PosY - PosInicial - AlturaPantalla + AlturaCapa;
    if (RangoY > 0) {
      RangoY = (RangoY > LongitudScroll)?LongitudScroll:RangoY;
      for (var i=0;i<RangoY;i++) {
	document.layers["Ecran"].top = PosY - i;
	document.layers["Ecran"].clip.top = PosInicial - PosY + i;
	document.layers["Ecran"].clip.height = AlturaPantalla;
      }
    }
  } else {
    PosY = document.all["Ecran"].style.posTop;
    RangoY = AlturaCapa - parseInt(document.all["Ecran"].currentStyle.clipBottom);
    if (RangoY > 0) {
      RangoY = (RangoY > LongitudScroll)?LongitudScroll:RangoY;
      document.all["Ecran"].style.posTop = PosY - RangoY;
      tmp1 = parseInt(document.all["Ecran"].currentStyle.clipTop) + RangoY;
      tmp2 = parseInt(document.all["Ecran"].currentStyle.clipBottom) + RangoY;
      document.all["Ecran"].style.clip = "rect(" + tmp1 + "px 423px " + tmp2 + "px 0px)";
    }
  }
}
function Final(browserNom) {
  if (!Vez1) {
    if (browserNom == "NS") {
      PosInicial = document.layers["Ecran"].top;
      AlturaCapa = document.layers["Ecran"].document.height;
      AlturaPantalla = document.layers["Ecran"].clip.height;
      LongitudScroll = AlturaPantalla - 20;
    } else {
      PosInicial = parseInt(document.all["Ecran"].style.top);
      AlturaCapa = document.all["Ecran"].clientHeight;
      AlturaPantalla = parseInt(document.all["Ecran"].currentStyle.clipBottom) - parseInt(document.all["Ecran"].currentStyle.clipTop);
      LongitudScroll = AlturaPantalla - 10;
    }
    Vez1 = true;
  }
  if (browserNom == "NS") {
    PosY = document.layers["Ecran"].top;
    RangoY = PosY - PosInicial - AlturaPantalla + AlturaCapa;
    if (RangoY > 0) {
      for (var i=0;i<RangoY;i++) {
	document.layers["Ecran"].top = PosY - i;
	document.layers["Ecran"].clip.top = PosInicial - PosY + i;
	document.layers["Ecran"].clip.height = AlturaPantalla;
      }
    }
  } else {
    PosY = document.all["Ecran"].style.posTop;
    RangoY = AlturaCapa - parseInt(document.all["Ecran"].currentStyle.clipBottom);
    if (RangoY > 0) {
      document.all["Ecran"].style.posTop = PosY - RangoY;
      tmp1 = parseInt(document.all["Ecran"].currentStyle.clipTop) + RangoY;
      tmp2 = parseInt(document.all["Ecran"].currentStyle.clipBottom) + RangoY;
      document.all["Ecran"].style.clip = "rect(" + tmp1 + "px 423px " + tmp2 + "px 0px)";
    }
  }
}
