$(function(){
	$('.wrgallery_images').wrgallery({
		changeTime: 5000,
		speedTransition: 500,
		onStartChange: function(intIdNext, intIdPrev){
			$("#center-gallery #cortina a").attr('href',arrElementos[intIdNext].link);
			$("#center-gallery #cortina a .titulo").text(arrElementos[intIdNext].titulo);
			$("#center-gallery #cortina a .texto").text(arrElementos[intIdNext].texto);
		}
	});
	
	$(".wrgallery_images").mouseover(function(){
		if((bolCortinaAberta == false)){
			bolCortinaAberta = null;
			$("#cortina").animate({"margin-right":0},500,null,function(){
				bolCortinaAberta =  true;
				$(this).clearQueue();
			});
		}
	});
	
	
	var jFechaCortina1 = $("div.front-slideshow").children().not("div#center-gallery");
	var jFechaCortina2 = $("div#content").children().not("div.front-slideshow");
	var jFechaCortina3 = $("div#wrapper").children().not("div#content");
	
	jFechaCortina1.mouseover(function(){fecharCortina();});
	jFechaCortina2.mouseover(function(){fecharCortina();});
	jFechaCortina3.mouseover(function(){fecharCortina();});
});

var bolCortinaAberta = false;
function fecharCortina(){
	if(bolCortinaAberta == true){
		bolCortinaAberta = null;
		$("#cortina").animate({"margin-right":-234},500,function(){
			bolCortinaAberta = false;
			$(this).clearQueue();
		});
	}
}
