var ajax = new AJAX();

function Enviar_correo_Registro()
{
	try { 
			var a_fields = {'txt_nombreREG':{'l':'Nombre','r':true,'f':'alpha','t':'td_nombreREG'},
							'txt_ApellidoREG':{'l':'Apellido','r':true,'f':'alpha','t':'td_ApellidoREG'},
							'txt_dniREG':{'l':'DNI','r':true,'f':'dni','t':'td_dniREG'},
							'txt_telefonoREG':{'l':'Tel\u00e9fono','r':true,'f':'Telefono','t':'td_telefonoREG'}   };
							
			var v = new validator('form_contactenos', a_fields);

			if(v.exec())
				{
					nom = document.form_contactenos.txt_nombreREG.value;
					ape = document.form_contactenos.txt_ApellidoREG.value;
					dni = document.form_contactenos.txt_dniREG.value;
					tel = document.form_contactenos.txt_telefonoREG.value;

					ajax.consultar('bin/frame.php','Resultado_envio','post','T=CorreoRegistro&nom='+nom+'&ape='+ape+'&dni='+dni+'&tel='+tel,'NO');
				}
		}
	catch (e) {  alert("ERROR .......Enviar_correo_Registro()");	}
}



function Enviar_correo_contactenos()
{
	try { 
			var a_fields = {'txt_nombre':{'l':'Nombre','r':true,'f':'alpha','t':'td_nombre'},
							'txt_Apellido':{'l':'Apellido','r':true,'f':'alpha','t':'td_Apellido'},
							'txt_email':{'l':'Email','r':true,'f':'email','t':'td_email'},
							'txt_telefono':{'l':'Tel\u00e9fono','r':true,'f':'Telefono','t':'td_telefono'},
							'txt_mensaje':{'l':'Mensaje','r':true,'f':'Mensaje','t':'td_mensaje'}
							};
							
			var v = new validator('form_contactenos', a_fields);

			if(v.exec())
				{
					nom = document.form_contactenos.txt_nombre.value;
					ape = document.form_contactenos.txt_Apellido.value;
					ema = document.form_contactenos.txt_email.value;
					tel = document.form_contactenos.txt_telefono.value;
					men = document.form_contactenos.txt_mensaje.value;
					emp = document.form_contactenos.txt_empresa.value;
					ane = document.form_contactenos.txt_anexo.value;

					ajax.consultar('bin/frame.php','Resultado_envio','post','T=CorreoContactenos&nom='+nom+'&ape='+ape+'&ema='+ema+
							'&tel='+tel+'&men='+men+'&emp='+emp+'&ane='+ane,'NO');
				}
		}
	catch (e) {  alert("ERROR .......Enviar_correo_contactenos()");	}
}


function EnvioExitoso()
{
	try { 
			alert("Tu mensaje se ha enviado satisfactoriamente.");
			document.form_contactenos.txt_nombre.value = '';
			document.form_contactenos.txt_Apellido.value = '';
			document.form_contactenos.txt_email.value = '';
			document.form_contactenos.txt_telefono.value = '';
			document.form_contactenos.txt_mensaje.value = '';
			document.form_contactenos.txt_empresa.value = '';
			document.form_contactenos.txt_anexo.value = '';
		}
	catch (e) {  alert("ERROR .......EnvioExitoso()");	}
}


function Correo_Catalogo()
{
	try { 	Mail = document.form_envio_oferta.txt_mail_oferta.value;
			if(/^[\w-\.]+\@[\w\.-]+\.[a-z]{2,4}$/.test(Mail))
			 { ajax.consultar('bin/frame.php','Resultado_Catalogo','post','T=CorreoCatalogo&Mail='+Mail,'NO'); }
			else
			 { alert("La dirección de email es incorrecta."); }
		}
	catch (e) {  alert("ERROR .......Correo_Catalogo()");	}
}

