var $j = jQuery.noConflict();
$j('document').ready(function() 
{
	// ------------------------------------------------------------------------------------------
	// Shadows
	
	var option = {x: 1, y: 1, radius: 0, color:"#E4E4E4"}
	$j("#categoria").textShadow( option );
	
	
	
	// ------------------------------------------------------------------------------------------
	// SEARCHFORM HEADER
	
	$j("#s").focus(function()
	{  
		if(this.value == this.defaultValue)
		{  
			$j(this).removeClass("searchfield_inactive").addClass("searchfield_active");  
			this.value = ''; 
			
		}
	}); 
	
	$j("#s").blur(function()
	{  
		if(this.value == "")
		{
			$j(this).removeClass("searchfield_active").addClass("searchfield_inactive");  
			this.value = this.defaultValue;
		}
	});
	
	
	// ------------------------------------------------------------------------------------------
	// MENU
	
	// Esconde Submenus
	$j("ul#menu > li > ul").hide();
	
	// Mostra Submenu inicial
	if(!$j(".current-cat").parent().is('#menu'))
	{
		$j(".current-cat").parent().show();
		$j(".current-cat").parent().addClass("subnav_activa");
	}
	
	// Click
	$j("ul#menu > li a").click(function()
	{
		// Tem Subnav
		var subnav = $j(this).parent("li").children().size();
		if(subnav > 1)
		{
			// Reset
			$j(".subnav_activa").slideToggle("fast", function() {});
			
			// Atribui classe activa
			var hasClass = $j(this).parent("li").children("ul").hasClass("subnav_activa");
			if(!hasClass){
				$j(".subnav_activa").removeClass("subnav_activa");
				$j(this).parent("li").children("ul").addClass("subnav_activa"); 
			
				// Mostra submenu seleccionado
				$j(this).parent("li").children("ul").slideToggle("fast", function(){});
			}
			
			return false;
		}else{
			$j(".subnav_activa").removeClass("subnav_activa");
		}
	});
	
	// Hover
	$j("#menu a").hover(
		function () {
			$j(this).fadeTo(200, 0.3);
		}, 
		function () {
			$j(this).fadeTo(50, 1);
		}
	);
	
	
	// ------------------------------------------------------------------------------------------
	// SIDEBAR
	$j("#sidebar_apoio a").hover(
		function () {
			$j(this).fadeTo(200, 0.6);
		}, 
		function () {
			$j(this).fadeTo(50, 1);
		}
	);

	// ------------------------------------------------------------------------------------------
	// RETIRA ACENTOS À STRING
	
	function unformatString(texto) {
		texto = texto.toLowerCase();
		texto = texto.replace(" ", "-");
		texto = texto.replace("´", "");
		texto = texto.replace("'", "");
		texto = texto.replace("à", "");
		texto = texto.replace("â", "");
		texto = texto.replace("ä", "");
		texto = texto.replace("æ", "");
		texto = texto.replace("è", "");
		texto = texto.replace("ê", "");
		texto = texto.replace("ì", "");
		texto = texto.replace("î", "");
		texto = texto.replace("ð", "");
		texto = texto.replace("ò", "");
		texto = texto.replace("ô", "");
		texto = texto.replace("ö", "");
		texto = texto.replace("ø", "");
		texto = texto.replace("ú", "");
		texto = texto.replace("ü", "");
		texto = texto.replace("á", "");
		texto = texto.replace("ã", "");
		texto = texto.replace("å", "");
		texto = texto.replace("ç", "");
		texto = texto.replace("´", "");
		texto = texto.replace("é", "");
		texto = texto.replace("ë", "");
		texto = texto.replace("í", "");
		texto = texto.replace("ï", "");
		texto = texto.replace("ñ", "");
		texto = texto.replace("ó", "");
		texto = texto.replace("õ", "");
		texto = texto.replace("ù", "");
		texto = texto.replace("û", "");
		texto = texto.replace("ý", "");
		texto = texto.replace("ÿ", "");
		return texto;
	}
	
});

