function whichElement(event) {
      var tname
      tname=event.srcElement.tagName
      if (event.button==2 && tname=="IMG"){pressed="picture"}
            if (pressed=="picture")
                  {window.alert("No está permitido")}
      pressed=0
}
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' debe contener una dirección de e-mail válida.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' debe contener un número.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' debe contener un número entre '+min+' y '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' es un campo obligatorio.\n'; }
  } if (errors) alert('Ocurrió el siguiente error(es):\n\n'+errors);
  document.MM_returnValue = (errors == '');
}
//-->

<!--
var confirmMsg  = ' ';

function confirmLink(theLink, theSqlQuery)
{
    if (confirmMsg == '' || typeof(window.opera) != 'undefined') {
        return true;
    }

    var is_confirmed = confirm(confirmMsg + theSqlQuery);
    if (is_confirmed) {
        if ( typeof(theLink.href) != 'undefined' ) {
            theLink.href += '&is_js_confirmed=1';
        } else if ( typeof(theLink.form) != 'undefined' ) {
            theLink.form.action += '?is_js_confirmed=1';
        }
    }

    return is_confirmed;
}

//-->

function verifica_clave(){
	var theForm = document.form;
	var conRE = /^(?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9]{8,10})$/;
	var errMsg = "";
	var setfocus = "";
	
	if (!conRE.test(theForm['Confirma'].value)){
		errMsg = "Repita Contraseña es un campo obligatotio\n y debe cumplir con la forma del ejemplo";
		setfocus = "['Confirma']";
	}
	
	if (!conRE.test(theForm['Nueva'].value)){
		errMsg = "Nueva Contraseña es un campo obligatotio\n y debe cumplir con la forma del ejemplo";
		setfocus = "['Nueva']";
	}
	
	if (theForm['Actual'].value == ""){
		errMsg = "Contraseña Actual es un campo obligatorio";
		setfocus = "['Actual']";
	}
	
	if (theForm['Confirma'].value != theForm['Nueva'].value){
		errMsg = "No coincide Nueva Contraseña y Repita Contraseña";
		setfocus = "['Nueva']";
	}
	
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	
	else {
		theForm['Enviar'].disabled = true;
		theForm['cancelar'].disabled = true;
		eval("document.getElementById('ver').style.overflow='visible';");
		eval("document.getElementById('ver').style.visibility='visible';");
		theForm.submit();
	}
}

//-->