function EnvioExitosoCatalogo()
{
	try { 	alert("Tu mensaje se ha enviado satisfactoriamente.");
			document.form_envio_oferta.txt_mail_oferta.value = '';
		}
	catch (e) {  alert("ERROR .......EnvioExitosoCatalogo()");	}
}


function validarDia()
{
	mes = document.form_trabaja1.cbo_mes.value;
	dia = document.form_trabaja1.cbo_dia.value;
	ano = document.form_trabaja1.cbo_anio.value;
	
	if( (dia!=0) && (mes!="") && (ano!=""))
	{

	if( mes=='4' || mes=='6' || mes=='9' || mes=='11')
		{ if(dia>30)
			{ alert("Ingrese una fecha v\u00e1lida, este mes no tiene 31 d\u00edas");
			  document.forms['form_trabaja1']['cbo_dia'].value = ''; }
		}
	if(mes=='2')
		{ 	if((ano % 4 == 0) && ((ano % 100 != 0) || (ano % 400 == 0)))
				{
					if(dia>=30)
						{ alert("Ingrese una fecha v\u00e1lida, este mes solo tiene 29 d\u00edas");
				  		  document.forms['form_trabaja1']['cbo_dia'].value = ''; }
				}
			else
				{
					if(dia>=29)
						{ alert("Ingrese una fecha v\u00e1lida, este mes solo tiene 28 d\u00edas");
				  		  document.forms['form_trabaja1']['cbo_dia'].value = ''; }
				}
		}
	}
}

/******/

function IrDeA(De,A)
{
	try { 	if(De==1)
			{	var a_fields = {
								'txt_dni':{'l':'DNI','r':true,'f':'dni','t':'td_dni'},
								'txt_nom':{'l':'Nombre','r':true,'f':'alpha','t':'td_nom'},
								'txt_ApePat':{'l':'Apellido Paterno','r':true,'f':'alpha','t':'td_ApePat'},
								'txt_ApeMat':{'l':'Apellido Materno','r':true,'f':'alpha','t':'td_ApeMat'},
								'cbo_dia':{'l':'D\u00eda','r':true,'f':'numeros','t':'FecNaci_Id'},
								'cbo_mes':{'l':'Mes','r':true,'f':'numeros','t':'FecNaci_Id'},
								'cbo_anio':{'l':'A\u00f1o','r':true,'f':'numeros','t':'FecNaci_Id'},
								'txt_est_civil':{'l':'Estado civil','r':true,'f':'alpha','t':'td_estCivil'},
								'txt_nacionalidad':{'l':'Nacionalidad','r':true,'f':'alpha','t':'td_nacionalidad'},
								'txt_mail':{'l':'Correo','r':true,'f':'email','t':'td_mail'},
								'txt_tlf_Fijo':{'l':'Tel\u00e9fono Fijo','r':true,'f':'Telefono','t':'td_tlf_Fijo'},
								'txt_cel':{'l':'Tel\u00e9fono Celular','r':true,'f':'Telefono','t':'td_cel'},
								'txt_direccion':{'l':'Direcci\u00f3n','r':true,'f':'Obligatorio','t':'td_direccion'},
								'txt_Departamentos':{'l':'Departamento','r':true,'f':'numeros','t':'td_depar'},
								'txt_Provincias':{'l':'Provincia','r':true,'f':'numeros','t':'td_provincia'},
								'txt_Distrito':{'l':'Distrito','r':true,'f':'numeros','t':'td_dis'}
								};
								
				var v = new validator('form_trabaja1', a_fields);
				if(v.exec())
				{ 
  				  Valor = 'txt_Departamentos';   Valor2 = 'txt_Departamentos2'; 
				  document.getElementById(Valor2).value = document.getElementById(Valor).options[document.getElementById(Valor).selectedIndex].text;
				  Valor = 'txt_Provincias';   Valor2 = 'txt_Provincias2'; 
				  document.getElementById(Valor2).value = document.getElementById(Valor).options[document.getElementById(Valor).selectedIndex].text;
				  Valor = 'txt_Distrito';   Valor2 = 'txt_Distrito2'; 
				  document.getElementById(Valor2).value = document.getElementById(Valor).options[document.getElementById(Valor).selectedIndex].text;			
				  IrA(A);
				}
			}
			
			if(De==2)
			{	var a_fields = {'cbocentroestudios':{'l':'Centro de estudios','r':true,'f':'alpha','t':'td_cen_est'},
								'cbo_NivAcademico':{'l':'Nivel acad\u00e9mico','r':true,'f':'alpha','t':'td_Niv_aca'},
								'cbo_Especialidad':{'l':'Especialidad','r':true,'f':'alpha','t':'td_especialidad'}
								};
				var v = new validator('form_trabaja1', a_fields);
				if(v.exec())
					{ 	IrA(A); }
			}
			if(De==3)
			{	var a_fields = {'cbo_AreaPost':{'l':'\u00c1rea a la que postula','r':true,'f':'alpha','t':'td_are_pos'},
								'cbo_Expectativas':{'l':'Expectativas salariales','r':true,'f':'Obligatorio','t':'td_exp_sal'},
								'cbo_disponibilidad':{'l':'Disponibilidad','r':true,'f':'alpha','t':'td_dis_inm'},
								'cbo_TipoEmpleo':{'l':'Tipo de empleo','r':true,'f':'alpha','t':'td_tip_emp'}
								};
				var v = new validator('form_trabaja1', a_fields);
				if(v.exec())
					{ 	IrA(A); }
			}
		}
	catch (e) {  alert("ERROR .......IrDeA()");	}
}

