// JavaScript Document
<!-- Te perite poner solo numeros en una caja de texro	--> 
var nav4 = window.Event ? true : false;

<!-- Te perite poner solo numeros en una caja de texro	--> 
function acceptNum(evt){	
// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57	
var key = nav4 ? evt.which : evt.keyCode;	
return ((key <= 13) || (key >= 48 && key <= 57) ||  (key ==32) ||  (key == 42) ||  (key == 40) ||  (key == 41) ||  (key == 45));
}


// FUNCION PARA BLOQUEAR TECLADO K SOLO MUESTRE NUMERO 
// VERSION 8 - 6 EXPLORER,  FIREFOX
function NoCtrl(e) {
		var key=new Number();
		
		if(window.event) {
			key = e.keyCode;
		}
		else if(e.which) {
			key = e.which;
		} else {
			return true;
		}
		
		if ((key <= 13) || (key == 8)|| (key >= 48 && key <= 57) ||  (key ==32) ||  (key == 42) ||  (key == 40) ||  (key == 41) ||  (key == 45) ) { // el 46 equivale al punto... el 110 supuestamente el punto del teclado numérico, pero no va, lo deje por si acaso
			//alert("si");
			input.value +=',';
			return false;
		} else {
			//alert("no");
			return false;
		}
	}


// ******************** /


function ADD_C(VER,ENVIAR)
{
  
 
	window.document.formDetProd.accion.value=ENVIAR;
	window.document.formDetProd.ver_opt.value=VER;
	// window.document.formulario.action="mod_Ejecucion_Carrito.php";	
	window.document.formDetProd.submit();

}


//funcion de tres mod_c pero este con verificacion de direcion de envio
 function MOD_C_REGENV(VER,ENVIAR)
{
 
	
	window.document.formLisCarr.accion.value=ENVIAR;
	window.document.formLisCarr.ver_opt.value=VER;
	window.document.formLisCarr.submit();
 
 
}

 function MOD_C(VER,ENVIAR)
{

 
window.document.formLisCarr.accion.value=ENVIAR;
window.document.formLisCarr.ver_opt.value=VER;
window.document.formLisCarr.submit();
 
}


function pregunta_elimina_producto_c(CODIGO,ENVIAR,VER){ 
   if (confirm('¿Estas seguro de ELIMINAR este Producto?')){ 
 
window.document.formLisCarr.accion.value=ENVIAR;   
window.document.formLisCarr.idarray_eliminar.value=CODIGO;
window.document.formLisCarr.ver_opt.value=VER;
// window.document.formulario.action="mod_Ejecucion_Carrito.php";	
window.document.formLisCarr.submit();
    } 
}



