/* --------------------------------------------------------------------------------------------- */

	function loadPag(nrPag, nrAtual){
		nrPag2 = nrPag;
					 
		url 	= decodificaNmPag(nrPag2)+".php";		
		req 	= null;
		
		if (window.XMLHttpRequest) {
			req = new XMLHttpRequest();
			req.onreadystatechange = processReqChange;
			req.open("GET", url, true);
			req.send(null);
		} else if (window.ActiveXObject) {
			req = new ActiveXObject("Microsoft.XMLHTTP");
			if (req) {
				req.onreadystatechange = processReqChange;
				req.open("GET", url, true);
				req.send();
			}
		}
	}
		  
	function processReqChange(){
		if (req.readyState == 4) {
			if (req.status == 200) {
				document.getElementById('table').style.height  = "10px";
				document.getElementById('table2').style.height = "10px";
				document.getElementById('table3').style.height = "10px";
				document.getElementById('table4').style.height = "10px";
				document.getElementById('mostra').style.height = "10px";
				document.getElementById('carregando').style.height = "10px";
				document.getElementById('mostra').innerHTML = req.responseText;						
				document.getElementById("carregando").innerHTML = "";
			} else {
				alert("1Houve um problema ao obter os dados:\n" + req.statusText);
			}
		} else if(req.readyState < 4){
			document.getElementById("carregando").innerHTML = "<img src='view/Carregando.gif'>";
			
		}
	}
	
	
	function loadPaginacao(nrPag, nrAtual){
		
		url2 	= "Paginacao.php?nmPag="+nrPag+"&nrLinkAtual="+nrAtual;	
		req2 	= null;
		
		
		if (window.XMLHttpRequest) {
			req2 = new XMLHttpRequest();
			req2.onreadystatechange = processReqChangePaginacao;
			req2.open("GET", url2, true);
			req2.send(null);
		} else if (window.ActiveXObject) {
			req2 = new ActiveXObject("Microsoft.XMLHTTP");
			if (req2) {
				req2.onreadystatechange = processReqChangePaginacao;
				req2.open("GET", url2, true);
				req2.send();
			}
		}
	}
		  
	function processReqChangePaginacao(){
		if (req2.readyState == 4) {
			if (req2.status == 200) {		
				document.getElementById("carregando").innerHTML = "";
			} else {
				alert("Houve um problema ao obter os dados:\n" + req2.statusText);
			}
		} else if(req2.readyState < 4){
			document.getElementById("carregando").innerHTML = "<img src='view/Carregando.gif'>";
			
		}
	}


	function decodificaNmPag(nrPag){
		nmPag =  null;
		
		switch(nrPag){
			case '1': 		nmPag = "Empresa"; 					break;			
			case '2': 		nmPag = "Gestao"; 					break;
			case '3':	 	nmPag = "Corporativas"; 			break;
			case '4': 		nmPag = "Feiras"; 					break;
			case '5': 		nmPag = "Turismo"; 					break;
			case '6': 		nmPag = "FoxPress"; 				break;
			case '7': 		nmPag = "Contato"; 					break;
			case '8': 		nmPag = "Links"; 					break;
/*			case '9': 		nmPag = "FeirasNacionais2"; 		break;
*/ 			case '9': 		nmPag = "calendario"; 		        break;
			case '10': 		nmPag = "calendario_i";         	break;
/*			case '10': 		nmPag = "FeirasInterNacionais2"; 	break;
*/			
		}
		
		return nmPag;
	}


	function menuOn(nmPag){
		document.getElementById(nmPag).className = 'menu'+nmPag+'On';
	}
		
	function menu(nmPag){
		document.getElementById(nmPag).className = 'menu'+nmPag;
	}