function valida_ingreso(){
	var theForm = document.form_new;
	var emailRE = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	var telfRE = /^[0-9]{2,3}-? ?[0-9]{6,7}$/;
	var telfRE1 = /^[0-9]+$/;
	var telfRE2 = /^[0-9]*$/;
	var conRE = /^(?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9]{8,10})$/;
	var errMsg = "";
	var setfocus = "";
	
	if (theForm['captchacode'].value == ""){
		errMsg = "Caracteres es un campo obligatotio";
		document.getElementById('captchacode').className='m38';
		setfocus = "['captchacode']";
	}

	if (!conRE.test(theForm['CPassword'].value)){
		errMsg = "Repita su Contraseña es un campo obligatotio";
		document.getElementById('CPassword').className='m38';
		setfocus = "['CPassword']";
	}
	
	if (!conRE.test(theForm['Password2'].value)){
		errMsg = "Contraseña es un campo obligatotio\n y debe cumplir con la forma del ejemplo";
		document.getElementById('Password2').className='m38';
		setfocus = "['Password2']";
	}
	
	if (!telfRE2.test(theForm['Fax'].value)){
		errMsg = "Fax sólo permite ingreso de números";
		setfocus = "['Fax']";
	}
	
	if (!telfRE2.test(theForm['Telefono2'].value)){
		errMsg = "Celular sólo permite ingreso de números";
		setfocus = "['Telefono2']";
	}
	
	if (!telfRE1.test(theForm['Telefono1'].value)){
		errMsg = "Teléfono es un campo obligatorio y sólo permite ingreso de números";
		document.getElementById('Telefono1').className='m38';
		setfocus = "['Telefono1']";
	}
	
	if (theForm['Direccion'].value == ""){
		errMsg = "Dirección es un campo obligatotio";
		document.getElementById('Direccion').className='m38';
		setfocus = "['Direccion']";
	}
	
	if (theForm['Ciudad'].value == ""){
		errMsg = "Ciudad es un campo obligatotio";
		document.getElementById('Ciudad').className='m38';
		setfocus = "['Ciudad']";
	}
	
	if (theForm['Provincia'].value == ""){
		errMsg = "Provincia es un campo obligatotio";
		document.getElementById('Provincia').className='m38';
		setfocus = "['Provincia']";
	}
	
	if (theForm['Pais'].value == ""){
		errMsg = "Pais es un campo obligatotio";
		document.getElementById('Pais').className='m38';
		setfocus = "['Pais']";
	}
	
	if (!emailRE.test(theForm['E-Mail'].value)){
		errMsg = "Debe escribir un E-Mail válido";
		document.getElementById('E-Mail').className='m38';
		setfocus = "['E-Mail']";
	}
	
	if (theForm['Apellido'].value == ""){
		errMsg = "Apellido es un campo obligatotio";
		document.getElementById('Apellido').className='m38';
		setfocus = "['Apellido']";
	}
	
	if (theForm['Nombre'].value == ""){
		errMsg = "Nombre es un campo obligatotio";
		document.getElementById('Nombre').className='m38';
		setfocus = "['Nombre']";
	}
	
	if (theForm['Empresa'].value == ""){
		errMsg = "Empresa es un campo obligatotio";
		document.getElementById('Empresa').className='m38';
		setfocus = "['Empresa']";
	}
	
	if (!validaRUC(theForm['RUC'].value)){
		errMsg = "Debe ingresar un RUC o No. de Cédula válido (sólo números)";
		document.getElementById('RUC').className='m38';
		setfocus = "['RUC']";
	}
	
	if (theForm['Password2'].value != theForm['CPassword'].value){
		errMsg = "Contraseña y Repita su Contraseña No Coinciden";
		setfocus = "['Password2']";
	}
	
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	
	else {
		theForm['Enviar'].disabled = true;
		eval("document.getElementById('ver').style.overflow='visible';");
		eval("document.getElementById('ver').style.visibility='visible';");
		theForm.submit();
	}
}

//-->

function valida_editcuenta(){
	var theForm = document.form1;
	var emailRE = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	var telfRE = /^[0-9]{2,3}-? ?[0-9]{6,7}$/;
	var telfRE1 = /^[0-9]+$/;
	var telfRE2 = /^[0-9]*$/;
	var conRE = /^(?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9]{8,10})$/;
	var errMsg = "";
	var setfocus = "";

	if (!telfRE2.test(theForm['Fax'].value)){
		errMsg = "Fax sólo permite ingreso de números";
		setfocus = "['Fax']";
	}
	
	if (!telfRE2.test(theForm['Telefono2'].value)){
		errMsg = "Celular sólo permite ingreso de números";
		setfocus = "['Telefono2']";
	}

	if (!telfRE1.test(theForm['Telefono1'].value)){
		errMsg = "Debe escribir un Telefono1 válido";
		setfocus = "['Telefono1']";
	}
	
	if (theForm['Direccion'].value == ""){
		errMsg = "Direccion es un campo obligatotio";
		setfocus = "['Direccion']";
	}
	
	if (theForm['Ciudad'].value == ""){
		errMsg = "Ciudad es un campo obligatotio";
		setfocus = "['Ciudad']";
	}
	
	if (theForm['Provincia'].value == ""){
		errMsg = "Provincia es un campo obligatotio";
		setfocus = "['Provincia']";
	}
	
	if (theForm['Pais'].value == ""){
		errMsg = "Pais es un campo obligatotio";
		setfocus = "['Pais']";
	}
	
	if (!emailRE.test(theForm['E-Mail'].value)){
		errMsg = "Debe escribir un E-Mail válido";
		setfocus = "['E-Mail']";
	}
	
	if (theForm['Apellido'].value == ""){
		errMsg = "Apellido es un campo obligatotio";
		setfocus = "['Apellido']";
	}
	
	if (theForm['Nombre'].value == ""){
		errMsg = "Nombre es un campo obligatotio";
		setfocus = "['Nombre']";
	}
	
	if (theForm['Empresa'].value == ""){
		errMsg = "Empresa es un campo obligatotio";
		setfocus = "['Empresa']";
	}
	
	if (!validaRUC(theForm['RUC'].value)){
		errMsg = "Debe ingresar un RUC o No. de Cédula válido (sólo números)";
		setfocus = "['RUC']";
	}
	
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	
	else {
		theForm['Enviar'].disabled = true;
		theForm['cancelar'].disabled = true;
		eval("document.getElementById('ver').style.overflow='visible';");
		eval("document.getElementById('ver').style.visibility='visible';");
		theForm.submit();
	}
}