function IrA(A)
{
	try { 
			if(A==1)
			{	document.getElementById('Paso3').style.display = "none";
				document.getElementById('Paso2').style.display = "none";
				document.getElementById('Paso4').style.display = "none";
				document.getElementById('Paso1').style.display = "block";
			}
			if(A==2)
			{	document.getElementById('Paso3').style.display = "none";
				document.getElementById('Paso1').style.display = "none";
				document.getElementById('Paso4').style.display = "none";
				document.getElementById('Paso2').style.display = "block";
			}
			if(A==3)
			{	document.getElementById('Paso1').style.display = "none";
				document.getElementById('Paso2').style.display = "none";
				document.getElementById('Paso4').style.display = "none";
				document.getElementById('Paso3').style.display = "block";
			}
			if(A==4)
			{	document.form_trabaja1.submit(); }
		}
	catch (e) {  alert("ERROR .......IrA()");	}
}

/***/
function addFileInput(elem) {
if(false!=elem)
{
	filepath = elem.value.split("\\");
	filename = filepath[filepath.length-1];
					
	if(filename !="")
	{	extensionpath = filename.split(".");
		extension = extensionpath[extensionpath.length-1];
	 	if( !extension.match(/(doc)|(docx)/) )
		{
			alert("S\u00f3lo se permite subir archivos: word");
			document.getElementById('UlLinTra').style.display = "none";
			document.getElementById('UlLinTra2').style.display = "block";

		}
		else
		{	document.getElementById('UlLinTra').style.display = "block";
			document.getElementById('UlLinTra2').style.display = "none";
		}
	}
	else
	{	document.getElementById('UlLinTra').style.display = "block";
			document.getElementById('UlLinTra2').style.display = "none";
	}
}
}
/***/

function validarDuracion()
{
	try { 
			tipo = document.form_trabaja1.cbo_TipoEmpleo.value;
			if(tipo=="Temporal")
				{ document.forms['form_trabaja1']['cbo_duracion'].value = '';
				  document.forms['form_trabaja1']['cbo_duracion'].disabled = false;	 }
			else if(tipo=="Permanente")
				{ document.forms['form_trabaja1']['cbo_duracion'].value = '';
				  document.forms['form_trabaja1']['cbo_duracion'].disabled = true;	 }
			else
				{ document.forms['form_trabaja1']['cbo_duracion'].value = '';
				  document.forms['form_trabaja1']['cbo_duracion'].disabled = true;	 }
							
		}
	catch (e) {  alert("ERROR .......validarDuracion()");	}
}

