// JavaScript Document

/* ejemplo
$(function() {
$('#errorMessage').corners({
    radio: 8,
    inColor: '#FFCC66',
    outColor: '#D2FBAE',
    borderSize: 1,
    borderColor: '#0000FF'
});

 });

*/


//codigo del div redondeado
/*
$(function() {
	$('#errorMessage').corners({
    	radio: 9,
    	inColor: '#eeeeee',
    	//outColor: '#D2FBAE',
    	borderSize: 1,
    	borderColor: '#cccccc'
	});
});
*/

/*
//codigo de paginacion tambien funciona, pero sin historial
$(document).ready(function(){
   $("#divListadoHref a").each(function(){
      var href = $(this).attr("href");	  
	  $(this).click(function(){         
         $("#divListado").hide().load(href).fadeIn("slow"); // damos efecto
         $(this).attr({ href: "#"});		 
		 $("#divListadoHref a").attr({ style: "color:#4d6133"});		 
		 $(this).attr({ style: "color:#CC0000"});
			
      });
   });
});
*/

//codigo de historial y paginacion
$(function() {
	$('a.remote').remote('#divListado', function() {
		if (window.console && window.console.info) {
    		console.info('content loaded');
    	}
    });
	$.ajaxHistory.initialize();
});

$(document).ready(function(){
	$('#loading2').hide();

	$('#loading2').ajaxStart(function() {
			$(this).show();
		}).ajaxStop(function() {
			$(this).hide();
	});
$("#divListadoHref a").each(function(){
	$(this).click(function(){
		$("#divListadoHref a").attr({ style: "color:#4d6133"});		 
		$(this).attr({ style: "color:#CC0000"});		
		ancla = document.getElementById('iniList');
		window.scrollTo(0, ancla.offsetTop);		
	});
	
});
});


//********codigo de menu colapsable
$(function() {			
	var expand_link = "<img src='img/arbol/plus.gif' border=0 title='Ver subcategorias'/>";
	var contract_link = "<img src='img/arbol/minus.gif' border=0 />";
 
	var parent_LIs = $('#categoriasCollapse ul').parent(); //caching LIs with children
 
	parent_LIs.children('ul').toggle();//collapse all the child ULs
	parent_LIs.addClass('collapsible').prepend('<a href="#" class="expander">' + expand_link + '</a> ');
	//give the expander links an action
	parent_LIs.children('.expander').addClass('collapsed').click(function(){
  		$(this).parent().children('ul').toggle('slow');
  		$(this).toggleClass('collapsed');
  		//change link when expanded or toggled
  		$(this).hasClass('collapsed') ? $(this).html(expand_link) : $(this).html(contract_link);
	});
});


//********Autocomplete
jQuery(function() {
	jQuery("#idBuscar_txt").suggest("autocomplete/rpc.php",{
	onSelect: function() {
	
	}});
});



//****************Misma altura
jQuery.fn.vjustify=function() {
    var maxHeight=0;
    this.each(function(){
        if (this.offsetHeight>maxHeight) {maxHeight=this.offsetHeight;}
    });
    this.each(function(){
        $(this).height(maxHeight + "px");
        if (this.offsetHeight>maxHeight) {
            $(this).height((maxHeight-(this.offsetHeight-maxHeight))+"px");
        }
    });
};

$(function() {	
	$(".jqColumn").vjustify(); 
	$(".jqColumnPestana").vjustify(); 
});
	
	
$(function() {    
   $("#buscar_btn").click(function() {      
	  	var idBuscar_txt = $("input#idBuscar_txt").val();
   		//alert(idBuscar_txt.length);
		if(idBuscar_txt.length >= 2) return true;
		else { alert("Debe de buscar al menos tres caracteres"); return false; }
	});
});
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	