//VALIDA CEDULA O RUC

function validaRUC(campo) {          
   
      numero = campo;
	  /* alert(numero); */

      var suma = 0;      
      var residuo = 0;      
      var pri = false;      
      var pub = false;            
      var nat = false;      
      var numeroProvincias = 22;                  
      var modulo = 11;
                  
      /* Verifico que el campo no contenga letras */                  
      var ok=1;
      for (i=0; i<numero.length && ok==1 ; i++){
         var n = parseInt(numero.charAt(i));
         if (isNaN(n)) ok=0;
      }
      if (ok==0){
         return false;
      }
                  
      if (numero.length < 10 ){              
         return false;
      }
     
      /* Los primeros dos digitos corresponden al codigo de la provincia */
      provincia = numero.substr(0,2);      
      if (provincia < 1 || provincia > numeroProvincias){           
		 return false;       
      }

      /* Aqui almacenamos los digitos de la cedula en variables. */
      d1  = numero.substr(0,1);         
      d2  = numero.substr(1,1);         
      d3  = numero.substr(2,1);         
      d4  = numero.substr(3,1);         
      d5  = numero.substr(4,1);         
      d6  = numero.substr(5,1);         
      d7  = numero.substr(6,1);         
      d8  = numero.substr(7,1);         
      d9  = numero.substr(8,1);         
      d10 = numero.substr(9,1);                
         
      /* El tercer digito es: */                           
      /* 9 para sociedades privadas y extranjeros   */         
      /* 6 para sociedades publicas */         
      /* menor que 6 (0,1,2,3,4,5) para personas naturales */ 

      if (d3==7 || d3==8){           
         return false;
      }         
         
      /* Solo para personas naturales (modulo 10) */         
      if (d3 < 6){           
         nat = true;            
         p1 = d1 * 2;  if (p1 >= 10) p1 -= 9;
         p2 = d2 * 1;  if (p2 >= 10) p2 -= 9;
         p3 = d3 * 2;  if (p3 >= 10) p3 -= 9;
         p4 = d4 * 1;  if (p4 >= 10) p4 -= 9;
         p5 = d5 * 2;  if (p5 >= 10) p5 -= 9;
         p6 = d6 * 1;  if (p6 >= 10) p6 -= 9; 
         p7 = d7 * 2;  if (p7 >= 10) p7 -= 9;
         p8 = d8 * 1;  if (p8 >= 10) p8 -= 9;
         p9 = d9 * 2;  if (p9 >= 10) p9 -= 9;             
         modulo = 10;
      }         

      /* Solo para sociedades publicas (modulo 11) */                  
      /* Aqui el digito verficador esta en la posicion 9, en las otras 2 en la pos. 10 */
      else if(d3 == 6){           
         pub = true;             
         p1 = d1 * 3;
         p2 = d2 * 2;
         p3 = d3 * 7;
         p4 = d4 * 6;
         p5 = d5 * 5;
         p6 = d6 * 4;
         p7 = d7 * 3;
         p8 = d8 * 2;            
         p9 = 0;            
      }         
         
      /* Solo para entidades privadas (modulo 11) */         
      else if(d3 == 9) {           
         pri = true;                                   
         p1 = d1 * 4;
         p2 = d2 * 3;
         p3 = d3 * 2;
         p4 = d4 * 7;
         p5 = d5 * 6;
         p6 = d6 * 5;
         p7 = d7 * 4;
         p8 = d8 * 3;
         p9 = d9 * 2;            
      }
                
      suma = p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9;                
      residuo = suma % modulo;                                         

      /* Si residuo=0, dig.ver.=0, caso contrario 10 - residuo*/
      digitoVerificador = residuo==0 ? 0: modulo - residuo;                

      /* ahora comparamos el elemento de la posicion 10 con el dig. ver.*/                         
      if (pub==true){           
         if (digitoVerificador != d9){                          
            return false;
         }                  
         /* El ruc de las empresas del sector publico terminan con 0001*/         
         if ( numero.substr(9,4) != '0001' ){                    
            return false;
         }
      }         
      else if(pri == true){         
         if (digitoVerificador != d10){                          
            return false;
         }         
         if ( numero.substr(10,3) != '001' ){                    
            return false;
         }
      }      

      else if(nat == true){         
         if (digitoVerificador != d10){                          
            return false;
         }         
         if (numero.length >10 && numero.substr(10,3) != '001' ){                    
            return false;
         }
      }      
      return true;   
   }

