
$(document).ready(function() {
	
//	$("#nav-princ li").hover(
//			function(){ $("ul", this).fadeIn("fast"); }, 
//			function(){} 
//	);
//	
//	if (document.all) {
//		$(".menu-princ ul li").hoverClass("sfHover");
//	}

	//modifica links para abrir em nova aba
	$('a[rel*=external]').each(function(){
		$(this).attr('target','_blank');
	});
	
	$('a[rel*=facebox]').facebox({
		loading_image : base_url + 'scripts/facebox/loading.gif',
		close_image   : base_url + 'scripts/facebox/closelabel.gif'
	});
	
	$('#frmPesq').attr('target','_blank');
	
});


function pesquisar() {
	var texto = $('#q').val();
	if( texto == '' ) {
		alert('Por favor, informe o termo que deseja pesquisar.');
	} else {
		$("#frmPesq").submit();
	}
}

/**
 * JQuery Suckerfish
 * @see http://be.twixt.us/jquery/suckerFish.php
 */
//$.fn.hoverClass = function(c) {
//	return this.each(function(){
//		$(this).hover( 
//			function() { $(this).addClass(c);  },
//			function() { $(this).removeClass(c); }
//		);
//	});
//};
/**
 * @see http://www.catswhocode.com/blog/8-awesome-jquery-tips-and-tricks
 * $.preloadImages("image1.gif", "/path/to/image2.png", "some/image3.jpg");
 */
jQuery.preloadImages = function(){
	
	imagem = new Array(arguments.length);
	
	for(var x=0; x < arguments.length; x++ ) {
		imagem[x] = new Image();
		imagem[x].src = arguments[x]; 
	}
	
};

/**
 * Função para limpar o form
 */
$.fn.clearForm = function() {
  return this.each(function() {
    var type = this.type, tag = this.tagName.toLowerCase();
    if (tag == 'form')
      return $(':input',this).clearForm();
    if (type == 'text' || type == 'password' || tag == 'textarea')
      this.value = '';
    else if (type == 'checkbox' || type == 'radio')
      this.checked = false;
    else if (tag == 'select')
      this.selectedIndex = -1;
  });
};




