function emailCheck(emailStr){
	//var eMail = true;
	var checkTLD=1;
	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom=validChars + '+';
	var word="(" + atom + "|" + quotedUser + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
	var matchArray=emailStr.match(emailPat);

	if (matchArray==null){
		//alert("Email address seems incorrect (check @ and .'s)");
		return false;
	}

	var user=matchArray[1];
	var domain=matchArray[2];

	for (i=0; i<user.length; i++){
		if (user.charCodeAt(i)>127){
			//alert("Ths username contains invalid characters.");
			return false;
   		}
	}
	
	for (i=0; i<domain.length; i++){
		if (domain.charCodeAt(i)>127){
			//alert("Ths domain name contains invalid characters.");
			return false;
   		}
	}

	if (user.match(userPat)==null){
		//alert("The username doesn't seem to be valid.");
		return false;
	}

	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null){
		for (var i=1;i<=4;i++){
			if (IPArray[i]>255){
				//alert("Destination IP address is invalid!");
				return false;
		   	}
		}
		return true;
	}

	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	
	for (i=0;i<len;i++){
		if (domArr[i].search(atomPat)==-1){
			//alert("The domain name does not seem to be valid.");
			return false;
   		}
	}

	if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1){
		//alert("The address must end in a well-known domain or two letter " + "country.");
		return false;
	}

	if (len<2){
		//alert("This address is missing a hostname!");
		return false;
	}

	return true;
}

function validarEmail(valor)
{
	var Email = true;
	
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor))
    	Email = false;

    return Email;
}

function Espacios(InputVal){
	var espacios = false;

   	if (InputVal.charAt(0) == " ")
    	espacios = true;

	return espacios;
}

var ERROR = "Por favor, verifica y corrije:\n";

function inpreset(OBJ_R)
{
	if((OBJ_R.className=="invalid" || OBJ_R.className=="invalid2") || (OBJ_R.value=="Ingrese correo-e" || OBJ_R.value=="REQUERIDO!!!" || OBJ_R.value=="INVALIDO!!!"))
	{
		OBJ_R.className=null;
		OBJ_R.value="";
	}
}

function validar_S()
{
	var EMAIL = document.getElementById("email");
	var ENVIAR = true;
	
	if(EMAIL.value=="" || EMAIL.value=="INVALIDO!!!" || EMAIL.value=="REQUERIDO!!!" || EMAIL.value=="Ingrese correo-e")
	{
		ENVIAR=false;
		EMAIL.className="invalid2";
		EMAIL.value="REQUERIDO!!!";
	} else
	if(EMAIL.value!="" && (EMAIL.value!="Ingrese correo-e" || EMAIL.value!="INVALIDO!!!" || EMAIL.value!="REQUERIDO!!!") && emailCheck(EMAIL.value)!=true)
	{
		ENVIAR=false;
		EMAIL.classname="invalid2";
		EMAIL.value="INVALIDO!!!";
	}
	
	if(ENVIAR)
		document.getElementById("suscripcion").submit();
}

function validar_C(){
	var NOMBRE = document.getElementById("nombre_apellido");
	var EMAIL = document.getElementById("correo_e");
	var MOTIVO = document.getElementById("motivo");
	var COMENTARIOS = document.getElementById("comentarios");
	var ENVIAR = true;
	//var ERROR = "Por favor, ingrese o corrija:\n";
	
	if(NOMBRE.value == null || NOMBRE.value == "" || NOMBRE.value == "Dato requerido!" || NOMBRE.value == "Dato invalido!"){
		ENVIAR = false;
		//ERROR += "\tNombre y Apellido\n";
		NOMBRE.value = "Dato requerido!";
		NOMBRE.className = "invalid";
	} else
	if((NOMBRE.value != null || NOMBRE.value != "") && Espacios(NOMBRE.value)){
		ENVIAR = false;
		//ERROR += "\tNombre y Apellido inv&#225;lido\n";
		NOMBRE.value = "Dato invalido!";
		NOMBRE.className = "invalid";
	}
	if(EMAIL.value == null || EMAIL.value == "" || EMAIL.value == "Dato requerido!" || EMAIL.value == "Dato invalido!"){
		ENVIAR = false;
		//ERROR += "\tCorreo-e\n";
		EMAIL.value = "Dato requerido!";
		EMAIL.className = "invalid";
	} else
	if((EMAIL.value != null || EMAIL.value != "") && emailCheck(EMAIL.value) != true){
		ENVIAR = false;
		//ERROR += "\tCorreo-e inv&#225;lido\n";
		EMAIL.value = "Dato invalido!";
		EMAIL.className = "invalid";
	}
	if(MOTIVO.value == null || MOTIVO.value == "" || MOTIVO.value == "Dato requerido!" || MOTIVO.value == "Dato invalido!"){
		ENVIAR = false;
		//ERROR += "\tMotivo\n";
		MOTIVO.value = "Dato requerido!";
		MOTIVO.className = "invalid";
	} else
	if((MOTIVO.value != null || MOTIVO.value != "") && Espacios(MOTIVO.value)){
		ENVIAR = false;
		//ERROR += "\tMotivo es inv&#225;lido\n";
		MOTIVO.value = "Dato invalido!";
		MOTIVO.className = "invalid";
	}
	if(COMENTARIOS.value == null || COMENTARIOS.value == "" || COMENTARIOS.value == "Dato requerido!" || COMENTARIOS.value == "Dato invalido!"){
		ENVIAR = false;
		//ERROR += "\tComentarios\n";
		COMENTARIOS.value = "Dato requerido!";
		COMENTARIOS.className = "invalid";
	} else
	if((COMENTARIOS.value != null || COMENTARIOS.value != "") && Espacios(COMENTARIOS.value)){
		ENVIAR = false;
		//ERROR += "\tComentarios es inv&#225;lido\n";
		COMENTARIOS.value = "Dato invalido!";
		COMENTARIOS.className = "invalid";
	}
	
	if(ENVIAR)
		document.getElementById("contact").submit();
		//else
		//alert(ERROR);
}
function irpag(ir, queryS, pag)
{	
	var tot_pag		= parseInt(pag);
	var num_pag		= document.getElementById('irnav').value;
	if(tot_pag>=num_pag)
	{
		Pag = document.getElementById(ir).value - 1;
		if(Pag >= 0)
		document.location = "index.php?paginaN="+Pag+queryS;
	}
}