<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->

// GENERAR CLAVES ALEATORIAS //

function getRandomNum(lbound, ubound){
	return (Math.floor(Math.random() * (ubound - lbound)) + lbound);
}

function getRandomChar(number, lower, upper, other, extra){
	var numberChars = "0123456789";
	var lowerChars = "abcdefghijklmnopqrstuvwxyz";
	var upperChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	var otherChars = "`~!@#$%^&*()-_=+[{]}\\|;:'\",<.>/? ";
	var charSet = extra;
	if (number == true)
		charSet += numberChars;
	if (lower == true)
		charSet += lowerChars;
	if (upper == true)
		charSet += upperChars;
	if (other == true)
		charSet += otherChars;
	return charSet.charAt(getRandomNum(0, charSet.length));
}

function getPassword(length, extraChars, firstNumber, firstLower, firstUpper, firstOther,
latterNumber, latterLower, latterUpper, latterOther){
	var rc = "";
	if (length > 0)
		rc = rc + getRandomChar(firstNumber, firstLower, firstUpper, firstOther, extraChars);
	for (var idx = 1; idx < length; ++idx){
		rc = rc + getRandomChar(latterNumber, latterLower, latterUpper, latterOther, extraChars);
	}
	return rc;
}

// HASTA AQUÍ CLAVES ALEATORIAS //

function ponerfocus(){
	var theForm = document.form_new;
	var setfocus = "";
	setfocus = "['RUC']";
	eval("theForm" + setfocus + ".focus()");
	}
	
function ponerfocusentra(){
	var theForm = document.form1;
	var setfocus = "";
	setfocus = "['Codigo']";
	eval("theForm" + setfocus + ".focus()");
	}

function focuscontacto(){
	var theForm = document.form1;
	var setfocus = "";
	setfocus = "['Nombres']";
	eval("theForm" + setfocus + ".focus()");
	}
	
function focussacacuota(){
	var theForm = document.sacacuotas;
	var setfocus = "";
	setfocus = "['monto']";
	eval("theForm" + setfocus + ".focus()");
	}

