var NS4 = (navigator.appName.indexOf("Netscape")>=0 && !document.getElementById)? true : false;
var IE4 = (document.all && !document.getElementById)? true : false;
var IE5 = (document.getElementById && document.all)? true : false;
var NS6 = (document.getElementById && navigator.appName.indexOf("Netscape")>=0 )? true: false;
var W3C = (document.getElementById)? true : false;
var ventana1=null;

var CURSOR=NS6?'pointer':'hand';

// Control de iframe. Lupa.
function abre_pagina(cual){
   ventana1=window.open(cual,'foto','top=50, left=100, width=475, height=350, scrollbars=1,toolbars=no,location=no,directories=0,status=0,menubar=0,resizable=0');
   ventana1.focus();
}

function indicaPantalla(){
//alert("largo: "+screen.availHeight+"\nancho: "+screen.availWidth);
var pantalla=screen.availWidth;
if((pantalla<1024) || (!document.all))
   document.body.style.overflow="auto";

 window.moveTo(0,0);
if (document.all) {
     window.resizeTo(screen.availWidth,screen.availHeight);
} 

if (document.layers || document.getElementById) {
	if (window.outerHeight<screen.availHeight || window.outerWidth<screen.availWidth){
		window.outerHeight = screen.availHeight;
		window.outerWidth = screen.availWidth;
	}
}

}

function pulsada(e) {
  var correctos=new Array("0","1","2","3","4","5","6","7","8","9",",");
      estado=false
          if(document.all) {
              codigoTecla = event.keyCode
              cadenaTecla = (String.fromCharCode(event.keyCode));
          } else if(document.layers) {
              codigoTecla = e.which
              cadenaTecla = String.fromCharCode(e.which);
          } else if(document.getElementById) {
              codigoTecla = (window.Event) ? e.which : e.keyCode;
              cadenaTecla=(String.fromCharCode(codigoTecla));
          }
	if((cadenaTecla==',') && (decimal==0))
		   return false;
          for(i=0;i<correctos.length;i++)  {
              if(cadenaTecla==correctos[i])
                  estado=true;
          }
  if((codigoTecla==8) || (codigoTecla==0))
	  estado=true;
          if(estado==false) {
              if(document.all)
                  event.returnValue = false;
              else
                  return false;
          }
}

function aumentar(cual,como,donde) {
	var sobrado=0;
   var actual=parseInt(document.forms[0].elements[cual].value); 
   if(isNaN(actual))
      actual=0;
   actual+=como;
   if(actual>StockArticulos[donde])
      actual=StockArticulos[donde];
   if(actual<0)
      actual=0;
   document.forms[0].elements[cual].value=actual.toString();
}