function popup_galeria(url,a) 
{
	eve		= a;
	var width  = 800;
	var height = 580;
	var left   = (screen.width  - width)/2;
	var top    = (screen.height - height)/2;
	var params = 'width='+width+', height='+height;
	params += ', top='+top+', left='+left;
	params += ', directories=no';
	params += ', location=no';
	params += ', menubar=no';
	params += ', resizable=no';
	params += ', scrollbars=yes';
	params += ', status=no';
	params += ', toolbar=no';
	newwin=window.open(url+'?&C='+eve,this.target, params);
	
	if(window.focus)
	{
		newwin.focus()
	}
	
	return false;
}

function validarinpt(input)
{
	//alert(input)
	if(document.getElementById(input).value== '')
	{
		document.getElementById(input).value = 'REQUERIDO';
		document.getElementById(input).className = 'invalido';
		return 1;
	}
	if(document.getElementById(input).value == 'REQUERIDO' || document.getElementById(input).value == 'INVALIDO' || document.getElementById(input).value == 'null')
	{
		document.getElementById(input).value = 'INVALIDO';
		document.getElementById(input).className = 'invalido';
		return 1;
	}
	else
	{
		return 0;
	}
}

function ireset(OBJ_R)
{
	if(OBJ_R.value == "&#161;REQUERIDO!" || OBJ_R.value == "&#161;INVALIDO!" || OBJ_R.className == "invalido")
	{
		OBJ_R.className = null;
		OBJ_R.value = "";
	}
}
var nav4 = window.Event ? true : false;
function acceptNum(evt){	
	var key = nav4 ? evt.which : evt.keyCode;
	
	if(key <= 13 || key == 46 || (key >= 48 && key <= 57))
		return key;
	else{
		/*alert("Ingrese un valor num&#233;rico.");*/
		return false;
	}
}
function acceptNum2(evt){	
	var key = nav4 ? evt.which : evt.keyCode;
	
	if(key <= 13 || (key >= 48 && key <= 57))
		return key;
	else{
		/*alert("Ingrese un valor num&#233;rico.");*/
		return false;
	}
}
function ocultar(id)
{
	if(document.getElementById(id))
	{
		if(document.getElementById(id).style.display="block")
			document.getElementById(id).style.display="none";
	}
}
function mostrar(id)
{
	if(document.getElementById(id))
	{
		if(document.getElementById(id).style.display="none")
			document.getElementById(id).style.display="block";
	}
}
/*
function popup_galeria(url) 
{
	var width  = 800;
	var height = 500;
	var left   = (screen.width  - width)/2;
	var top    = (screen.height - height)/2;
	var params = 'width='+width+', height='+height;
	params += ', top='+top+', left='+left;
	params += ', directories=no';
	params += ', location=no';
	params += ', menubar=no';
	params += ', resizable=no';
	params += ', scrollbars=yes';
	params += ', status=no';
	params += ', toolbar=no';
	newwin=window.open(url,this.target, params);
	
	if(window.focus)
	{
		newwin.focus()
	}
	
	return false;
}
*/
function MostrarHome(valor)
{
	
		if(valor == 'home1')
		{
			document.getElementById('home1').style.display="block";
			document.getElementById('home2').style.display="none";
			document.getElementById('home3').style.display="none";
		}
		if(valor == 'home2')
		{
			document.getElementById('home1').style.display="none";
			document.getElementById('home2').style.display="block";
			document.getElementById('home3').style.display="none";
		}
		if(valor == 'home3')
		{
			document.getElementById('home1').style.display="none";
			document.getElementById('home2').style.display="none";
			document.getElementById('home3').style.display="block";
		}
}

function valueInput(id,text)
{
	var VALOR = document.getElementById(id).value;
	var TEXTO = text;
	if(VALOR.lenght >0)
		VALOR = "";
	else
		VALOR = text;
}

function checkedDiv(accion,id,value)
{
	var ID 		= document.getElementById(id);
	var VALUE = document.getElementById(value).value;
	
	if(accion == 'mostrar')
	{
		ID.style.display = "block";
	}
	else
	{
		VALUE = "";
		ID.style.display = "none";
	}
}

function showContacto2(span1,span2,span3)
{
	var NOM = document.getElementById("nom_ape_1");
	var DEP = document.getElementById("cont_dep_1");
	var CODPAIS = document.getElementById("cont_tel_cod_pais_1");
	var CODCIU = document.getElementById("cont_tel_cod_ciu_1");
	var NUM = document.getElementById("cont_tel_num_1");
	var EMAIL = document.getElementById("cont_email_1");
	var ERROR = "Disculpe, antes de agregar una nueva Persona Contacto, debe asegurarse de haber ingresado correctamente todos los datos de la Persona Contacto actual. Favor, verifique:\n"
	var AGREGAR = true;
	
	if(NOM.value == "")
	{
		AGREGAR = false;
		ERROR += "\tNombre Completo de la Persona Contacto\n";
		NOM.style.border = "1px solid #c00;"
	} else
	if(NOM.value != "" && Espacios(NOM.value))
	{
		AGREGAR = false;
		ERROR += "\tEvite colocar espacios en blanco al inicio del Nombre Completo de la Persona Contacto\n";
		NOM.style.border = "1px solid #c00;"
	}
	if(DEP.value == "")
	{
		AGREGAR = false;
		ERROR += "\tDepartamento de la Persona Contacto\n";
		DEP.style.border = "1px solid #c00;"
	} else
	if(DEP.value != "" && Espacios(DEP.value))
	{
		AGREGAR = false;
		ERROR += "\tEvite colocar espacios en blanco al inicio del Departamento de la Persona Contacto\n";
		DEP.style.border = "1px solid #c00;"
	}
	if(CODPAIS.value == "")
	{
		AGREGAR = false;
		ERROR += "\tC&#243;digo de Pa&#237;s del tel. de la Persona Contacto\n";
		CODPAIS.style.border = "1px solid #c00;"
	} else
	if(CODPAIS.value != "" && CODPAIS.value.lenght < 4)
	{
		AGREGAR = false;
		ERROR += "\tEl c&#243;digo de Pa&#237;s debe ser de al menos 4 d&#237;gitos\n";
		CODPAIS.style.border = "1px solid #c00;"
	}
	if(CODCIU.value == "")
	{
		AGREGAR = false;
		ERROR += "\tC&#243;digo de Ciudad del tel. de la Persona Contacto\n";
		CODCIU.style.border = "1px solid #c00;"
	} else
	if(CODCIU.value != "" && CODCIU.value.lenght < 3)
	{
		AGREGAR = false;
		ERROR += "\tEl c&#243;digo de Ciudad debe ser de al menos 3 d&#237;gitos\n";
		CODCIU.style.border = "1px solid #c00;"
	}
	if(NUM.value == "")
	{
		AGREGAR = false;
		ERROR += "\tN&#250;mero de tel. de la Persona Contacto\n";
		NUM.style.border = "1px solid #c00;"
	} else
	if(NUM.value != "" && NUM.value.lenght < 7)
	{
		AGREGAR = false;
		ERROR += "\tEl n&#250;mero de tel. debe ser de al menos 7 d&#237;gitos\n";
		NUM.style.border = "1px solid #c00;"
	}
	if(EMAIL.value == "")
	{
		AGREGAR = false;
		ERROR += "\tCorreo-e de la Persona Contacto\n";
		EMAIL.style.border = "1px solid #c00;"
	} else
	if(EMAIL.value != "" && emailCheck(EMAIL.value) != true)
	{
		AGREGAR = false;
		ERROR += "\tVerifique el correo-e de la Persona Contacto\n";
		EMAIL.style.border = "1px solid #c00;"
	}
	if(AGREGAR)
	{
		document.getElementById(span1).style.display = "none";
		document.getElementById(span2).style.display = "block";
		document.getElementById(span3).style.display = "block";
	}
	else
		alert(ERROR);
}