function valida_contacto(){
	var theForm = document.form1;
	var emailRE = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	var telfRE = /^[0-9]{2,3}-? ?[0-9]{6,7}$/;
	var telfRE1 = /^[0-9]+$/;
	var errMsg = "";
	var setfocus = "";
	
	if (theForm['Mensaje'].value == ""){
		errMsg = "Mensaje es un campo obligatotio";
		document.getElementById('Mensaje').className='m38';
		setfocus = "['Mensaje']";
	}
		
	if (!emailRE.test(theForm['E-Mail'].value)){
		errMsg = "E-Mail es un campo obligatotio";
		document.getElementById('E-Mail').className='m38';
		setfocus = "['E-Mail']";
	}
	
	if (!telfRE1.test(theForm['Telefono'].value)){
		errMsg = "Teléfono es un campo obligatotio y solo permite ingreso de números";
		document.getElementById('Telefono').className='m38';
		setfocus = "['Telefono']";
	}
	
	if (theForm['Nombres'].value == ""){
		errMsg = "Nombres es un campo obligatotio";
		document.getElementById('Nombres').className='m38';
		setfocus = "['Nombres']";
	}
	
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	
	else {
		theForm['Enviar'].disabled = true;
		eval("document.getElementById('ver').style.overflow='visible';");
		eval("document.getElementById('ver').style.visibility='visible';");
		theForm.submit();
	}
}

function valida_entrar(){
	var theForm = document.form1;
	var errMsg = "";
	var setfocus = "";
	
	if (theForm['Password1'].value == ""){
		errMsg = "Contraseña es un campo obligatotio";
		document.getElementById('Password1').className='m38';
		setfocus = "['Password1']";
	}

	if (theForm['Codigo1'].value == ""){
		errMsg = "Código de Usuario es un campo obligatotio";
		document.getElementById('Codigo1').className='m38';
		setfocus = "['Codigo1']";
	}
	
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	
	else {
		theForm['Enviar'].disabled = true;
		eval("document.getElementById('ver').style.overflow='visible';");
		eval("document.getElementById('ver').style.visibility='visible';");
		theForm.submit();
	}
}

function valida_entrararriba(){
	var theForm = document.form_entrar;
	var errMsg = "";
	var setfocus = "";
	
	if (theForm['Password'].value == ""){
		errMsg = "Contraseña es un campo obligatotio";
		document.getElementById('Password').className='m38';
		setfocus = "['Password']";
	}

	if (theForm['Codigo'].value == ""){
		errMsg = "Código de Usuario es un campo obligatotio";
		document.getElementById('Codigo').className='m38';
		setfocus = "['Codigo']";
	}
	
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	
	else {
		theForm['entrar'].disabled = true;
		theForm.submit();
	}
}

function recuerda(){
	var theForm = document.form_recuerda;
	var emailRE = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	var errMsg = "";
	var setfocus = "";
	
	if (!emailRE.test(theForm['E-Mail'].value)){
		errMsg = "E-Mail es un campo obligatotio";
		document.getElementById('E-Mail').className='m38';
		setfocus = "['E-Mail']";
	}

	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	
	else {
		theForm['Enviar'].disabled = true;
		eval("document.getElementById('ver').style.overflow='visible';");
		eval("document.getElementById('ver').style.visibility='visible';");
		theForm.submit();
	}
}

