 pestaniasAJAX = function(enlaces,target,reiniciar) {

$('ul.'+enlaces+' li').each(function (){
			$(this).click(function (){
			var indice = $('ul.'+enlaces+' li').index(this);
			for(x=0;x<=$('ul.'+enlaces+' li').length;x++)
 			{
				if(x!=indice){		
				$('ul.'+enlaces+' li:eq('+x+')').removeClass('no_border')	
				$('ul.'+enlaces+' li a:eq('+x+')').removeClass('on')	
				}else{
				$('ul.'+enlaces+' li:eq('+x+')').addClass('no_border')	
				$('ul.'+enlaces+' li a:eq('+x+')').addClass('on')	
				}
			}
			$(target).block({
					message: '<div class="cargando_generico"><img src="../images/reloj_nomarqueslashoras.gif" width="39" height="40" alt="" />Cargando</div>',
					css: { border: '0', height: '100%' , width: '100%' } 
				});
				$.ajax({
				   type: "GET",
				   url: $(this).children('a').attr('href'),
				   success: function(msg){
				     var $frm = $(target);
					 $frm.html(msg);
					 $frm.unblock();
					 //EN algunos casos es necesario reinicializar las funciones 
					 //despues de cargar el ajax, esto se hace aquí	
						
											
						if(reiniciar==4){
						$("#capadecontrol_4").jFlow({
							slides: "#slides_4",
							controller: ".controlador_4", // must be class, use . sign
							slideWrapper : "#jFlowSlide_4", // must be id, use # sign
							selectedWrapper: "jFlowSelected_4",  // just pure text, no sign
							width: "250px",
							height: "95px",
							duration: 400,
							prev: ".flecha_izqui_4", // must be class, use . sign
							next: ".flecha_dere_4" // must be class, use . sign
							
						});	
						pestaniasAJAX('carrusel_4','.receptora_4');
						}
						if(reiniciar==5){
						 $("#capadecontrol_5").jFlow({
							slides: "#slides_5",
							controller: ".controlador_5", // must be class, use . sign
							slideWrapper : "#jFlowSlide_5", // must be id, use # sign
							selectedWrapper: "jFlowSelected_5",  // just pure text, no sign
							width: "550px",
							height: "145px",
							duration: 400,
							prev: ".flecha_izqui_5", // must be class, use . sign
							next: ".flecha_dere_5" // must be class, use . sign
							
						});		
						pestaniasAJAX('carrusel_5','.receptora_5');
						}
						$('.arrowright').each(function () {
							var altura=parseFloat($(this).prev().css('height'))*-1;
				      		$(this).css('margin-top',altura+'px') ;
							
				    	});		 	
						
				   }
				 });
			return false;
		});
	 });	
	}
