			function limpiar_control(p_form,p_name)
			{
				if(p_name.substr(0,4)=="txt_")
				{
					p_form.elements[p_name].value="";	
				}
				else if(p_name.substr(0,4)=="cbx_")
				{
					p_form.elements[p_name].selectedIndex=-1;	
				}
				else if(p_name.substr(0,4)=="chk_")
				{
					p_form.elements[p_name].checked=false;
				}
				else if(p_name.substr(0,4)=="rdo_")
				{
					n = p_form.elements[p_name].length;
					for(var i =0; i<n; i++)
					{
						p_form.elements[p_name][i].checked = false;
					}
				}
			}
			
			function habilitar_control(p_form,p_name,p_tipo)
			{
				if(p_name.substr(0,4)=="txt_")
				{
					p_form.elements[p_name].value="";
					if(p_tipo == 0)
						document.getElementById(p_name).disabled = true;
					else
						document.getElementById(p_name).disabled = false;
				}				
				else if(p_name.substr(0,4)=="cbx_")
				{
					p_form.elements[p_name].selectedIndex=-1;
					if(p_tipo == 0)
						document.getElementById(p_name).disabled = true;
					else
						document.getElementById(p_name).disabled = false;
				}
				else if(p_name.substr(0,4)=="chk_")
				{
					p_form.elements[p_name].checked=false;
					if(p_tipo == 0)
						document.getElementById(p_name).disabled = true;
					else
						document.getElementById(p_name).disabled = false;
				}
				else if(p_name.substr(0,4)=="div_")
				{
					if(p_tipo == 0)
						document.getElementById(p_name).style.display = "none";
					else
						document.getElementById(p_name).style.display = "";
				}
				else if(p_name.substr(0,4)=="rdo_")
				{
					n = p_form.elements[p_name].length;
					for(var i =0; i<n; i++)
					{
						p_form.elements[p_name][i].checked = false;
						if(p_tipo == 0)
							p_form.elements[p_name][i].disbled = false;
						else
							p_form.elements[p_name][i].disbled = true;				
					}
				}
			}

			function validar_num(p_item)
			{
				if(p_item.value=="")
					return true;
				if(isNaN(p_item.value))
				{
					alert("El valor ingresado no es un n"+String.fromCharCode(163)+"mero valido"+"\n"+"No se debe ingresar caracteres especiales [',], salvo el punto decimal[.]");
					p_item.value="";
					p_item.focus();
					return true;
				}
				
				return true;
				
			}
			
			function validar_ruc(p_item)
			{
				if(p_item.value=="")
					return true;
				if(isNaN(p_item.value))
				{
					alert('El valor ingresado no es un RUC valido');
					p_item.value="";
					p_item.focus();
					return true;
				}
				
				v_num = Number(p_item.value)
				if(v_num<10000000000 || v_num>99999999999)
				{
					alert('El valor ingresado no es un RUC valido');
					p_item.value="";
					p_item.focus();
					return true;
				}
			}	
			
			function validar_dni(p_item)
			{
				if(p_item.value=="")
					return true;
				if(isNaN(p_item.value))
				{
					alert('El valor ingresado no es un DNI valido');
					p_item.value="";
					p_item.focus();
					return true;
				}
				
				v_num = Number(p_item.value)
				if(v_num<10000000 || v_num>99999999)
				{
					alert('El valor ingresado no es un DNI valido');
					p_item.value="";
					p_item.focus();
					return true;
				}
			}	
			
			function excluirTextos(p_arr,p_campo)
			{
				if(frmMain.elements[p_campo].value == "")
					return false;

				for(var i=0;i<p_arr.length;i++)
					if(frmMain.elements[p_arr[i]].name != p_campo && frmMain.elements[p_arr[i]].value!="")
						frmMain.elements[p_arr[i]].value = "";
			}

			function validarAnio(p_item)
			{
				if(p_item.value=="")
					return true;
					
				if(isNaN(p_item.value))
				{
					alert('El valor ingresado no es un a'+String.fromCharCode(241)+'o valido');
					p_item.value="";
					p_item.focus();
					return true;
				}
				
				var d = new Date();
				var yearMax = d.getFullYear();
				var yearMin = 1900;
				
				var year = Number(p_item.value)
				
				if(year<yearMin || year>yearMax)
				{
					alert('El a'+String.fromCharCode(241)+'o ingresado debe estar en el rango '+yearMin+' - '+yearMax);
					p_item.value="";
					p_item.focus();
					return true;
				}
				return true;
			}
			
			
			function validarAnioLimite(p_item,p_anio)
			{
				if(p_item.value=="")
					return true;
					
				if(isNaN(p_item.value))
				{
					alert('El valor ingresado no es un a'+String.fromCharCode(241)+'o valido');
					p_item.value="";
					p_item.focus();
					return true;
				}
				
				var d = new Date();
				var yearMax = d.getFullYear();
				
				var year = Number(p_item.value)
				
				if(year<p_anio || year>yearMax)
				{
					alert('El a'+String.fromCharCode(241)+'o ingresado debe estar en el rango '+p_anio+' - '+yearMax);
					p_item.value="";
					p_item.focus();
					return true;
				}
				return true;
			}

			function habilitar_texto(item)
			{
				v_nom = "txt_" + item.name.substr(4);
				document.getElementById(v_nom).value="";
				if(item.checked)
				{
					document.getElementById(v_nom).disabled=false;
					document.getElementById(v_nom).focus();
				}
				else
					document.getElementById(v_nom).disabled=true;
					
			}
			

			function validar_linea(p_cad)
			{
				if(frmMain.elements["chk_"+p_cad].checked)
				{
					
					if(frmMain.elements["txt_"+p_cad])
					{
						if(!validar_campos("txt_"+p_cad, "txt", "Falta ingresar la descripci"+String.fromCharCode(243)+"n de la certificaci"+String.fromCharCode(243)+"n"))
							return false;
					}

					if(!validar_campos("txt_desde"+p_cad, "txt", "Falta ingresar el a"+String.fromCharCode(241)+"o de inicio de vigencia de la certificaci"+String.fromCharCode(243)+"n"))
						return false;
					
					if(!validar_campos("rdo_vig"+p_cad, "rdo", "Falta seleccionar el estado de la vigencia de la certificaci"+String.fromCharCode(243)+"n"))
						return false;
					
					return true;
				}
				return true;
			}
			
			function validar_multiplesCamposTextos(p_arr,p_alerta)
			{
				var v_con_texto=0;
				for(var i=0; i< p_arr.length; i++)
				{
					if(frmMain.elements[p_arr[i]].value != "")
					{
						v_con_texto = 1;
						break;
					}
				}
				if(v_con_texto == 0)
				{
					if(p_alerta!="")
					{
						alert(p_alerta);
						frmMain.elements[p_arr[0]].focus();
					}
					return false;
						
				}
				return true;
			}
			
			function validar_campos(p_item, p_tipo, p_alerta)
			{
				if(p_tipo=="txt")
				{
					if(frmMain.elements[p_item].value=="")
					{
						if(p_alerta!="")
						{
							alert(p_alerta);
							if(!frmMain.elements[p_item].readonly)
								frmMain.elements[p_item].focus();
						}
						return false;
					}
					return true;
				}
				
				if(p_tipo=="cbx")
				{
					if(frmMain.elements[p_item].options.length==0)
						return true;
					if(frmMain.elements[p_item].selectedIndex==-1)
					{
						if(p_alerta!="")
						{
							alert(p_alerta);
							frmMain.elements[p_item].focus();
						}
						return false;
					}
					return true;
				}

				if(p_tipo=="rdo")
				{
					var n = frmMain.elements[p_item].length;
					for(var i=0;i<n;i++)
					{
						if(frmMain.elements[p_item][i].checked)
							return true;							
					}

					if(p_alerta!="")
					{
						alert(p_alerta);
						frmMain.elements[p_item][0].focus();
					}
					return false;
				}
				return false;
			}
			
			function validateDate()
			{
				d1 = new Date(Number(frmMain.txt_fechadesde.value.substr(6,4)),Number(frmMain.txt_fechadesde.value.substr(0,2))-1,Number(frmMain.txt_fechadesde.value.substr(3,2)));
				d2 = new Date(Number(frmMain.txt_fechahasta.value.substr(6,4)),Number(frmMain.txt_fechahasta.value.substr(0,2))-1,Number(frmMain.txt_fechahasta.value.substr(3,2)));
			
				if(d2<d1)
				{
					return(false);
				}
				return(true)
			}

			function load_cod_cbo(p_control,p_value)
			{
					for(var i=0;i<p_control.options.length;i++)
						if(p_control.options[i].value == p_value)
						{
							p_control.selectedIndex = i;
							break;
						}
			}

			
			function validarControlesRadio(p_radio,p_arr)
			{
				for(var i=0;i<p_arr.length;i++)
				{
					v_tipo = 0;
					if(p_radio.form.elements[p_radio.name][i].checked)
						v_tipo = 1;
					for(var j=0;j<p_arr[i].length;j++)
						habilitar_control(p_radio.form,p_arr[i][j],v_tipo);
				}
			}

			function validarControlesCheck(p_check,p_arr)
			{
					v_tipo = 0;
					if(p_check.checked)
						v_tipo = 1;
					for(var j=0;j<p_arr.length;j++)
						habilitar_control(p_check.form,p_arr[j],v_tipo);
			}

			function validarControlesCheckNo(p_check,p_arr)
			{
					v_tipo = 1;
					if(p_check.checked)
						v_tipo = 0;
					for(var j=0;j<p_arr.length;j++)
						habilitar_control(p_check.form,p_arr[j],v_tipo);
			}

			function validarControlesValNum(p_text,p_arr)
			{
					v_tipo = 0;
					if(!isNaN(p_text.value))
					{
						if(Number(p_text.value)>0)
							v_tipo = 1;
					}
					for(var j=0;j<p_arr.length;j++)
						habilitar_control(p_text.form,p_arr[j],v_tipo);
			}

			function validarControlesValTextNo(p_text,p_arr)
			{
					v_tipo = 1;
					if(p_text.value!="")
							v_tipo = 0;
					for(var j=0;j<p_arr.length;j++)
						habilitar_control(p_text.form,p_arr[j],v_tipo);
			}

			function showHide_rows(p_tit,p_div_tit, p_nomid,p_limInf,p_limSup,p_color)
			{
				v_style = "";
				v_tit = "[-]";
				if(document.getElementById(p_nomid+p_limInf).style.display =="")
				{
					v_style = "none";
					v_tit = "[+]";
				}
				if(p_color!="")
					v_font = "<font color='"+p_color+"'>"
				
				for(var i=p_limInf; i<=p_limSup; i++)
					document.getElementById(p_nomid+i).style.display = v_style;
				document.getElementById(p_div_tit).innerHTML =v_font+"<b>"+v_tit+p_tit+"</b>"+"</font>";
			}