function validarPuesto()
{	if(jQuery("#cbo_AreaPost").val()=="Tienda"){
		jQuery("#cbo_Cargo").attr("disabled","");
	}
	else{
		jQuery("#cbo_Cargo").attr("disabled","disabled");
	}
}

function filtrar(a)
{	switch(a){
		case 1: jQuery(".conoces_alguien").css("display","");break; // razon social
		case 2: jQuery(".conoces_alguien").css("display","none");break;
		case 3: jQuery(".trabajo_antes").css("display","");break; // razon social
		case 4: jQuery(".trabajo_antes").css("display","none");break;
	}
}

function Contar(entrada,salida,texto,caracteres)
{
  var entradaObj=getObject(entrada);
  var salidaObj=getObject(salida);
  var longitud=caracteres - entradaObj.value.length;
  if(longitud <= 0) {
    longitud=0;
    texto='<span class="disable">&nbsp;'+texto+'&nbsp;</span>';
    entradaObj.value=entradaObj.value.substr(0,caracteres);
  }
  salidaObj.innerHTML = texto.replace("{CHAR}",longitud); 
}


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


function cargaProv()
{ 	
	try {	
			Departamento = document.form_trabaja1.txt_Departamentos.value;
			ajax.consultar('bin/frame.php','Provincias','post','T=Provincias&Departamento='+Departamento,'NO');
			ajax.consultar('bin/frame.php','Distritos','post','T=Distritos&Provincia=','NO');
		}
	catch (e) {  alert("ERROR .......cargaProv()");	}
}


function cargaDist()
{ 	
	try {	
			Provincia = document.getElementById('txt_Provincias').value;
			ajax.consultar('bin/frame.php','Distritos','post','T=Distritos&Provincia='+Provincia,'NO');
		}
	catch (e) {  alert("ERROR .......cargaDist()");	}
}


function ValidarExisteEMAIL(EMAIL)
{
	try { 
	 	document.getElementById('Ya_es_Usuario').style.display = 'none';
		Error=0;
		EMAIL = EMAIL.replace(/^\s+|\s+$/g, "");
		longitud = EMAIL.length;
  		if(longitud<=4)
			{ 	document.getElementById('email_estado').value = '0';
			 	document.getElementById('email_estado_resp').innerHTML = 'El Email es muy corto.';
				document.getElementById('email_estado_resp').style.color = 'RED';
				Error++;
     		}
	  	if(/^[\w-\.]+\@[\w\.-]+\.[a-z]{2,4}$/.test(EMAIL))
			{}
		else
			{ 	document.getElementById('email_estado').value = '0';
			 	document.getElementById('email_estado_resp').innerHTML = 'El Email es incorrecto.';
				document.getElementById('email_estado_resp').style.color = 'RED';
				Error++;
     		}

		if(Error==0)
				{ 	document.getElementById('email_estado_resp').innerHTML = '';
					ajax.consultar('bin/frame.php','Ajax_EMAIL','post','T=ValidarExisteEmail&EMAIL='+EMAIL,'NO');
				}
		else
			{	
				for(i=0;i<document.form_trabaja1.elements.length;i++)
					{	if(document.form_trabaja1.elements[i].id != "txtDni" && document.form_trabaja1.elements[i].id != "dni_estado" &&
							document.form_trabaja1.elements[i].id != "txtemail" && document.form_trabaja1.elements[i].id != "email_estado")
							{	document.form_trabaja1.elements[i].disabled = true;	}
					}
				document.getElementById('boton_Enviar').disabled = true;
			}
		}
	catch (e) {  alert("ERROR .......ValidarExisteEMAIL()");	}
}