function valida_procesar_pedido(){
	var theForm = document.form_pedido;
	var emailRE = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	var telfRE = /^[0-9]{2,3}-? ?[0-9]{6,7}$/;
	var telfRE1 = /^[0-9]+$/;
	var errMsg = "";
	var setfocus = "";
	
	if (theForm['direccion2'].value == ""){
		errMsg = "Dirección de Envío es un campo obligatotio";
		setfocus = "['direccion2']";
	}
	
	if (theForm['ciudad2'].value == ""){
		errMsg = "Ciudad de Envío es un campo obligatotio";
		setfocus = "['ciudad2']";
	}
	
	if (theForm['provincia'].value == ""){
		errMsg = "Provincia de Envío es un campo obligatotio";
		setfocus = "['provincia']";
	}
	
	if (theForm['apellido2'].value == ""){
		errMsg = "Apellido es un campo obligatotio";
		setfocus = "['apellido2']";
	}
	
	if (theForm['nombre2'].value == ""){
		errMsg = "Nombre es un campo obligatotio";
		setfocus = "['nombre2']";
	}
	
	if (!telfRE1.test(theForm['telefono'].value)){
		errMsg = "Teléfono es un campo obligatotio y solo permite ingreso de números";
		setfocus = "['telefono']";
	}
	
	if (theForm['direccion'].value == ""){
		errMsg = "Dirección es un campo obligatotio";
		setfocus = "['direccion']";
	}
	
	if (theForm['ciudad'].value == ""){
		errMsg = "Ciudad es un campo obligatotio";
		setfocus = "['ciudad']";
	}
	
	if (!emailRE.test(theForm['email'].value)){
		errMsg = "E-Mail es un campo obligatotio";
		setfocus = "['email']";
	}
		
	if (theForm['apellido'].value == ""){
		errMsg = "Apellido es un campo obligatotio";
		setfocus = "['apellido']";
	}
	
	if (theForm['nombre'].value == ""){
		errMsg = "Nombre es un campo obligatotio";
		setfocus = "['nombre']";
	}
	
	if (theForm['empresa'].value == ""){
		errMsg = "Empresa es un campo obligatotio";
		setfocus = "['empresa']";
	}
	
	if (theForm['ruc'].value == ""){
		errMsg = "RUC es un campo obligatotio";
		setfocus = "['ruc']";
	}
	
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	
	else {
		theForm['procesar'].disabled = true;
		theForm['cancelar'].disabled = true;
		eval("document.getElementById('ver').style.overflow='visible';");
		eval("document.getElementById('ver').style.visibility='visible';");
		theForm.submit();
	}
}

function valida_busca_codigo(){
	var theForm = document.buscacod;
	var errMsg = "";
	var setfocus = "";
	
	if (theForm['CodigoSaz'].value == "" || theForm['CodigoSaz'].value == "- Código Saz -"){
		errMsg = "Debe ingresar un Código SAZ a Buscar";
		setfocus = "['CodigoSaz']";
	}

	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	
	else {
		theForm['Enviar'].disabled = true;
		theForm.submit();
	}
}

function numbersonly(myfield,e,dec)
{var key;var keychar;if(window.event)
key=window.event.keyCode;else if(e)
key=e.which;else
return true;keychar=String.fromCharCode(key);if((key==null)||(key==0)||(key==8)||(key==9)||(key==13)||(key==27))
return true;else if((("0123456789").indexOf(keychar)>-1))
return true;else if(dec&&(keychar=="."))
{myfield.form.elements[dec].focus();return false;}
else
return false;}

function numbersonlyincludepoint(myfield,e,dec)
{var key;var keychar;if(window.event)
key=window.event.keyCode;else if(e)
key=e.which;else
return true;keychar=String.fromCharCode(key);if((key==null)||(key==0)||(key==8)||(key==9)||(key==13)||(key==27))
return true;else if((("0123456789.").indexOf(keychar)>-1))
return true;else if(dec&&(keychar=="."))
{myfield.form.elements[dec].focus();return false;}
else
return false;}

function valida_sacacuotas(){
	var theForm = document.sacacuotas;
	var errMsg = "";
	var setfocus = "";
	
	if (theForm['monto'].value == "" || theForm['monto'].value == 0){
		errMsg = "Debe ingresar un Monto a calcular las cuotas";
		setfocus = "['monto']";
	}
	
	if (theForm['meses'].value == ""){
		errMsg = "Debe escoger a cuantos meses desea diferir el monto";
		setfocus = "['meses']";
	}

	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	
	else {
		theForm['btncalcula'].disabled = true;
		theForm['borrar'].disabled = true;
		theForm.submit();
	}
}

