$(document).ready(function(){
	$('a[href^=#]').click(function(){return false;});
	$("#carregando").hide();
	$("#carregando").ajaxStart(function(){$("#carregando").show()});
	$("#carregando").ajaxStop(function(){$("#carregando").hide()});
	
	//$('.subnewsdestaque').cycle();

	$(".menu li, .menu li ul li a").hover(function(){
			$(this).addClass("hover")
		},
		function(){
			$(this).removeClass("hover")
		}
	);
	$('#shopping').jcarousel();

	$('img').pngFix({blankgif:'../imagens/blank.gif'});

	$('#recado').keypress(function(){
		if($(this).val().length > 180) {
			$(this).val($(this).val().substring(0, 180));
		} else {
			$('#remLen_1').val(180 - $(this).val().length);
		}
	});

	$('.addsmile').click(function(){
		$('#recado').val($('#recado').val()+' ' + $(this).attr('href') + ' ');
		$('#recado').focus();
		return false;
	});

	$(".validacao").ajaxForm({
		url: 'acoes.php',
		dataType: 'html',
		type: 'POST',
		beforeSubmit: function(){
			return $(".validacao").valid();
		},
		success: function(html){
			var tar = $(".validacao").attr('action').replace(df.dominio, '');
			
			responseText = html;
			$('#erro_form').empty().removeClass().hide();
			responseText = responseText.replace(/\+/g," ");
			responseText = unescape(responseText);
			var response = responseText.split("|");
			if(response[0]=="success"){
				$('#erro_form').addClass('sucesso').append(response[1]).fadeIn('slow');
				$.scrollTo(0, {queue:true});
				window.setTimeout(function(){
					window.location.href = df.dominio+tar;
				}, 1500);
			}else if(response[0]=="error"){
				$('#erro_form').append(response[1]).fadeIn('slow');
				$.scrollTo(0, {queue:true});
				window.setTimeout(function(){
					$('#erro_form').fadeOut('slow');
				}, 2000);
			}
		}
	});

	$(".validacao").submit(function(){
		return false;
	});

	$('#topo').flash({
		src: 'include/swf/topo.swf',
		width: 879,
		height: 285,
		wmode: 'transparent'
	});

	if($("a[rel^='prettyPhoto']").length > 0){
		$("a[rel^='prettyPhoto']").prettyPhoto({theme:'light_rounded'});
	}

	if((typeof iniciaOutros)=='function'){
		iniciaOutros();
	}
});