function showContacto3(span1,span2,span3)
{
	var NOM = document.getElementById("nom_ape_2");
	var DEP = document.getElementById("cont_dep_2");
	var CODPAIS = document.getElementById("cont_tel_cod_pais_2");
	var CODCIU = document.getElementById("cont_tel_cod_ciu_2");
	var NUM = document.getElementById("cont_tel_num_2");
	var EMAIL = document.getElementById("cont_email_2");
	var ERROR = "Disculpe, antes de agregar una nueva Persona Contacto, debe asegurarse de haber ingresado correctamente los datos de la Persona Contacto actual. Favor, verifique:\n"
	var AGREGAR = true;
	
	if(NOM.value == "")
	{
		AGREGAR = false;
		ERROR += "\tNombre Completo de la Persona Contacto\n";
		NOM.style.border = "1px solid #c00;"
	} else
	if(NOM.value != "" && Espacios(NOM.value))
	{
		AGREGAR = false;
		ERROR += "\tEvite colocar espacios en blanco al inicio del Nombre Completo de la Persona Contacto\n";
		NOM.style.border = "1px solid #c00;"
	}
	if(DEP.value != "" && Espacios(DEP.value))
	{
		AGREGAR = false;
		ERROR += "\tEvite colocar espacios en blanco al inicio del Departamento de la Persona Contacto\n";
		DEP.style.border = "1px solid #c00;"
	}
	if(CODPAIS.value != "" && CODPAIS.value.lenght < 4)
	{
		AGREGAR = false;
		ERROR += "\tEl c&#243;digo de Pa&#237;s debe ser de al menos 4 d&#237;gitos\n";
		CODPAIS.style.border = "1px solid #c00;"
	}
	if(CODCIU.value != "" && CODCIU.value.lenght < 3)
	{
		AGREGAR = false;
		ERROR += "\tEl c&#243;digo de Ciudad debe ser de al menos 3 d&#237;gitos\n";
		CODCIU.style.border = "1px solid #c00;"
	}
	if(NUM.value != "" && NUM.value.lenght < 7)
	{
		AGREGAR = false;
		ERROR += "\tEl n&#250;mero de tel. debe ser de al menos 7 d&#237;gitos\n";
		NUM.style.border = "1px solid #c00;"
	}
	if(EMAIL.value != "" && emailCheck(EMAIL.value) != true)
	{
		AGREGAR = false;
		ERROR += "\tVerifique el correo-e de la Persona Contacto\n";
		EMAIL.style.border = "1px solid #c00;"
	}
	if(AGREGAR)
	{
		document.getElementById(span1).style.display = "block";
		document.getElementById(span2).style.display = "none";
		document.getElementById(span3).style.display = "block";
	}
	else
		alert(ERROR);
}

function hideContacto2(span1,span2)
{
	if(document.getElementById("nom_ape_2").value != "")
		document.getElementById("nom_ape_2").value = "";
	if(document.getElementById("cont_dep_2").value != "")
		document.getElementById("cont_dep_2").value = "";
	if(document.getElementById("cont_tel_cod_pais_2").value != "")
		document.getElementById("cont_tel_cod_pais_2").value = "";
	if(document.getElementById("cont_tel_cod_ciu_2").value != "")
		document.getElementById("cont_tel_cod_ciu_2").value = "";
	if(document.getElementById("cont_tel_num_2").value != "")
		document.getElementById("cont_tel_num_2").value = "";
	if(document.getElementById("cont_email_2").value != "")
		document.getElementById("cont_email_2").value = "";
	
	document.getElementById(span1).style.display = "block";
	document.getElementById(span2).style.display = "none";
}

function hideContacto3(span1,span2)
{
	if(document.getElementById("nom_ape_3").value != "")
		document.getElementById("nom_ape_3").value = "";
	if(document.getElementById("cont_dep_3").value != "")
		document.getElementById("cont_dep_3").value = "";
	if(document.getElementById("cont_tel_cod_pais_3").value != "")
		document.getElementById("cont_tel_cod_pais_3").value = "";
	if(document.getElementById("cont_tel_cod_ciu_3").value != "")
		document.getElementById("cont_tel_cod_ciu_3").value = "";
	if(document.getElementById("cont_tel_num_3").value != "")
		document.getElementById("cont_tel_num_3").value = "";
	if(document.getElementById("cont_email_3").value != "")
		document.getElementById("cont_email_3").value = "";
	
	//alert(span2);
	document.getElementById(span2).style.display = "none";	
	if(document.getElementById("contactospan_2").style.display == "block")
		document.getElementById(span1).style.display = "block";
}

function imgRedim(imagen,size)
{
	var ANCHO = imagen.width;
	var ALTO = imagen.height;
	var VALOR = 1.25;
	var ANCHO_MAX = size;
	
	var RESULT = ANCHO/ALTO;
		
	if(RESULT!=VALOR)
	{
		if(ANCHO>ANCHO_MAX)
			imagen.width = ANCHO_MAX;
		//alert(imagen.width);
	}  
}

function boxchequeados(form,cantidad_minima)
{
	var sel			= 0;
	cantidad_minima = parseInt(cantidad_minima)
	
	if(form == 'prod_comparison')
	{
	
		for (i=0;i<document.prod_comparison.elements.length;i++) 
		{
			if(document.prod_comparison.elements[i].type == "checkbox")
			{
				if(document.prod_comparison.elements[i].checked == true)
					sel= (sel+1);
					
			}
		} 
	}
	
	if(form == 'carrito')
	{
	
		for (i=0;i<document.carrito.elements.length;i++) 
		{
			if(document.carrito.elements[i].type == "checkbox")
			{
				if(document.carrito.elements[i].checked == true)
					sel= (sel+1);
					
			}
		} 
	}
	//alert(sel)
	if(sel >= cantidad_minima)
		return true;
	else
	{
		alert('Estimado usuario, debes seleccionar al menos '+cantidad_minima+' productos o servicios para continuar.')
		return false;
	}
}

