/* Javascripts do site */

/* ----- Ativa o MENU ----- */

$(function() {
	$('#nav').droppy();
	$('#id_rss').hover(function() {
		$(this).attr("src","_includes/imagens/ico/rss_ico2.jpg");
			}, function() {
		$(this).attr("src","_includes/imagens/ico/rss_ico3.jpg");
	});
});

/* ----- INVERTER DIV ----- */

function inverte (id)
{
	if (document.getElementById(id).style.display == '')
	{
		document.getElementById(id).style.display = 'none';
		document.getElementById('img_'+id).src = 'imagens/ico/seta_right.gif';
	}
	else
	{
		document.getElementById(id).style.display = ''
		document.getElementById('img_'+id).src = 'imagens/ico/seta_down.gif';
	}
}

/* ----- Mostra se esta fechada e fecha se está aberta ----- */
function acao_chamada (acao, id)
{
	if (acao == 'entro')
	{
		$("#box_chamada_"+id).css({border: '1px dotted #FFCCFF', background: '#EFEEE7'});
		$("#box_chamada_info_"+id).show("");
	}
	else
	{
		$("#box_chamada_"+id).css({backgroundColor: '', border: ''});
		$("#box_chamada_info_"+id).hide("");			
	}
}

function troca_mesma_div (id)
{
	if ($(id).css("visibility") == "hidden")
	{
		$("#"+id).show("slow");
	}
	else
	{
		$("#"+id).hide("slow");
	}
	if (document.getElementById(id).style.display == 'none')
	{
		$("#"+id).show("slow");
	}
}

/* ----- Troca div por outra ----- */

function troca_div (id, id_outra)
{
	$('#'+id).hide('slow');
	$('#'+id_outra).show('slow');
}

/* ----- Jump Menu ----- */

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

/* ----- Selecionar todos os Checkbox ----- */

jQuery(document).ready(function(){
	jQuery(".sel_all").click( function() {
		jQuery("#" + jQuery(this).attr('rel') + " INPUT[type='checkbox']").each( function() {
			jQuery(this).attr('checked', !jQuery(this).attr('checked'));
		});
		return false;
	});
});

/* ----- Galeria ----- */

$(function() 
{	
    $('img.image1').data('ad-desc', 'Whoa! This description is set through elm.data("ad-desc") instead of using the longdesc attribute.<br>And it contains <strong>H</strong>ow <strong>T</strong>o <strong>M</strong>eet <strong>L</strong>adies... <em>What?</em> That aint what HTML stands for? Man...');
    $('img.image1').data('ad-title', 'Title through $.data');
    $('img.image4').data('ad-desc', 'This image is wider than the wrapper, so it has been scaled down');
    $('img.image5').data('ad-desc', 'This image is higher than the wrapper, so it has been scaled down');
    var galleries = $('.ad-gallery').adGallery();
    $('#switch-effect').change(
      function() {
        galleries[0].settings.effect = $(this).val();
        return false;
      }
    );
    $('#toggle-slideshow').click(
      function() {
        galleries[0].slideshow.toggle();
        return false;
      }
    );
    $('#toggle-description').click(
      function() {
        if(!galleries[0].settings.description_wrapper) {
          galleries[0].settings.description_wrapper = $('#descriptions');
        } else {
          galleries[0].settings.description_wrapper = false;
        }
        return false;
      }
    );
});

/* ----- / Galeria ----- */