function ValidarExisteEMAIL_ResultadoAjax(Respuesta)
{
	try { 
			if(Respuesta==0)
			{ 	document.getElementById('email_estado').value = '0';
			 	document.getElementById('Ya_es_Usuario').style.display = 'Block';
				for(i=0;i<document.form_trabaja1.elements.length;i++)
					{	if(document.form_trabaja1.elements[i].id != "txtDni" && document.form_trabaja1.elements[i].id != "dni_estado" &&
							document.form_trabaja1.elements[i].id != "txtemail" && document.form_trabaja1.elements[i].id != "email_estado")
							{	document.form_trabaja1.elements[i].disabled = true;	}
					}
				document.getElementById('boton_Enviar').disabled = true;
     		}
			
			if(Respuesta==1)
			{ 	document.getElementById('email_estado').value = '1';
			 	document.getElementById('Ya_es_Usuario').style.display = 'none';
			 	document.getElementById('email_estado_resp').innerHTML = 'Email Válido.';
				document.getElementById('email_estado_resp').style.color = 'GREEN';

				for(i=0;i<document.form_trabaja1.elements.length;i++)
					{	if(document.form_trabaja1.elements[i].id != "txtDni" && document.form_trabaja1.elements[i].id != "dni_estado" &&
							document.form_trabaja1.elements[i].id != "txtemail" && document.form_trabaja1.elements[i].id != "email_estado")
							{	document.form_trabaja1.elements[i].disabled = false;	}
					}
				document.getElementById('boton_Enviar').disabled = false;
				document.getElementById('txtnombre').focus();
     		}

		}
	catch (e) {  alert("ERROR .......ValidarExisteDNI_ResultadoAjax()");	}
}


function ValidarExisteDNI(DNI)
{	
	try { 
		Error=0;
		DNI = DNI.replace(/^\s+|\s+$/g, "");
		longitud = DNI.length;
			
  		if(longitud!=8)
			{ 	document.getElementById('dni_estado').value = '0';
			 	document.getElementById('dni_estado_resp').innerHTML = 'El DNI debe tener 8 n&uacute;meros.';
				document.getElementById('dni_estado_resp').style.color = 'RED';
			 	document.getElementById('Ya_es_User').style.display = 'none';
				Error++;
     		}
	  	if(isNaN(DNI))
			{ 	document.getElementById('dni_estado').value = '0';
			 	document.getElementById('dni_estado_resp').innerHTML = 'El DNI solo admite n&uacute;meros.';
				document.getElementById('dni_estado_resp').style.color = 'RED';
			 	document.getElementById('Ya_es_User').style.display = 'none';
				Error++;
     		}
		if(DNI=="00000000" || DNI=="99999999")
			{ 	document.getElementById('dni_estado').value = '0';
			 	document.getElementById('dni_estado_resp').innerHTML = 'El DNI no es válido.';
				document.getElementById('dni_estado_resp').style.color = 'RED';
			 	document.getElementById('Ya_es_User').style.display = 'none';
				Error++;
     		}
				
		if(Error==0)
				{ 	document.getElementById('dni_estado_resp').innerHTML = '';
					ajax.consultar('bin/frame.php','Ajax_DNI','post','T=ValidarExisteDNI&DNI='+DNI,'NO'); }
		else
			{	for(i=0;i<document.form_trabaja1.elements.length;i++)
					{	if(document.form_trabaja1.elements[i].id != "txtDni" && document.form_trabaja1.elements[i].id != "dni_estado")
							{	document.form_trabaja1.elements[i].disabled = true;	}
					}
				document.getElementById('boton_Enviar').disabled = true;
			}
		}
	catch (e) {  alert("ERROR .......ValidarExisteDNI()");	}
}