function show_ref(id)
{
	if(document.getElementById(id).style.visibility == "hidden")
	{
		document.getElementById(id).style.visibility = "visible";
	}
}

function hide_ref(id)
{
	if(document.getElementById(id).style.visibility == "visible")
	{
		document.getElementById(id).style.visibility = "hidden";
	}
}

function validar_R()
{
	var val 	= 0;
	var val1 	= validarinpt('email_usuario');
	var val2	= validarinpt('nombre_usuario');
	var val3	= validarinpt('apellidos_usuario');
	var val4	= 0; //Fecha de nacimiento: dia (n_dia)
	var val5	= 0; //Fecha de nacimiento: a&#241;o (n_ano);
	var val6	= 0;
	var val7	= 0;
	var val8	= 0;
	var val9	= 0;
	var val10 	= 0;
	//var val11	= validarinpt('movil_usuario');
	var val12	= 0;
	var val13	= 0;
	var val14	= 0;
	var val15	= 0;
	var val16	= 0;
	var val17	= 0;
	var val18	= 0;
	var val19	= 0; //Datos de contrase&#241;a
	//var val20 = validarinpt('movil_cod_pais');
	//var val21 = validarinpt('movil_cod_ciu');
	//var val22 = validarinpt('movil_num');
	var val23 = 0; //Departamento / Funcion
	var val24 = 0; //Cargo / Titulo
	var val25	= 0;
	var val26	= 0;
	
	// Personas Contacto
	//var val27 = 0; //Nombre1
	//var val28 = 0; //Departamento1
	//var val29 = 0; //Cod. Pais1
	//var val30 = 0; //Cod. Ciudad1
	//var val31 = 0; //Num. 1
	var val32 = 0; //Email1
	var val33 = 0; //Nombre2
	var val34 = 0; //Departamento2
	var val35 = 0; //Cod. Pais2
	var val36 = 0; //Cod. Ciudad2
	var val37 = 0; //Num. 2
	var val38 = 0; //Email2
	var val39 = 0; //Nombre3
	var val40 = 0; //Departamento3
	var val41 = 0; //Cod. Pais3
	var val42 = 0; //Num. 3
	var val43 = 0; //Email3
	var val44 = 0; //Cod. Ciudad3
	var val45 = 0; //Empresa
	var val46 = 0; //Descripcion de Empresa
	var	val47 = 0; //Nuevo Proceso de Tranformacion (nue_ram)
	var val48 = 0; //Nueva Subcateoria (nue_subcat)
	var val49 = 0; //Nueva categoria (nue_cat)
	
	/*
	if(document.getElementById('empresa').value == "Otro")
		var val46 = validarinpt('desc_emp'); //Perfil empresarial
	*/
	
	var error	= 'Por favor, verifica y corrije:\n';
	if(val1 == 1 || !validateEmail('email_usuario'))
	{
		error += 'Mi correo-e es invalido\n';
		document.getElementById('email_usuario').value = 'INVALIDO';
		document.getElementById('email_usuario').className = "invalido";
	}
		
	/*
	if(val1 == 0 && !validateEmail('email_usuario'))
	{
		val1 = 1;
		error += 'Mi correo-e es invalido\n';
		document.getElementById('email_usuario').value = 'INVALIDO';
		document.getElementById('email_usuario').className = "invalido";
	}
	*/
	
	var cla 		= document.getElementById('clave_usuario').value;
	var cla_conf 	= document.getElementById('conf_clave_usuario').value;
	
	if(cla == "")
	{
		val19 = 1;
		error += 'Contrase\u00f1a\n';
	} else
	if(cla != "" && cla.length < 6)
	{
		val19 = 1;	
		//error += '*El n\u00famero m\u00ednimo de caracteres para la clave y su confirmaci\u00f3n es de 6.\n';
		error += 'Contrase&\u00f1a debe contener 6 o mas caracteres\n';
	}
	if(cla_conf == "")
	{
		val19 = 1;
		error += 'Repite la contrase\u00f1a\n';
	} else
	if((cla != "" && cla_conf != "") && (cla != cla_conf))
	{
		val19 = 1;
		error += 'Las contrase\u00f1as ingresadas no coinciden\n';
	}
	
	if(document.getElementById('n_dia').value == 0)
	{
		val4 = 1;
		error += 'Fecha de nacimiento: d\u00eda\n';
	} else
	if(document.getElementById('n_mes').value == "02" && document.getElementById('n_dia').value > 29)
	{
		val4 = 1;
		error += 'Fecha de nacimiento: d\u00eda inv\u00e1lido\n';
	}
	
	if(document.getElementById('n_mes').value == 0)
	{
		val12 = 1;	
		error += 'Fecha de nacimiento: mes\n';
	}
	
	if(document.getElementById('n_ano').value == 0)
	{
		val15 = 1;	
		error += 'Fecha de nacimiento: a\u00f1o\n';
	}
	if(document.getElementById('usu_profesion').value == 0)
	{
		val14 = 1;
		error += 'Nivel educativo\n';
	}

if(document.getElementById('empresa').value == 0){val45 = 1;error += 'Empresa\n';document.getElementById('empresa').className = "invalido";}
else
	if(document.getElementById('empresa').value == 'Otro')
	{
		val46	 = validarinpt('desc_emp'); //Perfil empresarial
		val6	= validarinpt('emp_usuario');
		val7	= validarinpt('dir_emp_usuario');
		val8	= validarinpt('ciudad_emp_usuario');
		val9	= validarinpt('tel1_emp_usuario_cod_pais');
		val25	= validarinpt('tel1_emp_usuario_cod_ciu');
		val26	= validarinpt('tel1_emp_usuario_num');
		val10 	= validarinpt('email_emp_usuario');
		if(val10 == 1 || !validateEmail('email_emp_usuario'))
		{
			error += 'Correo-e de nueva empresa es inv\u00e1lido\n';
			document.getElementById('email_emp_usuario').value = 'INVALIDO';
			document.getElementById('email_emp_usuario').className = "invalido";
		}
		if(document.getElementById('pais_emp_usuario').value == 0)
		{
			val13 = 1;
			error += 'Informaci\u00f3n de mi empresa: pa\u00eds\n';
		}
	}
	
	if(document.getElementById('dept_emp_usuario').value == "")
	{
		val23 = 1;
		error += 'Informaci\u00f3n de mi empresa: Departamento / Funci\u00f3n\n';
		document.getElementById('dept_emp_usuario').className = "invalido";
	}
	
	if(document.getElementById('cargo_emp_usuario').value == "")
	{
		val24 = 1;
		error += '*Su Cargo / T\u00edtulo\n';
		document.getElementById('cargo_emp_usuario').className = "invalido";
	}
	
	if(document.getElementById('emp_actividad').value == 0 && document.getElementById('empresa').value == 'Otro')
	{
		val15 = 1;
		error += '*S\u00fa actividad comercial.\n';
	}
	if(document.getElementById('nivel1'))
	{
		if(document.getElementById('nivel1').value == 0)
		{
			val16 = 1;
			error += '*El tipo de '+document.getElementById('hid_niv1').value+'.\n';
		}
	}
	if(document.getElementById('nivel2'))
	{
		if(document.getElementById('nivel2').value == 0)
		{
			val17 = 1;
			error += '*El tipo de '+document.getElementById('hid_niv2').value+'.\n';		
		}
	}
	if(document.getElementById('seccom').style.display == 'block')
	{
		if(document.getElementById('emp_sector').value == 0)
		{
			val18 = 1;
			error += '*El sector comercial.\n';		
		}
	}
	
	if(document.getElementById('dept_emp_usuario').value == "Otro")
	{
		val25 = validarinpt('nue_dep');
	}
	
	/*
	if(document.getElementById('new_dep').style.display == "block")
	{
		val25 = validarinpt('nue_dep');
		document.getElementById('nue_dep').className = "invalido";
	}
	*/
	
	if(document.getElementById('cargo_emp_usuario').value == "Otro")
	{
		val26 = validarinpt('nue_car');
	}
	
	/*
	if(document.getElementById('new_car').style.display == "block")
	{
		val26 = validarinpt('nue_car');
		document.getElementById('nue_car').className = "invalido";
	}
	*/
	
	if(document.getElementById('new_emp').style.display=="block")
	{
		/*val27 = validarinpt("nom_ape_1");
		val28 = validarinpt("cont_dep_1");
		val29 = validarinpt("cont_tel_cod_pais_1");
		val30 = validarinpt("cont_tel_cod_ciu_1");
		val31 = validarinpt("cont_tel_num_1");
		val32 = validarinpt("cont_email_1");*/
		
		/*
		var cemail_1 = document.getElementById("cont_email_1");
		
		if(cemail_1.value != "" && validateEmail('cont_email_1'))
		{
			val32 = 1;
			cemail_1.value = "INVALIDO";
			cemail_1.className = "invalido";
		}
		*/
		
		if(document.getElementById("contactospan_2").style.display == "block")
		{
			val33 = validarinpt("nom_ape_2");
			
			if(document.getElementById("cont_dep_2").value != "" && Espacios(document.getElementById("cont_dep_2").value))
			{
				val34 = 1;
				document.getElementById("cont_dep_2").value = "&#161;INVALIDO";
				document.getElementById("cont_dep_2").className = "invalido";
			}
			
			if(document.getElementById("cont_tel_cod_pais_2").value != "" && document.getElementById("cont_tel_cod_pais_2").value.lenght < 4)
			{
				val35 = 1;
				document.getElementById("cont_tel_cod_pais_2").value = "&#161;INVALIDO!";
				document.getElementById("cont_tel_cod_pais_2").className = "invalido";
			} else
			if(document.getElementById("cont_tel_cod_pais_2").value != "")
			{
				if(document.getElementById("cont_tel_cod_ciu_2").value == "")
				{
					val36 = 1;
					document.getElementById("cont_tel_cod_ciu_2").value = "&#161;REQUERIDO!";
					document.getElementById("cont_tel_cod_ciu_2").className = "invalido";
				}
				
				if(document.getElementById("cont_tel_num_2").value == "")
				{
					val37 = 1;
					document.getElementById("cont_tel_num_2").value = "&#161;REQUERIDO!";
					document.getElementById("cont_tel_num_2").className = "invalido";
				}
			}
			
			if(document.getElementById("cont_tel_cod_ciu_2").value != "" && document.getElementById("cont_tel_cod_ciu_2").value.lenght < 3)
			{
				val36 = 1;
				document.getElementById("cont_tel_cod_ciu_2").value = "&#161;INVALIDO!";
				document.getElementById("cont_tel_cod_ciu_2").className = "invalido";
			} else
			if(document.getElementById("cont_tel_cod_ciu_2").value != "")
			{
				if(document.getElementById("cont_tel_cod_pais_2").value == "")
				{
					val35 = 1;
					document.getElementById("cont_tel_cod_pais_2").value = "&#161;REQUERIDO!";
					document.getElementById("cont_tel_cod_pais_2").className = "invalido";
				}
			
				if(document.getElementById("cont_tel_num_2").value == "")
				{
					val37 = 1;
					document.getElementById("cont_tel_num_2").value = "&#161;REQUERIDO!";
					document.getElementById("cont_tel_num_2").className = "invalido";
				}
			}
			
			if(document.getElementById("cont_tel_num_2").value != "" && document.getElementById("cont_tel_num_2").value.lenght < 7)
			{
				val37 = 1;
				document.getElementById("cont_tel_num_2").value = "&#161;INVALIDO!";
				document.getElementById("cont_tel_num_2").className = "invalido";
			} else
			if(document.getElementById("cont_tel_num_2").value != "")
			{
				if(document.getElementById("cont_tel_cod_pais_2").value == "")
				{
					val35 = 1;
					document.getElementById("cont_tel_cod_pais_2").value = "&#161;REQUERIDO!";
					document.getElementById("cont_tel_cod_pais_2").className = "invalido";
				}
				
				if(document.getElementById("cont_tel_cod_ciu_2").value == "")
				{
					val36 = 1;
					document.getElementById("cont_tel_cod_ciu_2").value = "&#161;REQUERIDO!";
					document.getElementById("cont_tel_cod_ciu_2").className = "invalido";
				}
			}
		}
		
		if(document.getElementById("contactospan_3").style.display == "block")
		{
			val39 = validarinpt("nom_ape_3");
			
			if(document.getElementById("cont_dep_3").value != "" && Espacios(document.getElementById("cont_dep_3").value))
			{
				val40 = 1;
				document.getElementById("cont_dep_3").value = "&#161;INVALIDO";
				document.getElementById("cont_dep_3").className = "invalido";
			}
			
			if(document.getElementById("cont_tel_cod_pais_3").value != "" && document.getElementById("cont_tel_cod_pais_3").value.lenght < 4)
			{
				val41 = 1;
				document.getElementById("cont_tel_cod_pais_3").value = "&#161;INVALIDO!";
				document.getElementById("cont_tel_cod_pais_3").className = "invalido";
			} else
			if(document.getElementById("cont_tel_cod_pais_3").value != "")
			{
				if(document.getElementById("cont_tel_cod_ciu_3").value == "")
				{
					val44 = 1;
					document.getElementById("cont_tel_cod_ciu_3").value = "&#161;REQUERIDO!";
					document.getElementById("cont_tel_cod_ciu_3").className = "invalido";
				}
				
				if(document.getElementById("cont_tel_num_3").value == "")
				{
					val42 = 1;
					document.getElementById("cont_tel_num_3").value = "&#161;REQUERIDO!";
					document.getElementById("cont_tel_num_3").className = "invalido";
				}
			}
			
			if(document.getElementById("cont_tel_cod_ciu_3").value != "" && document.getElementById("cont_tel_cod_ciu_3").value.lenght < 3)
			{
				val44 = 1;
				document.getElementById("cont_tel_cod_ciu_3").value = "&#161;INVALIDO!";
				document.getElementById("cont_tel_cod_ciu_3").className = "invalido";
			} else
			if(document.getElementById("cont_tel_cod_ciu_3").value != "")
			{
				if(document.getElementById("cont_tel_cod_pais_3").value == "")
				{
					val41 = 1;
					document.getElementById("cont_tel_cod_pais_3").value = "&#161;REQUERIDO!";
					document.getElementById("cont_tel_cod_pais_3").className = "invalido";
				}
			
				if(document.getElementById("cont_tel_num_3").value == "")
				{
					val42 = 1;
					document.getElementById("cont_tel_num_3").value = "&#161;REQUERIDO!";
					document.getElementById("cont_tel_num_3").className = "invalido";
				}
			}
			
			if(document.getElementById("cont_tel_num_3").value != "" && document.getElementById("cont_tel_num_3").value.lenght < 7)
			{
				val42 = 1;
				document.getElementById("cont_tel_num_3").value = "&#161;INVALIDO!";
				document.getElementById("cont_tel_num_3").className = "invalido";
			} else
			if(document.getElementById("cont_tel_num_3").value != "")
			{
				if(document.getElementById("cont_tel_cod_pais_3").value == "")
				{
					val41 = 1;
					document.getElementById("cont_tel_cod_pais_3").value = "&#161;REQUERIDO!";
					document.getElementById("cont_tel_cod_pais_3").className = "invalido";
				}
				
				if(document.getElementById("cont_tel_cod_ciu_3").value == "")
				{
					val44 = 1;
					document.getElementById("cont_tel_cod_ciu_3").value = "&#161;REQUERIDO!";
					document.getElementById("cont_tel_cod_ciu_3").className = "invalido";
				}
			}
		}
	}
	
	if(document.getElementById('cont_email_1').value != "")
	{
		//alert(validateEmail('cont_email_1'));
		if(!validateEmail('cont_email_1'))
		{
			val32 = 1;
			error += 'Correo-e de Persona Contacto 1 es inv\00e1lido\n';
			document.getElementById('cont_email_1').value = 'INVALIDO';
			document.getElementById('cont_email_1').className = "invalido";
		}
	}	
	
	if(document.getElementById('cont_email_2').value != "")
	{
		if(!validateEmail('cont_email_2'))
		{
			val38 = 1;
			error += 'Correo-e de Persona Contacto 2 es inv\00e1lido\n';
			document.getElementById('cont_email_2').value = 'INVALIDO';
			document.getElementById('cont_email_2').className = "invalido";
		}
	}
	
	if(document.getElementById('cont_email_3').value != "")
	{
		if(!validateEmail('cont_email_3'))
		{
			val43 = 1;
			error += 'Correo-e de Persona Contacto 3 es inv\00e1lido\n';
			document.getElementById('cont_email_3').value = 'INVALIDO';
			document.getElementById('cont_email_3').className = "invalido";
		}
	}
	
	if(document.getElementById('new_ram').style.display == "block")
	{
		val47 = validarinpt('nue_ram');
	}
	if(document.getElementById('new_ram').style.display == "none")
	{
		document.getElementById('nue_ram').value='';
	}
	if(document.getElementById('new_subcat').style.display == "block")
	{
		val48 = validarinpt('nue_subcat');
	}
	if(document.getElementById('new_subcat').style.display == "none")
	{
		document.getElementById('nue_subcat').value='';
	}
	if(document.getElementById('new_cat').style.display == "block")
	{
		val49 = validarinpt('nue_cat');
	}
	if(document.getElementById('new_cat').style.display == "none")
	{
		document.getElementById('nue_cat').value='';
	}
		
	if(val1 == 0 && val2==0 && val3 == 0 && val4 == 0 && val5 == 0 && val6 == 0 && val7 == 0 && val8 == 0 && val9 == 0 && val10 == 0 && val12 == 0 && val13 == 0 && val14 == 0 && val15 == 0 && val16 == 0 && val17 == 0 && val18 == 0 && val19 == 0 && val23 == 0 && val24 == 0 && val25 == 0 && val26 == 0 && val32 == 0 && val33 == 0 && val34 == 0 && val35 == 0 && val36 == 0 && val37 == 0 && val38 == 0 && val39 == 0 && val40 == 0 && val41 == 0 && val42 == 0 && val43 == 0 && val44 == 0 && val45 == 0 && val46 == 0 && val47 == 0 && val48 == 0 && val49 == 0)
		document.getElementById('registro').submit();
	else
	{
		//alert("Error")
		//if(error != null)
			alert(error)
	}
	
		
}