/* FUNCION QUE ADD UN PRODUCTO DESDE EL LISTADO DE PRODUCTOS */
function ADD_CL(VER,ENVIAR)
{
 
 
	window.document.formLisProd.accion.value=ENVIAR;
	window.document.formLisProd.ver_opt.value=VER;
 
	// window.document.formulario.action="mod_Ejecucion_Carrito.php";	
	window.document.formLisProd.submit();

}



 //*******************

 function Validar_finalizar(theForm)
{
  
  /* *********  datos personales *************/
   
var checkStr = theForm.cliente_name.value;
  if (checkStr.length==0 || checkStr.replace(/ /g, '') == '')
	{
    alert("Ingrese su nombre, por favor.");
    theForm.cliente_name.focus();
	theForm.cliente_name.select();
    return (false);
	}	 
	
	/*
	
	var checkStr = theForm.cliente_telephone.value;
  if (checkStr.length==0 || checkStr.replace(/ /g, '') == '')
	{
    alert("Ingrese su numero telefonico (fijo), por favor.");
    theForm.cliente_telephone.focus();
	theForm.cliente_telephone.select();
    return (false);
	}	
	
*/


 var checkStr = theForm.cliente_email_address.value;
  if (checkStr.length==0)
	{
    alert("Ingrese un E-mail, por favor.");
    theForm.cliente_email_address.focus();
    return (false);
	}	
 
 // Validamos el email.
		   oRegEmail = new RegExp ("^([A-Z]|[a-z]|[0-9]|[_]|[-]|[.])+[@]([A-Z]|[a-z]|[0-9]|[_]|[-]|[.]|[;]|[@])+$");
			if (!oRegEmail.test(theForm.cliente_email_address.value)) 
			{
			  alert("Por favor, ingrese una dirección de e-mail válida");
			  theForm.cliente_email_address.focus();
			  return(false);
			}
			
		/*	
			
	var checkStr = theForm.cliente_celular.value;
  if (checkStr.length==0 || checkStr.replace(/ /g, '') == '')
	{
    alert("Ingrese su numero celular , por favor.");
    theForm.cliente_celular.focus();
	theForm.cliente_celular.select();
    return (false);
	}	
	
	*/
/* **************** datos de entrega ****************/
	
	
	var checkStr = theForm.entrega_direccion.value;
  if (checkStr.length==0 || checkStr.replace(/ /g, '') == '')
	{
    alert("Ingrese su direccion , por favor.");
    theForm.entrega_direccion.focus();
	theForm.entrega_direccion.select();
    return (false);
	}		
	


	var checkStr = theForm.entrega_referencia.value;
  if (checkStr.length==0 || checkStr.replace(/ /g, '') == '')
	{
    alert("Ingrese algun lugar de referencia , por favor.");
    theForm.entrega_referencia.focus();
	theForm.entrega_referencia.select();
    return (false);
	}	
	
	
var checkStr3 = theForm.distrito;
 
  if (checkStr3[0].selected == true  )
	{
    alert("Seleccione un Distrito, por favor.");
    theForm.entrega_id_distrito.focus();
    return (false);
	}	
 
 
 
var checkStr = theForm.entrega_contacto.value;
  if (checkStr.length==0 || checkStr.replace(/ /g, '') == '')
	{
    alert("Ingrese Nombre de una persona de contacto, por favor.");
    theForm.entrega_contacto.focus();
	theForm.entrega_contacto.select();
    return (false);
	}	
	
 
  
var checkStr = theForm.entrega_telefono.value;
  if (checkStr.length==0 || checkStr.replace(/ /g, '') == '')
	{
    alert("Ingrese un telefeno para el envio, por favor.");
    theForm.entrega_telefono.focus();
	theForm.entrega_telefono.select();
    return (false);
	}
		
		
/* ************** datos de facturacion ***********/
/*
var checkStr = theForm.factura_razon_social.value;
  if (checkStr.length==0 || checkStr.replace(/ /g, '') == '')
	{
    alert("Ingrese la Razon social para la factura, por favor.");
    theForm.factura_razon_social.focus();
	theForm.factura_razon_social.select();
    return (false);
	}	
	
 
  
var checkStr = theForm.factura_ruc.value;
  if (checkStr.length==0 || checkStr.replace(/ /g, '') == '')
	{
    alert("Ingrese el numero de RUC, por favor.");
    theForm.factura_ruc.focus();
	theForm.factura_ruc.select();
    return (false);
	}
	var checkStr = theForm.factura_direccion.value;
  if (checkStr.length==0 || checkStr.replace(/ /g, '') == '')
	{
    alert("Ingrese Direccion para la facturacion, por favor.");
    theForm.factura_direccion.focus();
	theForm.factura_direccion.select();
    return (false);
	}	
	
 
*/
 
 return (true);
}

/*************************/


function Finalizar(ENVIAR)
{
	  
	  if (Validar_finalizar(window.document.checkout_confirmation))
	{
		window.document.checkout_confirmation.accion.value=ENVIAR;
		window.document.checkout_confirmation.action="Modules/Client/Pedido/finalizar.php";	
		window.document.checkout_confirmation.submit();
		
	 
	}

 

}