$(document).ready(function(){
	if( typeof $.prettyPhoto != 'undefined' ) $("#conteudo a[rel^=prettyPhoto]").prettyPhoto({theme:'light_square'});


	// locales
	$('#locales').each(
		function()
		{
			$(this).addClass( 'js' );
			$('li:not(.current)', this).hide();

			$('li.current', this).toggle(
				function() { $('li:not(.current)', $(this).parent() ).show(); },
				function() { $('li:not(.current)', $(this).parent() ).hide(); }
			);
		}
	);


	// sites do grupo
	$('#sites_do_grupo').each(
		function()
		{
			$(this).addClass( 'js' );
			$('li', this).hide();

			$('h2', this).toggle(
				function() { $('li', $(this).parent() ).show(); },
				function() { $('li', $(this).parent() ).hide(); }
			);
		}
	);

	// formulario de busca
	$('#buscaRapida').parseFormNoLabels();

});

//-------------ABAS--------------//
$(function(){
	$("div.contaba").hide();
	$("div.contaba:first").show();
	$("#abas input:first").addClass("selected");
	$("#abas input").click(function(){
		$("div.contaba").hide();
		$("#abas input").removeClass("selected");
		$(this).addClass("selected");

		$($(this).val()).show();
		//return false;
	});
});


(function ($) {
// PARSE FORM NO LABELS
$.fn.parseFormNoLabels = function() {
	return this.each(function(i){
	var f = $(this);
	f.addClass( 'parsed' );
	f.find( 'label' ).css( {'position':'absolute', 'cursor':'text', 'display':'block' });
	f.find( 'input[type=text], select' ).each( function(){ this.label=$('label[for='+this.id+']'); } );
	f.find( 'input[type=text], select' ).focus( function() { $(this.label).css('opacity','0.5'); } );
	f.find( 'input[type=text], select' ).blur( function() { $(this.label).css('opacity','1'); } );
	f.find( 'input[type=text], select' ).bind( 'keyup change', function() {
		if( $(this).val() ) $(this.label).css('display','none');
		else $(this.label).css('display','inline');
	} );
	});
};
})(jQuery);
