

$(function(){

	$("a").popLinks();

	var nucleo = $(".nucleos");
	$(nucleo).click(function(){
		$(this).next(".nucleos-item").toggle();
	});

	var container = $("#form-contato-error");
	$("#form-contato").validate({
		errorContainer: container,
		errorLabelContainer: $("ol", container),
		wrapper: 'li'
	});
	$("#fc-telefone").mask("(99) 9999-9999",{ placeholder:"" });

});

// Muda as notícias -------------------------------------------------------------------
function MudaNoticias() {
	var newsId = $("#CmbNovidades").val();
	document.location.href='index.php?' + newsId;
};

// Pop Links (Ex.: rel="type|height|width|location|toolbar|scrollbar|menubar") --------
$.fn.popLinks = function() {
	$(this).each(function(){
		var tgt = $(this).attr('href');
		var rel = $(this).attr("rel");
		if(rel) {
			var relArray = rel.split("|");
			if(relArray[0] == "external") {
				$(this).attr('target','_blank');
			} else if (relArray[0] == "popup") {
				$(this).click(function(){
					var wHeight = $(window).height();
					var wWidth  = $(window).width();
					var pHeight = relArray[1];
					var pWidth  = relArray[2];
					var pTop    = (wHeight-pHeight)/2;
					var pCenter = (wWidth-pWidth)/2;
					new_window  = window.open(tgt,'popup','width='+pWidth+',height='+pHeight+',location=no,toolbar=no,scrollbars=no,menubar=no,top='+pTop+',left='+pCenter+'');
					return false;
				});
			}
		}
	});
};
function abre10anos() {window.open('10anos/index.html','10anos','toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=0,width=656,height=505,top=50,left=50');}
