/*******************************************/
/*************** IMPRIMIR ******************/
/*******************************************/
$(".imprimir").click(function(){
	window.print();
	
	return false;
});


/*******************************************/
/*********** EQUAL COL HEIGHT **************/
/*******************************************/
(function( $ ){
	$.fn.equalHeight = function(options) {
		var settings = {
			'ncols': '3'
	    };

		if ( options ) { 
	        $.extend( settings, options );
	    }

		this.each(function(){
			var currentHeight=0, i=0, tallest=0, j=0, nrows=0, nelements=0;
			
			nelements =$(this).find('.element').size();
			
			nrows =  Math.ceil(nelements / settings.ncols);
			
			for(j=0; j<=nrows; j++){
				tallest=0;
				
				for(k=0; k<settings.ncols; k++){
					currentHeight = $(this).find('.element').eq(k+(j*settings.ncols)).height();
					if(currentHeight>tallest) tallest=currentHeight;
					$(this).find('.element').eq(k+(j*settings.ncols)).addClass('fila-'+j);
				}
				
				$('.fila-'+j).height(tallest);
			}
			
		});
	};
})( jQuery );

/*******************************************/
/****************** TOOLTIP ****************/
/*******************************************/

$(function() {
	$("#icoHelp").mouseover(function(event) {
		$("#capaHelp").slideToggle();
	});
	$("#icoHelp").mouseout(function(event) {
		$("#capaHelp").slideToggle();
	});
	$("#icolote").mouseover(function(event) {
		$("#capalote").slideToggle();
	});
	$("#icolote").mouseout(function(event) {
		$("#capalote").slideToggle();
	});
	$("#icolote2").mouseover(function(event) {
		$("#capalote2").slideToggle();
	});
	$("#icolote2").mouseout(function(event) {
		$("#capalote2").slideToggle();
	});
	$("#icohelp").mouseover(function(event) {
		$("#capahelp").slideToggle();
	});
	$("#icohelp").mouseout(function(event) {
		$("#capahelp").slideToggle();
	});
	$("#icohelpzp").mouseover(function(event) {
		$("#capazp").slideToggle();
	});
	$("#icohelpzp").mouseout(function(event) {
		$("#capazp").slideToggle();
	});

});


$(document).ready(function(){
	/* Limpiar - Todos formularios y recordar valor inicial */
	    $('input[type="text"], textarea').focus(function() {
	        if (this.value == this.defaultValue){
	            this.value = '';
	        }
	        if(this.value != this.defaultValue){
	            this.select();
	        }
	    });
	    $('input[type="text"], textarea').blur(function() {
	        if ($.trim(this.value) == ''){
	            this.value = (this.defaultValue ? this.defaultValue : '');
	        }
	    });   
	});
