
	// FUNCOES JS
	
	//MENU PRINCIPAL
	
	var temptime=0;
	
	function menuOver(varNomo)
	{
		document.getElementById('submenu_1').style.display = 'none';
		document.getElementById('submenu_2').style.display = 'none';
		document.getElementById('submenu_3').style.display = 'none';
		document.getElementById('submenu_4').style.display = 'none';
		document.getElementById('submenu_5').style.display = 'none';
		document.getElementById('submenu_6').style.display = 'none';
		document.getElementById('submenu_7').style.display = 'none';
		document.getElementById('submenu_'+varNomo).style.display = 'block';
		
		document.getElementById('menu_1').setAttribute("class", "menu_1" );
		document.getElementById('menu_2').setAttribute("class", "menu_2" );
		document.getElementById('menu_3').setAttribute("class", "menu_3" );
		document.getElementById('menu_4').setAttribute("class", "menu_4" );
		document.getElementById('menu_5').setAttribute("class", "menu_5" );
		document.getElementById('menu_6').setAttribute("class", "menu_6" );
		document.getElementById('menu_7').setAttribute("class", "menu_7" );
		if(varNomo<7)
		{
			acionaMenu();
			document.getElementById('menu_'+varNomo).setAttribute("class", "menuh_"+varNomo );
		}
		
	}
	
	
	function acionaMenu()
	{
		clearTimeout(temptime);
	}
	
	function desacionaMenu()
	{
		temptime=setTimeout("menuOver(7);",100);
	}
	
	// MENU GERENCIADOR
	
	startList = function() {
	if (document.all&&document.getElementById) {
	navRoot = document.getElementById("nav");
	for (i=0; i<navRoot.childNodes.length; i++) {
	node = navRoot.childNodes[i];
	if (node.nodeName=="LI") {
	node.onmouseover=function() {
	this.className+=" over";
	  }
	  node.onmouseout=function() {
	  this.className=this.className.replace
		(" over", "");
	   }
	   }
	  }
	 }
	}
	window.onload=startList;
	
	// CHECKBOX (Normal e popup)
	
	function marcacheck(varNomo)
	{
		var marca = document.getElementById('fom_checka').value;
		
		if(marca==1)
		{
			document.getElementById('fom_checka').value=0;
			document.getElementById('botcheck').src='../img/checkbox.png';
		}
		else
		{
			document.getElementById('fom_checka').value=1;
			document.getElementById('botcheck').src='../img/checkbox_checked.png';
		}
	}
	
	function marcacheckpop(varNomo)
	{
		var marca = document.getElementById('fop_checka').value;
		
		if(marca==1)
		{
			document.getElementById('fop_checka').value=0;
			document.getElementById('botcheckp').src='../img/checkbox.png';
		}
		else
		{
			document.getElementById('fop_checka').value=1;
			document.getElementById('botcheckp').src='../img/checkbox_checked.png';
		}
	}
	
	/* =========================================================== */
	// MASCARAS
	
	function mascara(o,f)
	{
		v_obj=o
		v_fun=f
		setTimeout("execmascara()",1)
	}

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

	function leech(v)
	{
		v=v.replace(/o/gi,"0")
		v=v.replace(/i/gi,"1")
		v=v.replace(/z/gi,"2")
		v=v.replace(/e/gi,"3")
		v=v.replace(/a/gi,"4")
		v=v.replace(/s/gi,"5")
		v=v.replace(/t/gi,"7")
		return v
	}

	function mmhora(v)
	{
		v=v.replace(/\D/g,"")
		v=v.replace(/^(\d\d)(\d)/g,"$1:$2")
		v=v.replace(/(\d{2})(\d)/,"$1:$2")
		return v
	}

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

	function mmfone(v)
	{
		v=v.replace(/\D/g,"")                
		v=v.replace(/^(\d\d)(\d)/g,"($1) $2")
		v=v.replace(/(\d{4})(\d)/,"$1-$2")   
		return v
	}
	
	
	/* =========================================================== */
	// ENVIADOR DE FORMULARIO COM VERIFICADOR
	
	function verificaForm()
	{
		var piegNome = document.getElementById('fom_nome').value;
		var piegEmail = document.getElementById('fom_email').value;
		var piegTexto = document.getElementById('fom_texto').value;
		
		var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
		
		document.getElementById('msg_sistema_form').innerHTML="";
		document.getElementById('msg_sistema_formn').innerHTML="";
		document.getElementById('msg_sistema_formt').innerHTML="";
		
		if(piegNome == '')
			document.getElementById('msg_sistema_formn').innerHTML="* obrigat&oacute;rio";
		else if(piegEmail == '')
			document.getElementById('msg_sistema_form').innerHTML="* obrigat&oacute;rio";
		else if (piegEmail.search(emailRegEx) == -1)
			document.getElementById('msg_sistema_form').innerHTML="* preencha corretamente";
		else if(piegTexto == '')
			document.getElementById('msg_sistema_formt').innerHTML="* obrigat&oacute;rio";
		else
			document.fom_form.submit();
		
	}
	
	
	/* =========================================================== */
	// ENVIADOR DE FORMULARIO COM VERIFICADOR (NO TRABALHE CONOSCO)
	
	function verificaFormTrab()
	{
		var piegVaga = document.getElementById('fom_vaga').value;
		var piegNome = document.getElementById('fom_nome').value;
		var piegEmail = document.getElementById('fom_email').value;
		var piegEstado = document.getElementById('fom_estado').value;
		var piegCidade = document.getElementById('fom_cidade').value;
		var piegTelefone = document.getElementById('fom_telefone').value;
		var piegCelular = document.getElementById('fom_celular').value;
		var piegTexto = document.getElementById('fom_texto').value;
		
		var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
		
		document.getElementById('msg_sistema_form').innerHTML="";
		document.getElementById('msg_sistema_formn').innerHTML="";
		document.getElementById('msg_sistema_formt').innerHTML="";
		document.getElementById('msg_sistema_formv').innerHTML="";
		document.getElementById('msg_sistema_formc').innerHTML="";
		document.getElementById('msg_sistema_forme').innerHTML="";
		document.getElementById('msg_sistema_formtel').innerHTML="";
		document.getElementById('msg_sistema_formcel').innerHTML="";
		
		if(piegVaga == '')
			document.getElementById('msg_sistema_formv').innerHTML="* obrigat&oacute;rio";
		else if(piegNome == '')
			document.getElementById('msg_sistema_formn').innerHTML="* obrigat&oacute;rio";
		else if(piegEmail == '')
			document.getElementById('msg_sistema_form').innerHTML="* obrigat&oacute;rio";
		else if (piegEmail.search(emailRegEx) == -1)
			document.getElementById('msg_sistema_form').innerHTML="* preencha corretamente";
		else if(piegEstado == '')
			document.getElementById('msg_sistema_forme').innerHTML="* obrigat&oacute;rio";
		else if(piegCidade == '')
			document.getElementById('msg_sistema_formc').innerHTML="* obrigat&oacute;rio";
		else if(piegTelefone == '')
			document.getElementById('msg_sistema_formtel').innerHTML="* obrigat&oacute;rio";
		else if(piegCelular == '')
			document.getElementById('msg_sistema_formcel').innerHTML="* obrigat&oacute;rio";
		else if(piegTexto == '')
			document.getElementById('msg_sistema_formt').innerHTML="* obrigat&oacute;rio";
		else
			document.fom_form.submit();
		
	}
	
	
	
	/* =========================================================== */
	// MaxLength no TEXTAREA e outros...
	
	function imposeMaxLength(Object, MaxLen)
	{
	  return (Object.value.length <= MaxLen);
	}
	
	
	/* =========================================================== */
	// Funcao para DELAY
	
	function jsdelay(millis)
	{
		var datea = new Date();
		var curDate = null;
		
		do { curDate = new Date(); }
		while(curDate-datea < millis);
	}
	
	
	
	/* =========================================================== */
	// AJAX 
	
	function ajaxPaginacao(varCodigo, varIdo)
	{
			if (window.XMLHttpRequest)
			  {// code for IE7+, Firefox, Chrome, Opera, Safari
			  xmlhttp=new XMLHttpRequest();
			  }
			else
			  {// code for IE6, IE5
			  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
			  }
			xmlhttp.onreadystatechange=function()
			  {
			  if (xmlhttp.readyState==4 && xmlhttp.status==200)
				{
					var texto=xmlhttp.responseText;
					texto=texto.replace(/\+/g," ");
					texto=unescape(texto);
					document.getElementById("pesquisado").innerHTML= texto;
				}
			  }
			xmlhttp.open("GET","../inc/ajax.paginacao" + varCodigo + ".php?fox_categoria=" + varIdo,true);
			xmlhttp.send();
	}
	
	
	function ajaxGerenciadorCapa()
	{
		if (window.XMLHttpRequest)
		  {// code for IE7+, Firefox, Chrome, Opera, Safari
		  xmlhttp1=new XMLHttpRequest();
		  }
		else
		  {// code for IE6, IE5
		  xmlhttp1=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		xmlhttp1.onreadystatechange=function()
		  {
		  if (xmlhttp1.readyState==4 && xmlhttp1.status==200)
			{
				var texto=xmlhttp1.responseText;
				texto=texto.replace(/\+/g," ");
				texto=unescape(texto);
				document.getElementById("areadeselecaocapa").innerHTML= texto;
			}
		  }
		xmlhttp1.open("GET","inc/ajax.listacapa.php",true);
		xmlhttp1.send();
	}
	
	
	function ajaxGerenciadorFoto()
	{
		if (window.XMLHttpRequest)
		  {// code for IE7+, Firefox, Chrome, Opera, Safari
		  xmlhttp2=new XMLHttpRequest();
		  }
		else
		  {// code for IE6, IE5
		  xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		xmlhttp2.onreadystatechange=function()
		  {
		  if (xmlhttp2.readyState==4 && xmlhttp2.status==200)
			{
				var texto=xmlhttp2.responseText;
				texto=texto.replace(/\+/g," ");
				texto=unescape(texto);
				document.getElementById("areadeselecaofoto").innerHTML= texto;
			}
		  }
		xmlhttp2.open("GET","inc/ajax.listafoto.php",true);
		xmlhttp2.send();
	}
	
	
	function ajaxGerenciadorCapaFiltro(varNumCat)
	{
		if (window.XMLHttpRequest)
		  {// code for IE7+, Firefox, Chrome, Opera, Safari
		  xmlhttp=new XMLHttpRequest();
		  }
		else
		  {// code for IE6, IE5
		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		xmlhttp.onreadystatechange=function()
		  {
		  if (xmlhttp.readyState==4 && xmlhttp.status==200)
			{
				var texto=xmlhttp.responseText;
				texto=texto.replace(/\+/g," ");
				texto=unescape(texto);
				document.getElementById("areadeselecaocapa").innerHTML= texto;
			}
		  }
		xmlhttp.open("GET","inc/ajax.listacapa.php?filtro=" + varNumCat,true);
		xmlhttp.send();
	}
	
	
	function ajaxGerenciadorFotoFiltro(varNumCat)
	{
		if (window.XMLHttpRequest)
		  {// code for IE7+, Firefox, Chrome, Opera, Safari
		  xmlhttp=new XMLHttpRequest();
		  }
		else
		  {// code for IE6, IE5
		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		xmlhttp.onreadystatechange=function()
		  {
		  if (xmlhttp.readyState==4 && xmlhttp.status==200)
			{
				var texto=xmlhttp.responseText;
				texto=texto.replace(/\+/g," ");
				texto=unescape(texto);
				document.getElementById("areadeselecaofoto").innerHTML= texto;
			}
		  }
		xmlhttp.open("GET","inc/ajax.listafoto.php?filtro=" + varNumCat,true);
		xmlhttp.send();
	}
	
	function ajaxGerenciadorTodos()
	{
		ajaxGerenciadorCapa();
		ajaxGerenciadorFoto();
		document.getElementById('popup_addimagem').style.display = 'none';
		document.getElementById('oifram').src = 'inc/iframe.addimagem.php';
	}
	
