
var termUsoCargados = false;

$(function() {
	document.f.has_javascript.value = 1;	
	
	$( "#navModulos li a" ).bind( "click", function(event, ui) {
  		$( "#navModulos li" ).removeClass('active');
  		$(this).closest('li').addClass('active');
  		
  		var $this = $(this);
  		$(".contCarruselModulo a.browse").hide();
  		$( "#c_"+modActivo ).slideUp('fast',function(){ modActivo = $this.closest('li').attr('id');$( "#c_"+modActivo ).find(".carruselModulo").scrollable().pause();$( "#c_"+modActivo ).slideDown('slow',function(){$(".contCarruselModulo a.browse").show();$( "#c_"+modActivo ).find(".carruselModulo").scrollable().play();}); });
	});
	
	
	$("#navModulos li").hide();
	                        
	fadeLI($("#navModulos li:first"));
	
	$("#entrar").click(function(event){
		event.preventDefault();
		if($("#acepta_privacidad:checked").length == 0){
			// $("#error_privacidad").slideDown();
			bloqueaWindow();
			alertaWin("Debe aceptar los Terminos de Uso!!!");
		}else{
			document.f.submit();
		}
	
	});
	
	
	$( "#privBT" ).click(function() {
			if(!termUsoCargados){
			$.ajax({
				type: "POST",
				url: 'ctrl_home.php',
				dataType: 'html',
				data: {accion:'getTerminosUso'},
				success: function(result, textStatus, XMLHttpRequest) {
					termUsoCargados = true;
					$('#contTermUso').html(result);
					$( "#contTermUso" ).dialog({
						modal: true,
						width:800,
						height:600,
						buttons: {
							Ok: function() {
								$('#acepta_privacidad').attr('checked', true);
								$( this ).dialog( "close" );
							}
						}
					});
				}
			}); 
			}else{
				$( "#contTermUso" ).dialog( );
			}
			return false;
		});
		
		
		//$(".carruselModulo").scrollable().navigator();
		$(".carruselModulo").scrollable({circular: true, mousewheel: true}).navigator().autoscroll({interval: 4000, autoplay: false});
		
		$( ".navi" ).css('width',function(index) {
 			 return $(this).children().length * 24;
		});
	
		$( "#c_"+modActivo ).find(".carruselModulo").scrollable().play();
});


	
