
	function _nnEventTrack(_nnClickURL)
	{
		var _nnCI = "es-universia";
		var _nnCG = "0";
		var _nnCC = "us"; /* country code */
		var _nnLP = location.protocol.indexOf('https')>-1?'https:':'http:';
		var _nnRP = escape(window.location);
		var _nnND = _nnLP + '//secure-' + _nnCC + '.imrworldwide.com/';
		var _nnPixel = new Image(1,1);
		var _nnParams = "rnd=" + (new Date()).getTime() + "&ci=" + _nnCI + "&cg=" + _nnCG;
		_nnParams += "&si=" + escape(_nnClickURL) + "&rp=" + _nnRP;
		_nnPixel.src = _nnND + "cgi-bin/m?" + _nnParams;
	}

	function nielsen_track_ajax(recurso) {
		/*START Nielsen//NetRatings Event Tracking function */
		//_nnEventTrack("http://"+window.location.host+"/"+datos);
		_nnEventTrack(recurso);
		/*END Nielsen//NetRatings Event Tracking function*/
	}

	function contador(actualizador, anyo, mes, dia, hora, minuto, segundo){
		var fecha_evento 	= new Date (anyo, mes, dia, hora, minuto, segundo);
		var fecha_completa 	= new Date();
		var fecha_actual 	= new Date(fecha_completa.getFullYear(),fecha_completa.getMonth()+1,fecha_completa.getDate(), fecha_completa.getHours(),fecha_completa.getMinutes(),fecha_completa.getSeconds());
	
		var fecha_restante 	= fecha_evento.getTime() - fecha_actual.getTime();
			
		if (fecha_restante	 > 0){
			var segundos 	= Math.round(fecha_restante/1000);
			var minutos 	= Math.floor(segundos/60);
			var segundos_s 	= segundos%60;
			var horas 		= Math.floor(minutos/60);
			var minutos_s 	= minutos%60;
			var dias 		= Math.floor(horas/24);
			var horas_s 	= horas%24;
			
			document.getElementById('faltan_dia').innerHTML 	= dias;// + " días";
			document.getElementById('faltan_hora').innerHTML 	= horas_s;// + " horas";
			document.getElementById('faltan_min').innerHTML 	= minutos_s;// + " minutos";
			document.getElementById('faltan_seg').innerHTML 	= segundos_s;// + " segundos";
			
			setTimeout("contador("+actualizador+","+anyo+","+mes+","+dia+","+hora+","+minuto+","+segundo+")", actualizador);
		}else {
			document.getElementById('faltan_dia').innerHTML 	= "0";
			document.getElementById('faltan_hora').innerHTML 	= "0";;
			document.getElementById('faltan_min').innerHTML 	= "0";
			document.getElementById('faltan_seg').innerHTML 	= "0";
			
			return true;
		}
	}
	
	function seleccionarItem(objeto, valor){
		for(i=0; i<objeto.length; i++){
			if(objeto.options[i].value==valor){
				objeto.options[i].selected=true;
			}
		}
	}
	
	function comentarios_mensaje_loading(){
		if(document.getElementById("comentarios_paginacion")) document.getElementById("comentarios_paginacion").style.display = "none";
	}
	
	function comentarios_mensaje_complete(recurso){
		if(document.getElementById("comentarios_paginacion")) document.getElementById("comentarios_paginacion").style.display = "block";
		
		nielsen_track_ajax("http://carrera.universia.edu.pe/comentario_sending");
	}
	
	function enviar_ficha_loading()
	{
		document.getElementById('enviar_ficha').innerHTML 	= "<strong>enviando la ficha de inscripción...</strong>";
	}
	
	function enviar_ficha_complete()
	{
		document.getElementById('enviar_ficha').innerHTML 	= "<strong>ficha de inscripción enviada...</strong>";
	}

	function comentario_enviar_loading(objname)
	{
		document.getElementById('comentario_envio_enviar').style.display = "none";
		document.getElementById('comentario_envio_loading').style.display = "";
		document.getElementById('comentario_envio_complete').style.display = "none";
	}
	
	function comentario_enviar_complete(recurso)
	{
		document.getElementById('comentario_envio_enviar').style.display = "";
		document.getElementById('comentario_envio_loading').style.display = "none";
		document.getElementById('comentario_envio_complete').style.display = "";
		
		document.getElementById('ComentarioDeNombre').value = '';
		document.getElementById('ComentarioDeCorreo').value = '';
		document.getElementById('ComentarioComentario').value = '';
		
		nielsen_track_ajax("http://carrera.universia.edu.pe/comentario_paging");
	}
	
	function bases_carrera(){
		nielsen_track_ajax("http://carrera.universia.edu.pe/bases");
		//document.location.href = '/img/Bases_Carrera _2009.pdf';
		bases = window.open('/img/Bases_Carrera_2009.pdf','_blank','');
	}
	
	function categoria_datos(){
		if(document.getElementById('ParticipanteCategoria').selectedIndex == 1){
			document.getElementById('universidad').style.display = "";
			
			document.getElementById('tipo_pago').style.display = "none";
			//document.getElementById('documento').style.display = "none";
			//document.getElementById('carnet').innerHTML 	= "<strong>CARNET UNIVERSITARIO</strong>:";
		}else{
			document.getElementById('universidad').style.display = "none";
			
			document.getElementById('tipo_pago').style.display = "";
			//document.getElementById('documento').style.display = "";
			//document.getElementById('carnet').innerHTML 	= "<strong>NRO DOCUMENTO</strong>:";
		}
		validar_fecha();
	}
	
	function validar_fecha(){
		var edad_calculada = calcular_edad();
		if(edad_calculada ==  false){
			//alert('false pe');
		}else{
			var categoria = document.getElementById('ParticipanteCategoria').options[document.getElementById('ParticipanteCategoria').selectedIndex].value;
			
			if(categoria==1 && edad_calculada<14){
				alert('Su edad no corresponde a ninguna categoria de la carrera');
				document.getElementById('ParticipanteCategoria').selectedIndex=0;
				document.getElementById('ParticipanteCategoria').focus();
				return false;
			}
			
			if(categoria==2 || categoria==3 || categoria==4){
				if(edad_calculada<14){
					alert('Su edad no corresponde a ninguna categoria de la carrera');
					document.getElementById('ParticipanteCategoria').selectedIndex=0;
					document.getElementById('ParticipanteCategoria').focus();
					return false;
				}else if(edad_calculada>34 && categoria==2){
					alert('Su edad no corresponde a la categoria seleccionada');
					document.getElementById('ParticipanteCategoria').selectedIndex=0;
					document.getElementById('ParticipanteCategoria').focus();
					return false;
				}else if(edad_calculada<35 && (categoria==3 || categoria==4)){
					alert('Su edad no corresponde a la categoria seleccionada');
					document.getElementById('ParticipanteCategoria').selectedIndex=0;
					document.getElementById('ParticipanteCategoria').focus();
					return false;
				}else if(edad_calculada>54 && (categoria==2 || categoria==3)){
					alert('Su edad no corresponde a la categoria seleccionada');
					document.getElementById('ParticipanteCategoria').selectedIndex=0;
					document.getElementById('ParticipanteCategoria').focus();
					return false;
				}else if(edad_calculada<55 && (categoria==4)){
					alert('Su edad no corresponde a la categoria seleccionada');
					document.getElementById('ParticipanteCategoria').selectedIndex=0;
					document.getElementById('ParticipanteCategoria').focus();
					return false;
				}
			}
			
			if(edad_calculada<18){
				var option = document.createElement('option');
				option.text = "Menor de edad";
				option.value = "3";
				var elSel = document.getElementById('ParticipanteTipodocumento');
				try {
					elSel.add(option, null); // standards compliant; doesn't work in IE
				}
				catch(ex) {
					elSel.add(option); // IE only
				}
				document.getElementById('ParticipanteTipodocumento').selectedIndex=2;
				document.getElementById('ParticipanteNumerodocumento').value="Sin documento";
				document.getElementById('documento_nro').style.display = "none";
				document.getElementById('documento_tipo').style.display = "none";
				
				document.getElementById('tipo_pago').style.display = "none";
			}else{
				var elSel = document.getElementById('ParticipanteTipodocumento');
				if (elSel.length > 2){
					elSel.remove(elSel.length - 1);
				}
				document.getElementById('ParticipanteNumerodocumento').value="";
				document.getElementById('documento_nro').style.display = "";
				document.getElementById('documento_tipo').style.display = "";
				
				if(document.getElementById('ParticipanteCategoria').selectedIndex == 1){
					document.getElementById('tipo_pago').style.display = "none";
				}else{
					document.getElementById('tipo_pago').style.display = "";
				}
				
			}
		}
	}

	function calcular_edad(){
    	if(document.getElementById('ParticipanteNacimientoDia').selectedIndex!=0){
    		var dia = parseInt(document.getElementById('ParticipanteNacimientoDia').options[document.getElementById('ParticipanteNacimientoDia').selectedIndex].value, 10);
    	}else{
    		return false;
    	}
		if(document.getElementById('ParticipanteNacimientoMes').selectedIndex!=0){
			var mes = parseInt(document.getElementById('ParticipanteNacimientoMes').options[document.getElementById('ParticipanteNacimientoMes').selectedIndex].value, 10);
		}else{
    		return false;
    	}
    	if(document.getElementById('ParticipanteNacimientoAnyo').selectedIndex!=0){
			var anyo = document.getElementById('ParticipanteNacimientoAnyo').options[document.getElementById('ParticipanteNacimientoAnyo').selectedIndex].value;
		}else{
    		return false;
    	}
    	
		var hoy=new Date();
		//resto los años de las dos fechas
    	//edad = hoy.getUTCFullYear()- anyo - 1; //-1 porque no se si ha cumplido años ya este año
		edad = hoy.getUTCFullYear()- anyo - 1;
		
    	//si resto los meses y me da menor que 0 entonces no ha cumplido años. Si da mayor si ha cumplido
    	//if (hoy.getUTCMonth() + 1 - mes < 0) //+ 1 porque los meses empiezan en 0
    	if (10 - mes < 0) //+ 1 porque los meses empiezan en 0
       		return edad;
    	//if (hoy.getUTCMonth() + 1 - mes > 0)
    	if (10 - mes > 0)
			return edad+1;

    	//entonces es que eran iguales. miro los dias
    	//si resto los dias y me da menor que 0 entonces no ha cumplido años. Si da mayor o igual si ha cumplido
    	//if (hoy.getUTCDate() - dia >= 0)
    	if (10 - dia >= 0)
    		return edad + 1;
	
    	return edad;
	} 
	
	function tipo_pago(){
		if(document.getElementById('ParticipanteCategoria').selectedIndex == 1){
			document.getElementById('tipo_pago').style.display = "none";
		}else{
			document.getElementById('tipo_pago').style.display = "";
		}
	}
	