jQuery(document).ready(function() {
	//IMPEDE CONFLITOS DE BIBLIOTECAS JS
	jQuery.noConflict();
	//TRATA OS ERROS DE AJAX
	jQuery.ajaxSetup({
		//var msg;
		error:function(x,e){
			if(x.status==0){
				msg = 'You are offline!!\n Please Check Your Network.';
			}else if(x.status==404){
				msg = 'Requested URL not found.';
			}else if(x.status==500){
				msg = 'Internel Server Error.';
			}else if(e=='parsererror'){
				msg = 'Error.\nParsing JSON Request failed.';
			}else if(e=='timeout'){
				msg = 'Request Time out.';
			}else {
				msg = 'Unknow Error.\n'+x.responseText;
			}
			alert("X: "+x.status+"\nE: "+e+"\n"+msg);
		}
	});
	//TABS
	jQuery("#conteudo .destaque .tab li").live('click', function(e) {
		//ZERA O ESTADO DOS ELEMENTOS
		jQuery(this).parent().find("li").css("border-bottom","solid 1px #0f0064");
		jQuery(this).parent().parent().find(".item").css("display","none");
		//SELECIONA OS ELEMENTOS PARA MOSTRAR
		var item = jQuery(this).attr("class");
		//REALIZA AS ALTERAÇÕES
		jQuery(this).css("border-bottom","none");
		jQuery(this).parent().parent().find(".item."+item).css("display","");
	});
    var y_fixo = jQuery("#contato").offset().top;
	jQuery(window).scroll(function () {
		jQuery("#contato").animate(
			{
				top: y_fixo+jQuery(document).scrollTop()+"px"
			},
			{
				duration:500,queue:false
			}
		);
	});
});