function VerUbicacion()
{
//document.newevent.eve_mes.options[indice].value;
	var indice 	= document.registro.pais_emp_usuario.selectedIndex;
	var pais	= document.registro.pais_emp_usuario.options[indice].value;
	if(pais == 1)
	{
		document.getElementById('estado_venezuela').style.display = "block";
		document.getElementById('estado_emp_usuario2').value = null;
		document.getElementById('estado_general').style.display = "none";
	}
	else
	{
		document.getElementById('estado_venezuela').style.display = "none";
		document.getElementById('estado_general').style.display = "block";
	}
		
}

function validar_PO()
{
	var val1 = 0; //Departamento
	var val2 = validarinpt('ofe_tit'); //Titulo
	var val3 = validarinpt('ofe_des'); //Descripcion
	var val4 = validarinpt('ofe_sal'); //Salario
	var val5 = validarinpt('ofe_com'); //Comienzo
	var val6 = validarinpt('ofe_dur'); //Duracion
	var val7 = 0; //Tipo
	var val8 = validarinpt('ofe_cont'); //Contacto
	var val9 = validarinpt('ofe_cont_ema'); //Contacto
	var ERROR	= 'Por favor, verifica y corrije según el caso:\n';
	
	if(document.getElementById('ofe_dep').value == 0)
	{
		val1 = 1;
		ERROR += 'Selecciona Departamento\n';
		document.getElementById('ofe_dep').className = 'invalido';
	}
	
	if(!document.getElementById('ofe_tipo_1').checked && !document.getElementById('ofe_tipo_2').checked && !document.getElementById('ofe_tipo_3').checked && !document.getElementById('ofe_tipo_4').checked && !document.getElementById('ofe_tipo_5').checked && !document.getElementById('ofe_tipo_6').checked)
	{
		val7 = 1;
		ERROR += 'Selecciona al menos un Tipo de Empleo\n';
		document.getElementById('ofe_tipo_1').className = 'invalido';
		document.getElementById('ofe_tipo_2').className = 'invalido';
		document.getElementById('ofe_tipo_3').className = 'invalido';
		document.getElementById('ofe_tipo_4').className = 'invalido';
		document.getElementById('ofe_tipo_5').className = 'invalido';
		document.getElementById('ofe_tipo_6').className = 'invalido';
	}
	
	if(val9 == 0 && (validarEmail(document.getElementById('ofe_cont_ema').value) || Espacios(document.getElementById('ofe_cont_ema').value)))
	{
		val9 = 1;
		ERROR += 'Dirección de correo-e incorrecta\n';
		document.getElementById('ofe_cont_ema').className = 'invalido';
	}
	
	if(val1 == 0 && val2 == 0 && val3 == 0 && val4 == 0 && val5 == 0 && val6 == 0 && val7 == 0 && val8 == 0 && val9 == 0)
		document.getElementById('publicar_oferta').submit();
	else
		alert(ERROR);		
}

