// JavaScript Document


function openImage(id_foto)
{
	vent = window.open('/admin/modulos/images/index.php?action=getHTMLImagen&id_imagen='+id_foto, 'Images', 'width=466, height=392, scrollbars=yes, statusbar=no, resizable=yes');				
	centrarVentana(vent, 466, 392);
	vent.focus();
}

function centrarVentana(objvent, width, height)
{
	objvent.moveTo((screen.width-width)/2,(screen.height-height)/2);
}
function onclickEnter(e,funcion){

	var evento_key = (document.all) ? e.keyCode : e.which; 

	if(evento_key==13)//si la tecla apretada es enter
		 eval(funcion);
		


}

function onclickEnter(e,funcion){

	var evento_key = (document.all) ? e.keyCode : e.which; 

	if(evento_key==13)//si la tecla apretada es enter
		
			eval(funcion);
}

function fieldNumber(objeto, numeroDecimales, e) 
{ 
	var valorCampo; 
	var evento_key = (document.all) ? e.keyCode : e.which; 
	var numPosPunto = 0; 
	var strParteEntera = ""; 
	var strParteDecimal = ""; 
	var NUM_DECIMALES = numeroDecimales; 


	switch (evento_key) 
	{ 
		case 48: 
		case 49: 
		case 50: 
		case 51: 
		case 52: 
		case 53: 
		case 54: 
		case 55: 
		case 56: 
		case 57: 
		/* En caso de que sea nro sale y sigue
		 * Para validar formato de decimales
		 */
		break; 
		default: 
		//si no es nro
		if (((evento_key != 46) || (NUM_DECIMALES == 0)) && (evento_key != 8) && (evento_key != 0))
		{
			if (document.all) 
				e.keyCode = 0;
			else 
				e.stopPropagation();
				
			return false; 
		}
		else {
			return true;
		}
	} 
	
	valorCampo = objeto.value; 	
	if (evento_key == 46) 
	{
		if (valorCampo == '')
		{
			if (document.all) 
				e.keyCode = 0;
			else 
				e.stopPropagation();		
			return false; 
		}
		else if (valorCampo.indexOf(".") != -1)
		{ 
			if (document.all) 
				e.keyCode = 0;
			else 
				e.stopPropagation();
			return false; 
		} 
	}
	
	/* Sólo puede teclear el número de decimales indicado en NUM_DECIMALES */ 
	if ((numPosPunto = valorCampo.indexOf(".")) != -1) 
	{ 
		strParteEntera = valorCampo.substr(0,(numPosPunto - 1)); 
		strParteDecimal = valorCampo.substr((numPosPunto + 1), valorCampo.length) 
		
		if (strParteDecimal.length > (NUM_DECIMALES - 1)) 
		{ 
			if (document.all) 
				e.keyCode = 0;
			else 
				e.stopPropagation();
			return false; 
		} 
	} 
	
	return true; 
} 