function ValidarExisteDNI_ResultadoAjax(Respuesta)
{
	try { 

			if(Respuesta==0)
			{ 	document.getElementById('dni_estado').value = '0';
			 	//document.getElementById('txt_dniREG').value = document.getElementById('txtDni').value;
			 	document.getElementById('Ya_es_User').style.display = 'Block';
				document.getElementById('dni_estado_resp').style.color = 'RED';
				for(i=0;i<document.form_trabaja1.elements.length;i++)
					{	if(document.form_trabaja1.elements[i].id != "txtDni" && document.form_trabaja1.elements[i].id != "dni_estado")
							{	document.form_trabaja1.elements[i].disabled = true;	}
					}
				document.getElementById('boton_Enviar').disabled = true;
     		}
			
			if(Respuesta==1)
			{ 	document.getElementById('dni_estado').value = '1';
			 	document.getElementById('Ya_es_User').style.display = 'none';
			 	document.getElementById('dni_estado_resp').innerHTML = 'DNI Válido.';
				document.getElementById('dni_estado_resp').style.color = 'GREEN';
				document.getElementById('txtemail').disabled = false;
				document.getElementById('txtemail').focus();
			 	document.getElementById('Ya_es_User').style.display = 'none';
     		}

		}
	catch (e) {  alert("ERROR .......ValidarExisteDNI_ResultadoAjax()");	}
}


function Verificar_Contrasenea()
{
	try { 
			if(document.form_trabaja1.txtcontrasena.value.length <= 4)
				{
				 	document.getElementById('txtcontrasena3').value = '0';
			 		document.getElementById('contrasenea').innerHTML = 'La contraseña debe ser mayor de 4 digitos.';
					document.getElementById('contrasenea').style.color = 'RED';
					document.getElementById('boton_Enviar').disabled = true;
				}
			else { document.getElementById('contrasenea').innerHTML = '';
				   	document.getElementById('txtcontrasena3').value = '1';
   					document.getElementById('boton_Enviar').disabled = false;
				   }

			if(document.form_trabaja1.txtcontrasena2.value!="" &&(document.form_trabaja1.txtcontrasena.value != document.form_trabaja1.txtcontrasena2.value))
				{	document.getElementById('txtcontrasena3').value = '0';
			 		document.getElementById('Ver_contrasenea').innerHTML = 'La contraseña confirmada no concuerda.';
					document.getElementById('Ver_contrasenea').style.color = 'RED';
					document.getElementById('boton_Enviar').disabled = true;
     			}
			else { 	document.getElementById('Ver_contrasenea').innerHTML = '';
				   	document.getElementById('txtcontrasena3').value = '1';
			 		document.getElementById('Ver_contrasenea').innerHTML = '';
   					document.getElementById('boton_Enviar').disabled = false;
				   }
		}
	catch (e) {  alert("ERROR .......Verificar_Contrasenea()");	}
}

function Verificar_Contra()
{
	try { 
			if(document.form_trabaja1.txtcontrasena.value != document.form_trabaja1.txtcontrasena2.value)
				{	document.getElementById('txtcontrasena3').value = '0';
			 		document.getElementById('Ver_contrasenea').innerHTML = 'La contraseña confirmada no concuerda.';
					document.getElementById('Ver_contrasenea').style.color = 'RED';
					document.getElementById('boton_Enviar').disabled = true;
     			}
			else { 	document.getElementById('Ver_contrasenea').innerHTML = '';
				   	document.getElementById('txtcontrasena3').value = '1';
   					document.getElementById('boton_Enviar').disabled = false;
				   }
		}
	catch (e) {  alert("ERROR .......Verificar_Contra()");	}
}


