	function ajax_Active_Layout(content){

	$("#tree li a, #contact,#news").click(function (e){
			e.preventDefault();
			var c_content='';
			var fields='';
			var a = e.target;
			var url_r = $(a).attr("href");
			$.ajax({
			  url: url_r+"&active_ajax=true",
			  context: document.body,
			  success: function(data){
				  //alert(data);
				 c_content = content.split(" ",1);
				 fields = content.split(" ");				 
			    $('.'+c_content).replaceWith(data);

				$('.'+c_content).fadeIn();
				if(fields[1]=='flexcroll'){
					//alert('flexcroll');
					//CSBfleXcroll(c_content);
					setTimeout(function() { fleXenv.initByClass(c_content); }, 1000);
					//setTimeout(function() { fleXenv.initByClass(c_content .' flexcroll'); }, 1000);
					//fleXenv.initByClass(c_content);

					//$('.'+c_content).fleXenv.updateScrollBars();
					//fleXenv.updateScrollBars();
					//$('.'+c_content).preventDefault();
					link(c_content);
				}
				//gallery_article();
				existGallery();
			  } 
			});				
		});
}
function link(content){
	if($(".link_section a").length > 0){
		$(".link_section a").click(function (e){
			e.preventDefault();
			//var a = e.target;
			//var url_r = $(a).attr("href");
			//alert($(this).attr("href"));
			// se comento las lineas anteriores porque no le reconocia el href.... le tomaba a la img
			var url_r = $(this).attr("href");
			$.ajax({
			  url: url_r+"&active_ajax=true",
			  context: document.body,
			  success: function(data){
			    $('.'+content).replaceWith(data);
				fleXenv.initByClass(content);
				//existGallery();
			  } 
			});
		});
	}
}
function existGallery(){
		if($(".gallery_article").length > 0){
			//$('.gallery_article img').lightBox();
			//mostramos la imagen maximizada
			$(".gallery_article img").fancybox({
					'transitionIn'		: 'none',
					'transitionOut'		: 'none',
					'titlePosition' 	: 'over',
					'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});
		}
}
function ajax_Gallery(content){
		$('a#gallery_art_previus').hide();
	// galleryActive_Ajax con esta variable controlamos que no se realicen 2 clicks
	var galleryActive_Ajax = false;
	var loadImages_Ajax = false;
	if($("#gallery_art_next").length > 0){
		var c_content = content.split(" ",1);
		var count=2;
		var count_img=1;
		var img=$("."+c_content+" img").length;
		var span=$("."+c_content+" span").length;
		$("#gallery_art_next").click(function (e){
			$('a#gallery_previus').show();
			var width_gal=$('.'+c_content+' img:first').width();
			//alert(content);
			if(!galleryActive_Ajax){
				elements=img+span;
				//alert(elements);
				galleryActive_Ajax = true;
				//alert($("."+c_content+" span").length);
				if(!loadImages_Ajax && $("."+c_content+" span").length!=''){
					//count_img=count;
					//alert(count);
					$("."+c_content+" #tmp_img"+count).replaceWith('<img src="'+$("."+c_content+" #tmp_img"+count).attr("title")+'" alt="" >');
					existGallery();
					//$("."+c_content+" img").css({"width": width_screen});
					//alert('reemplaza'+count);
					//$('.gallery_article img').lightBox();
					//existGallery();
					
				}
				//alert(count_img+'x'+count+'x'+elements);
				if(count_img==elements-1)	{
					//alert("end");
					count=0;
					count_img=0;
					loadImages_Ajax = true;
					$(".gallery_article").animate({left: "0px"}, "slow", function (){
						galleryActive_Ajax = false;
						has_class_first_gal_img();
					});
					
				}else{
					//alert("x"+width_gal+"X");
					$(".gallery_article").animate({"left": "-="+width_gal+"px"}, "slow", function (){galleryActive_Ajax = false;has_class_first_gal_img();
					});
					//$(".gallery_article").css({"left": "-"+width_gal});
					//has_class_first_gal_img();
				}
				count++;
				count_img++;
				has_class_first_gal_img();
			}
		});
	}
	if($("#gallery_art_previus").length > 0){
		$("#gallery_art_previus").click(function (e){
			var width_gal=$('.'+c_content+' img:first').width();//es necesario que este metodo se ecuentre dentro del click
			if(!galleryActive_Ajax && $(".gallery_article").css("left")!='0px'){
				//alert(width_gal);
				galleryActive_Ajax = true;
				$(".gallery_article").animate({"left": "+="+width_gal+"px"}, "slow", function (){
					galleryActive_Ajax = false;
					has_class_first_gal_img();
					count_img--;
				});
			}
			//has_class_first_gal_img();
			
		});
		
	}
	
}
function has_class_first_gal_img(){
	//alert($('.gallery_article').css("left"));
	if($('.gallery_article').css("left")=='0px'){
		$('a#gallery_art_previus').hide();
	  }else{
		  $('a#gallery_art_previus').show();
	  }
}
/*
function ajax_Gallery(content){
	var galleryActive_Ajax = false;
	var loadImages_Ajax = false;
	if($("#gallery_art_next").length > 0){
		var c_content = content.split(" ",1);
		var count=1;
		var count_img=1;
		var img=$("."+c_content+" img").length;
		var span=$("."+c_content+" span").length;
		$("#gallery_art_next").click(function (e){
			
			var width_gal=$('.'+c_content+' img:first').width();
			//alert(content);
			if(!galleryActive_Ajax){
				elements=img+span;
				//alert(elements);
				galleryActive_Ajax = true;
				if(!loadImages_Ajax && $("."+c_content+" span").length!=''){
					//count_img=count;
					$("."+c_content+" #tmp_img"+count).replaceWith('<img src="'+$("."+c_content+" #tmp_img"+count).attr("title")+'" alt="" >');
					//$("."+c_content+" img").css({"width": width_screen});
					//alert('reemplaza'+count);
					//$('.gallery_article img').lightBox();
					existGallery();
					
				}
				//alert(count_img+'x'+count+'x'+elements);
				if(count_img==elements)	{
					//alert("end");
					count=0;
					count_img=0;
					loadImages_Ajax = true;
					$(".gallery_article").animate({left: "0px"}, "slow", function (){galleryActive_Ajax = false;});
					
				}else{
					//alert("x"+width_gal+"X");
					$(".gallery_article").animate({"left": "-="+width_gal+"px"}, "slow", function (){galleryActive_Ajax = false;});
					//$(".gallery_article").css({"left": "-"+width_gal});
				}
				count++;
				count_img++;
			}
		});
	}
}
*/