function valida_direccion(){
	var theForm = document.form_direccion;
	var errMsg = "";
	var setfocus = "";
	
	if (theForm['Direccion'].value == ""){
		errMsg = "Dirección es un Campo Obligatorio";
		setfocus = "['Direccion']";
	}
	
	if (theForm['Ciudad'].value == ""){
		errMsg = "Ciudad es un Campo Obligatorio";
		setfocus = "['Ciudad']";
	}
	
	if (theForm['Provincia'].value == ""){
		errMsg = "Provincia es un Campo Obligatorio";
		setfocus = "['Provincia']";
	}

	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	
	else {
		theForm['actualizar'].disabled = true;
		theForm.submit();
	}
}

function expand_nav(link)
{
	var ul = find_enclosing_ul(link)
	if (ul.style.display == 'none')
	{
		ul.style.display = 'block'
	}
	else
	{
		ul.style.display = 'none'
	}
	if (link.className == 'down')
	{
		link.className='down_open'
	}
	else
	{
		link.className='down'
	}
}
		
function find_enclosing_ul(link)
{
	var search_node = link
	while (true)
	{
		var node = search_node.nextSibling
		if (node && node.nodeName == 'UL')
		{
			break
		}
		else
		{
			search_node = node
		}
	}
	return node	
}

function valida_busca_avanzada(){
	var theForm = document.form_box_saca_categorias;
	var errMsg = "";
	var setfocus = "";
	
	if (theForm['TradeID'].value == ""){
		errMsg = "Marca es un campo obligatorio";
		setfocus = "['TradeID']";
	}
	
	if (theForm['SubCategoryID'].value == ""){
		errMsg = "Sub-Categoría es un campo obligatorio";
		setfocus = "['SubCategoryID']";
	}
	
	if (theForm['CategoryID'].value == ""){
		errMsg = "Categoría es un campo obligatorio";
		setfocus = "['CategoryID']";
	}

	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	
	else {
		theForm['enviar'].disabled = true;
		theForm.submit();
	}
}