function EnviarRegistroUserActualizar()
{
	try { 
			var a_fields = {
							 'txtnombre':{'l':'Nombre','r':true,'f':'alpha','t':'td_nombre'},
							 'txtpaterno':{'l':'Apellido paterno','r':true,'f':'alpha','t':'td_paterno'},
							 'txtmaterno':{'l':'Apellido materno','r':true,'f':'alpha','t':'td_materno'},
							 'txtemail':{'l':'Email','r':true,'f':'email','t':'td_mail'},
							 'txttelefono':{'l':'Tel\u00e9fono','r':true,'f':'Telefono','t':'td_telefono'},
 							 'cbo_dia':{'l':'D\u00eda','r':true,'f':'numeros','t':'td_fecha'},
 							 'cbo_mes':{'l':'Mes','r':true,'f':'numeros','t':'td_fecha'},
							 'cbo_anio':{'l':'A\u00f1o','r':true,'f':'numeros','t':'td_fecha'},
 							 'txt_Departamentos':{'l':'Departamento','r':true,'f':'numeros','t':'td_depart'},
 							 //'txt_Provincias':{'l':'Provincia','r':true,'f':'numeros','t':'td_prov'},
  							 'txtcontrasena':{'l':'Contrase\u00f1a','r':true,'f':'Obligatorio','t':'td_contra'}};

			var v = new validator('form_trabaja1', a_fields);
			if(v.exec())
			{ 
				document.getElementById('provincia_Valor').value = document.getElementById('txt_Provincias').value;
				document.getElementById('distrito_Valor').value = document.getElementById('txt_Distrito').value;
				document.form_trabaja1.submit(); 
			}
		}
	catch (e) {  alert("ERROR .......EnviarRegistroUserActualizar()");	}
}

function EnviarRegistroUser()
{
	try { 
			var a_fields = {
							 'txtnombre':{'l':'Nombre','r':true,'f':'alpha','t':'td_nombre'},
							 'txtpaterno':{'l':'Apellido paterno','r':true,'f':'alpha','t':'td_paterno'},
							 'txtmaterno':{'l':'Apellido materno','r':true,'f':'alpha','t':'td_materno'},
							 'txtemail':{'l':'Email','r':true,'f':'email','t':'td_mail'},
							 'txttelefono':{'l':'Tel\u00e9fono','r':true,'f':'Telefono','t':'td_telefono'},
 							 'cbo_dia':{'l':'D\u00eda','r':true,'f':'numeros','t':'td_fecha'},
 							 'cbo_mes':{'l':'Mes','r':true,'f':'numeros','t':'td_fecha'},
							 'cbo_anio':{'l':'A\u00f1o','r':true,'f':'numeros','t':'td_fecha'},
 							 'txt_Departamentos':{'l':'Departamento','r':true,'f':'numeros','t':'td_depart'},
 							 'txt_Provincias':{'l':'Provincia','r':true,'f':'numeros','t':'td_prov'},
  							 'txtcontrasena':{'l':'Contrase\u00f1a','r':true,'f':'Obligatorio','t':'td_contra'}};

			var v = new validator('form_trabaja1', a_fields);
			if(v.exec())
				{ 
					document.form_trabaja1.submit(); 
				}
		}
	catch (e) {  alert("ERROR .......EnviarRegistroUser()");	}
}


function CargarSubcat()
{ 	
	try {	
			CodCat=document.frmTiendaBusqueda.categoria.value;
			ajax.consultar('bin/frame.php','SubCategorias','post','T=SubCategorias&CodCat='+CodCat,'NO');
			ajax.consultar('bin/frame.php','grupo','post','T=Lineas&CodCat=0&Sub=0','NO');
		}
	catch (e) {  alert("ERROR .......CargarSubcat()");	}
}


function cargar_Lineas()
{ 	
	try {	
			Cat=document.frmTiendaBusqueda.categoria.value;
			Sub=document.frmTiendaBusqueda.subcategoria.value;
			ajax.consultar('bin/frame.php','grupo','post','T=Lineas&CodCat='+Cat+'&Sub='+Sub,'NO');
		}
	catch (e) {  alert("ERROR .......cargar_Lineas()");	}
}

