// JQuery efeito no menu
<!--
$(document).ready(function(){
	/* geral */
	$("#novo_artigo, #nova_busca, #submenu ul").hide();
	/* efeito menu */
	$("#menu li a").mouseover(function() {
		$("#submenu ul").hide();
		var showMe = $(this).attr("id");
		$("#ul_"+showMe).show();
	});
});

function addFav(){
	var url = "http://www.imda.com.br/";
	var title = "IMDA - Instituto Mineiro de Direito Administrativo";
	if (window.sidebar) window.sidebar.addPanel(title, url,"");
	else if(document.all){window.external.AddFavorite(url, title);}
}

function gID(id){
	return document.getElementById(id);
}

function valContato() {

	if( gID("nome").value == '' 
		|| (gID("email").value == '' && gID("telefone").value == '')
		|| gID("assunto").value == ''
		|| gID("msg").value == '' )
	{
		alert("Os campos Nome, Assunto e Mensagem devem ser preenchidos!(E-mail ou Telefone)");
		gID("nome").focus();
		return false;
	} else { return true; }

}

function showFormArquivo() {
	$("#novo_artigo").show("2000");
}

function hideFormArquivo() {
	$("#novo_artigo").hide("500");
}

function showFormBusca() {
	$("#nova_busca").show("2000");
}

function hideFormBusca() {
	$("#nova_busca").hide("500");
}

function validaArtigo() {

	if( gID("titulo").value == '' 
		|| gID("cpf").value == ''
		|| gID("email").value == ''
		|| gID("rua").value == ''
		|| gID("numero").value == ''
		|| gID("bairro").value == ''
		|| gID("cidade").value == ''
		|| (gID("telefone").value == '' && gID("celular").value == '')
		|| gID("msg").value == '' )
	{
		alert("Todos os campos devem ser preenchidos.");
		gID("titulo").focus();
		return false;
	} else { return true; }

}

/*
Criada por elcio, da visie/tableless
http://elcio.com.br/ajax/mascara/
*/

function mascara(o,f){
    v_obj=o
    v_fun=f
    setTimeout("execmascara()",1)
}

function execmascara(){
    v_obj.value=v_fun(v_obj.value)
}

function cpfm(v){
    v=v.replace(/\D/g,"")
    v=v.replace(/(\d{3})(\d)/,"$1.$2")
    v=v.replace(/(\d{3})(\d)/,"$1.$2")
    v=v.replace(/(\d{3})(\d{1,2})$/,"$1-$2")
    return v
}

function cepm(v){
    v=v.replace(/\D/g,"")
    v=v.replace(/(\d{2})(\d)/,"$1.$2")
    v=v.replace(/(\d{3})(\d)/,"$1-$2")
	return v
}

/*
[exemplo] Mozilla Firefox
https://developer.mozilla.org/En/DOM/Window.open
*/

var WindowObjectReference = null; // global variable

function openDownload(url)
{
  if(WindowObjectReference == null || WindowObjectReference.closed)
  {
    WindowObjectReference = window.open('http://www.imda.com.br/novo/uploads_arquivos/'+url,
   "Download", "resizable=yes,scrollbars=yes,status=no");
  }
  else
  {
    WindowObjectReference.focus();
  };
}

-->