function validateEmail(email){
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = document.getElementById(email).value;
   if(reg.test(address) == false) {
      //alert('Invalid Email Address');
      return false;
   }
   else
   	return true;
}


	function publicidad(all_cat,seccion)
	{
		/**************************SECCIONES PUBLICITARIAS***************************************
		1 	= Home de Categorias
		2	= Home de SubCategoria
		3	= Resultados de Busquedas
		4	= Listado de Productos
		5	= Reporte Detallado de producto
		
		//***************************************************************************************/
	
		var titulo 				= 0;
		var desc				= 0;
		var url					= 0;
		var selseccion			= 0;
		var sel					= 0;
		var	selSCat				= Array();
		var catRef				= Array();
		var selProc				= Array();
		var SCatRef				= Array();
		var dimArray			= 0;
		var dimArrayProc		= 0;
		var aux_procesos		= 0;
		var aux_subcategorias 	= 0;
		var $auxseleccion 		= 0;
		var $auxseleccionProc	= 0;
		
		//***************VALIDACIONES DE SECCIONES PUBLICITARIAS*********************************
		if(seccion == 1)
		{
			for (var i=0;i<document.nueva_publicidad.elements.length;i++) 
			{
				
				if(document.nueva_publicidad.elements[i].type == "checkbox")
				{
					if(document.nueva_publicidad.elements[i].checked == true)
					{
						sel= (sel+1);
					}
						
				}			
			}
			if(sel<1)
				selseccion	= 1;
		}
		if(seccion == 2)
		{
			for (var i=0;i<document.nueva_publicidad.elements.length;i++) 
			{
				
				if(document.nueva_publicidad.elements[i].type == "checkbox")
				{
					if(document.nueva_publicidad.elements[i].checked == true)
					{
						sel= (sel+1);
					}
						
				}			
			}
			if(sel<1)
				selseccion	= 1;
				
			all_cat = all_cat.split("@")
				for (var i=0;i<document.nueva_publicidad.elements.length;i++) 
				{
					if(document.nueva_publicidad.elements[i].type == "checkbox")
					{
						for (var j=0;j<all_cat.length;j++)
						{
							if(document.nueva_publicidad.elements[i].name == "niv2"+all_cat[j]+"[]")
							{
								
								aux_subcategorias	= 1;
								selSCat[dimArray] 	= 0;
								catRef[dimArray]  	= all_cat[j];
								//alert("Dim"+dimArray)
								if(document.nueva_publicidad.elements[i].checked == true)
								{
									//alert('Chequeado 2')
									selSCat[dimArray] = 1;
								}
								dimArray++;
								
							}
						}
							
					}			
				}
				//alert('Aux Subcategorias '+aux_subcategorias)			
//*******************VALIDACION DE SUBCATEGORIAS**************************************************						
				if(aux_subcategorias == 1)
				{
					//alert("Dimension="+dimArray)
					for(var cont = 0; cont < dimArray; cont++)
					{
						//alert("Valor SC= "+selSCat[cont]+"Cat Ref="+catRef[cont])
						if(cont>1 && (catRef[cont] != catRef[cont-1]))
						{
							if($auxseleccion == 0)
								break;
							else
							{	
								$auxseleccion = 0;
								//alert('aqui1')
								if(selSCat[cont] == 1)
									$auxseleccion = 1;
							}
						}
						if(cont>0 && (catRef[cont] == catRef[cont-1]))
						{
							//$auxseleccion = 0;
							//alert('aqui2')
							if(selSCat[cont] == 1)
							{
								//alert('chequeado')
								$auxseleccion = 1;
							}
						}
						if(cont==0)
						{
							//alert('aqui3')
							if(selSCat[cont] == 1)
								$auxseleccion = 1;
						}
						//alert("Auxiliar="+$auxseleccion)
					}
					if($auxseleccion == 0)
						selseccion	= 1;
				}
				if(aux_subcategorias == 0)
					selseccion	= 1;
		}
		if(seccion == 3)
		{
			//*********************************************
			//NOTA: Esta seccion NO filtra por categorias	
			//*********************************************
		}
		if(seccion == 4 || seccion == 5)
		{
		
		
			for (i=0;i<document.nueva_publicidad.elements.length;i++) 
			{
				if(document.nueva_publicidad.elements[i].type == "checkbox")
				{
					if(document.nueva_publicidad.elements[i].checked == true)
						sel= (sel+1);
						
				}			
			}
			if(sel<1)
				selseccion	= 1;
			else
			{		
		
				var all_SCat	= null;
				for (i=0;i<document.nueva_publicidad.elements.length;i++) 
				{
					if(document.nueva_publicidad.elements[i].type == "hidden" && document.nueva_publicidad.elements[i].name == "allSCat")
					{
						//alert(document.nueva_publicidad.elements[i].value)
						all_SCat = document.nueva_publicidad.elements[i].value;
						all_SCat = all_SCat.split("@");
						//alert(all_SCat)
					}
					if(document.nueva_publicidad.elements[i].type == "checkbox")
					{
						if(all_SCat != null)
						{
							for (var j=0;j<all_SCat.length;j++)
							{
								if(document.nueva_publicidad.elements[i].name == "seleccion"+all_SCat[j]+"[]")
								{
									aux_procesos			= 1;
									selProc[dimArrayProc] 	= 0;
									SCatRef[dimArrayProc]  	= all_SCat[j];
									//dimArrayProc
									//selProc
								
									if(document.nueva_publicidad.elements[i].checked == true)
									{
										//alert('Chequeado 2')
										selProc[dimArrayProc] = 1;
									}
									dimArrayProc++;
								}
							}
						}
					}
				}
				//alert('Aux Procesos '+aux_procesos+" Sel "+sel)
				all_cat = all_cat.split("@")
				for (i=0;i<document.nueva_publicidad.elements.length;i++) 
				{
					if(document.nueva_publicidad.elements[i].type == "checkbox")
					{
						for (var j=0;j<all_cat.length;j++)
						{
							if(document.nueva_publicidad.elements[i].name == "niv2"+all_cat[j]+"[]")
							{
								
								aux_subcategorias	= 1;
								selSCat[dimArray] 	= 0;
								catRef[dimArray]  	= all_cat[j];
								//alert("Dim"+dimArray)
								if(document.nueva_publicidad.elements[i].checked == true)
								{
									//alert('Chequeado 2')
									selSCat[dimArray] = 1;
								}
								dimArray++;
								
							}
						}
							
					}			
				}
				//alert('Aux Subcategorias '+aux_subcategorias)			
//*******************VALIDACION DE SUBCATEGORIAS**************************************************						
				if(aux_subcategorias == 1)
				{
					//alert("Dimension="+dimArray)
					for(var cont = 0; cont < dimArray; cont++)
					{
						//alert("Valor SC= "+selSCat[cont]+"Cat Ref="+catRef[cont])
						if(cont>1 && (catRef[cont] != catRef[cont-1]))
						{
							if($auxseleccion == 0)
								break;
							else
							{	
								$auxseleccion = 0;
								//alert('aqui1')
								if(selSCat[cont] == 1)
									$auxseleccion = 1;
							}
						}
						if(cont>0 && (catRef[cont] == catRef[cont-1]))
						{
							//$auxseleccion = 0;
							//alert('aqui2')
							if(selSCat[cont] == 1)
							{
								//alert('chequeado')
								$auxseleccion = 1;
							}
						}
						if(cont==0)
						{
							//alert('aqui3')
							if(selSCat[cont] == 1)
								$auxseleccion = 1;
						}
						//alert("Auxiliar="+$auxseleccion)
					}
					if($auxseleccion == 0)
						selseccion	= 1;
				}
				
	//***********************************************************************************************		
//********************************************VALIDACION DE PROCESOS*****************************
	
				if(aux_procesos == 1)
				{
					//alert("Dimension="+dimArrayProc)
					for(var cont = 0; cont < dimArrayProc; cont++)
					{
					//alert("Valor Proc= "+selProc[cont]+"SCat Ref="+SCatRef[cont])
						if(cont>1 && (SCatRef[cont] != SCatRef[cont-1]))
						{
							if($auxseleccionProc == 0)
								break;
							else
							{	
								$auxseleccionProc = 0;
								//alert('aqui1')
								if(selProc[cont] == 1)
									$auxseleccionProc = 1;
							}
						}
						if(cont>0 && (SCatRef[cont] == SCatRef[cont-1]))
						{
							//$auxseleccionProc = 0;
							//alert('aqui2')
							if(selProc[cont] == 1)
							{
								//alert('chequeado')
								$auxseleccionProc = 1;
							}
						}
						if(cont==0)
						{
							//alert('aqui3')
							if(selProc[cont] == 1)
								$auxseleccionProc = 1;
						}
						//alert("Auxiliar="+$auxseleccionProc)
					}
					if($auxseleccionProc == 0)
						selseccion	= 1;
				}
			}

//***********************************************************************************************
				
				
		}
		
//*************************************************************************************************		
		if(document.getElementById('patrocinado_tit'))
			titulo = validarinpt('patrocinado_tit');
			
		if(document.getElementById('patrocinado_des'))
			desc = validarinpt('patrocinado_des');
			
		if(document.getElementById('patrocinado_url'))
		{
			url = validarinpt('patrocinado_url');
			
			if(document.getElementById('patrocinado_url').value=="Indique URL")
				url = 1;
		}
			
			
		if(document.getElementById('banner_url_span') && document.getElementById('banner_url_span').style.display=='block')
		{
			url = validarinpt('banner_url');
			
			if(document.getElementById('banner_url').value=="Indique URL")
				url = 1;
		}	
			
		if(titulo == 0 && desc == 0 && url == 0 && selseccion == 0)
		{
			return true;
		}
		else
		{
			document.getElementById('errores').style.display="block";
			var error	= 'Por favor, verifica y corrije:\n';

			if(selseccion == 1)
			{
				error += 'Selecciona al menos una (1) secci\u00f3n publicitaria de las casillas que corresponden con el nivel de visualizaci\u00f3n del anuncio.\n';
				document.getElementById('segmentacion').className = 'invalido';
			}
			
			if(titulo == 1)
			{
				error	+= 'T\u00edtulo\n';
				document.getElementById('patrocinado_tit').className = 'invalido';
			}
			if(desc == 1)
			{
				error	+= 'Descripci\u00f3n\n';
				document.getElementById('patrocinado_des').className = 'invalido';
				//document.getElementById('aviso_resultado_resumen').className="error";
			}
			if(url == 1)
			{
				error	+= 'Direcci\u00f3n Web\n';
				if(document.getElementById('patrocinado_url'))
				{
					document.getElementById('patrocinado_url').className = 'invalido';
				}
				if(document.getElementById('banner_url_span') && document.getElementById('banner_url_span').style.display=='block')
				{
					document.getElementById('banner_url').className = 'invalido';
				}
				//document.getElementById('aviso_resultado_url').className="error";
			}
			alert(error)
				
			return false;
		}
				
	}