function valida_ingreso_hoja(){
	var theForm = document.form_trabaja;
	var emailRE = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	var telfRE = /^[0-9]{2,3}-? ?[0-9]{6,7}$/;
	var telfRE1 = /^[0-9]{9}$/;
	var telfRE2 = /^[0-9]{2}$/;
	var telfRE3 = /^[0-9]{3,4}$/;
	var errMsg = "";
	var setfocus = "";
	
	if (theForm['hojavida'].value == ""){
		errMsg = "Ingrese su Hoja de Vida en Archivo de Word (.doc) y el nombre del archivo será hojadevida_numerocedula.doc,\nejem: hojadevia_0401373674.doc";
		document.getElementById('hojavida').className='text_rojo';
		setfocus = "['hojavida']";
	}
	
	if (!telfRE3.test(theForm['salario'].value)){
		errMsg = "Aspiración Salarial es un campo obligatotio y solo permite ingreso de números\nDebe contener máximo 4 dígitos";
		document.getElementById('salario').className='text_rojo';
		setfocus = "['salario']";
	}
	
	if (theForm['areaaplica'].value == ""){
		errMsg = "Área a la que aplica es un campo obligatotio";
		document.getElementById('areaaplica').className='text_rojo';
		setfocus = "['areaaplica']";
	}
	
	if (theForm['anios'].value == ""){
		errMsg = "Años de Experiencia es un campo obligatotio";
		document.getElementById('anios').className='text_rojo';
		setfocus = "['anios']";
	}
	
	if (theForm['area'].value == ""){
		errMsg = "Area de Estudio es un campo obligatotio";
		document.getElementById('area').className='text_rojo';
		setfocus = "['area']";
	}
	
	if (theForm['nivel'].value == ""){
		errMsg = "Nivel Educativo es un campo obligatotio";
		document.getElementById('nivel').className='text_rojo';
		setfocus = "['nivel']";
	}
	
	if (!validarEmail(theForm['email'].value)){
		errMsg = "Ingrese un E-Mail Válido, campo obligatorio";
		document.getElementById('email').className='text_rojo';
		setfocus = "['email']";
	}
	
	if (!telfRE1.test(theForm['celular'].value)){
		errMsg = "Celular es un campo obligatotio y solo permite ingreso de números\nDebe contener 9 dígitos";
		document.getElementById('celular').className='text_rojo';
		setfocus = "['celular']";
	}
	
	if (!telfRE1.test(theForm['telefono'].value)){
		errMsg = "Teléfono es un campo obligatotio y solo permite ingreso de números\nDebe contener 9 dígitos";
		document.getElementById('telefono').className='text_rojo';
		setfocus = "['telefono']";
	}
	
	if (theForm['sector'].value == ""){
		errMsg = "Sector es un campo obligatotio";
		document.getElementById('sector').className='text_rojo';
		setfocus = "['sector']";
	}
	
	if (theForm['direccion'].value == ""){
		errMsg = "Dirección es un campo obligatotio";
		document.getElementById('direccion').className='text_rojo';
		setfocus = "['direccion']";
	}
	
	if (theForm['ciudad'].value == ""){
		errMsg = "Ciudad es un campo obligatotio";
		document.getElementById('ciudad').className='text_rojo';
		setfocus = "['ciudad']";
	}
	
	if (theForm['provincia'].value == ""){
		errMsg = "Provincia es un campo obligatotio";
		document.getElementById('provincia').className='text_rojo';
		setfocus = "['provincia']";
	}
	
	if (theForm['sangre'].value == ""){
		errMsg = "Tipo de Sangre es un campo obligatotio";
		document.getElementById('sangre').className='text_rojo';
		setfocus = "['sangre']";
	}
	
	if (theForm['cargas'].value == ""){
		errMsg = "Cargas Familiares es un campo obligatotio";
		document.getElementById('cargas').className='text_rojo';
		setfocus = "['cargas']";
	}
	
	if (theForm['estadocivil'].value == ""){
		errMsg = "Estado Civil es un campo obligatotio";
		document.getElementById('estadocivil').className='text_rojo';
		setfocus = "['estadocivil']";
	}
	
	if (!validaRUC(theForm['cedula'].value)){
		errMsg = "Cédula es un campo obligatotio y solo permite números\nIngrese una Cédula válida";
		document.getElementById('cedula').className='text_rojo';
		setfocus = "['cedula']";
	}
	
	if (theForm['fecha'].value == ""){
		errMsg = "Fecha de Nacimiento es un campo obligatotio";
		document.getElementById('fecha').className='text_rojo';
		setfocus = "['fecha']";
	}

	if (theForm['apellidos'].value == ""){
		errMsg = "Apellidos es un campo obligatotio";
		document.getElementById('apellidos').className='text_rojo';
		setfocus = "['apellidos']";
	}

	if (theForm['nombres'].value == ""){
		errMsg = "Nombres es un campo obligatotio";
		document.getElementById('nombres').className='text_rojo';
		setfocus = "['nombres']";
	}
	
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	
	else {
		theForm['enviar'].disabled = true;
		theForm['enviar'].value = "CARGANDO...";
		theForm.submit();
	}
}

function validarEmail(email)
{
	var d;
  	d  = email.indexOf("@"), 
	d2 = email.lastIndexOf(".");
  	if((d<=0)||(email.indexOf(" ")!=-1)||(d>=email.length-1)||(d2<=d)||(d2>=email.length-1))
  	{
    	return false;
  	}
  	return true;
}

function valida_busca_palabra(){
	var theForm = document.form_palabra;
	var errMsg = "";
	var setfocus = "";
	
	if (theForm['Palabra'].value == "" || theForm['Palabra'].value == "Buscar Productos por: Código, Número de Parte, Nombre, Marca, Categoría, Sub-Categoria"){
		errMsg = "Debe ingresar una Palabra a Buscar\n\nPuede escribir:\nCódigos de Productos SAZ, Números de Parte de Productos,\nNombres de Categorías, Nombres de Sub-Categorías, Nombres de Marcas o cualquier Palabra";
		document.getElementById('Palabra').className='m38';
		setfocus = "['Palabra']";
	}

	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	
	else {
		theForm.submit();
	}
}