// JavaScript Document

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


(function($) {
	
jQuery.preloadImages = function() {
  for(var i=0; i<arguments.length; i++)   {
    jQuery("<img>").attr("src", arguments[i]);
  }
}
	// Preload de imagens
	$.preloadImages("img/bt_depo_outros_on.png","img/lightbox-ico-loading.gif");
	
	// fix for target="_blank"
	$("a[rel*='external']").click(function(){
		window.open($(this).attr("href"), 'janela','scrollbars=yes,resizable=yes,width=850,height=600');
		return false;
	});
	
	// Hollover de imagem
	$('.over').hover(
		function() { this.src = this.src.replace("_off","_on");  },
		function() {  this.src = this.src.replace("_on","_off"); }  
	)

/*
	$(".gallery a").each(function() {
		w=$(this).children("img").width();
		h=$(this).children("img").height();
		fl=$(this).children("img").css("float");
		m=$(this).children("img").css("margin");
		$(this).css({width: w, height: h, float: fl, margin: m});
	})
*/	
	// Lightbox
	if($('.gallery').length>0) {
		//$(".gallery a").append("<div class=\"ampliar\" title=\"Clique para ampliar\"></div>");
		$('.gallery a').lightBox();
	}
	
	// Legenda
	$("a[title~='?']").toggle(function() {
		$("#legenda").slideDown("medium");
	},function() {
		$("#legenda").slideUp("medium");
	});
	$("a[title~='close']").click(function() {
	  $("a[title~='?']").trigger('click');
	})
	
})(jQuery);