/* --------------------------------------------------------------------------------------------- */

	function validaCampo(idCampo,nmMsg){
		
		var nmCampo 	= document.getElementById(idCampo);
		
		if(nmMsg!='')
			var nmAlertMsg 	= "Preencha o campo referente "+nmMsg;
				
		if(nmCampo.value=='' || nmCampo.value<=0) {
			if(nmAlertMsg !='') {
				alert(nmAlertMsg);
			}
			
			nmCampo.focus();
			//document.getElementById('fgSub').value = 0;
			return false;
		} else {
			return true;	
		}
	}
	
	
	function validaEmail(nmString,nmMsg){
		
		nmString = document.getElementById(nmString);
		
		if(nmMsg==''){
			nmMsg = "Um ou mais endereços de e-mail inválido(s)!";
		}
		
		nmInvalid = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
		nrPtVirg  = nmString.value.indexOf(";");
		if(nrPtVirg>0){
			
			vetStr = nmString.value.split(";");
			nrTam  = vetStr.length;
			
			for(d=0;d<nrTam;d++){
				if(nmInvalid.test(vetStr[d])==false){
					alert(nmMsg);
					nmString.style.color = "red";
					nmString.focus();
					document.getElementById('fgSub').value = 0;
					return false;
				}
			}
		
		} else {
			if(nmInvalid.test(nmString.value)==false){
				alert(nmMsg);
				nmString.style.color = "red";
				nmString.focus();
				document.getElementById('fgSub').value = 0;
				return false;
			} else {
				return true;
			}
		}		
	}
	

	function verifica(){
	
		document.getElementById('fgSub').value = "1";
		
		if(validaCampo('nome','ao seu nome!') == false)  return false;			
		
		if(validaCampo('email','ao seu e-mail!') ==false) {
			return false;
		} else {
			if(!validaEmail('email','')){
				return false;
			}
		}
		
		if(validaCampo('msg','à sua mensagem!') == false)  return false;
		
		document.getElementById('frm').submit();
	
	}
	
	
	function loadPagFeira(nmPag){
				 
		url 	= nmPag+".php";		
		req 	= null;
		
		if (window.XMLHttpRequest) {
			req = new XMLHttpRequest();
			req.onreadystatechange = processReqChangeFeiras;
			req.open("GET", url, true);
			req.send(null);
		} else if (window.ActiveXObject) {
			req = new ActiveXObject("Microsoft.XMLHTTP");
			if (req) {
				req.onreadystatechange = processReqChangeFeiras;
				req.open("GET", url, true);
				req.send();
			}
		}
	}
		  
	function processReqChangeFeiras(){
		if (req.readyState == 4) {
			if (req.status == 200) {
				document.getElementById('carregando').style.height = "10px";
				document.getElementById('feiras').innerHTML = req.responseText;						
				document.getElementById("carregando").innerHTML = "";
			} else {
				alert("2Houve um problema ao obter os dados:\n" + req.statusText);
			}
		} else if(req.readyState < 4){
			document.getElementById("carregando").innerHTML = "<img src='view/Carregando.gif'>";
			
		}
	}	
	
/* --------------------------------------------------------------------------------------------- */

// CSS Browser Selector   v0.2.5
// Documentation:         http://rafael.adm.br/css_browser_selector
// License:               http://creativecommons.org/licenses/by/2.5/
// Author:                Rafael Lima (http://rafael.adm.br)
// Contributors:          http://rafael.adm.br/css_browser_selector#contributors
var css_browser_selector = function() {
	var 
		ua=navigator.userAgent.toLowerCase(),
		is=function(t){ return ua.indexOf(t) != -1; },
		h=document.getElementsByTagName('html')[0],
		b=(!(/opera|webtv/i.test(ua))&&/msie (\d)/.test(ua))?('ie ie'+RegExp.$1):is('gecko/')? 'gecko':is('opera/9')?'opera opera9':/opera (\d)/.test(ua)?'opera opera'+RegExp.$1:is('konqueror')?'konqueror':is('applewebkit/')?'webkit safari':is('mozilla/')?'gecko':'',
		os=(is('x11')||is('linux'))?' linux':is('mac')?' mac':is('win')?' win':'';
	var c=b+os+' js';
	
	if(b != 'ie ie6') {
		b = "outros";
	}
	h.className = b;
	//h.className += h.className?' '+c:c;
}();



function exibeFash(swf, width, height, wmode, cache)
{
noCache = cache || cache == undefined ? "" : "?" + new Date();
wmode = wmode || wmode == undefined ? "opaque" : "transparent";

monta_swf = "";
monta_swf += "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\""+ width +"\" height=\""+ height +"\" title=\"\">";
monta_swf += "<param name=\"movie\" value=\""+ swf + noCache +"\" />";
monta_swf += "<param name=\"quality\" value=\"high\" />";
monta_swf += "<param name=\"menu\" value=\"0\" />";
monta_swf += "<param name=\"wmode\" value=\""+ wmode +"\" />";
monta_swf += "<embed src=\""+ swf + noCache +"\" quality=\"high\" wmode=\""+ wmode +"\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\""+ width +"\" height=\""+ height +"\"></embed>";
monta_swf += "</object>";

document.write(monta_swf);
}
