// JavaScript Document (gian, 21/03/06)
	function ajax() {
	  var xmlhttp;
	  /*@cc_on
	  @if (@_jscript_version >= 5)
		try {
		  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
		  try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		  } catch (e) {
			xmlhttp = false;
		  }
		}
	  @else
	  xmlhttp = false;
	  @end @*/
	  //if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		try{
			xmlhttp = new XMLHttpRequest();
		}catch(ee){
			try{
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			}catch(e){
				try{
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				}catch(E){
					xmlhttp = false;
				}
			}
		}	  return xmlhttp;
	}
		
	function dollar() {
		http=ajax();
		http.open("POST","/pieces/cotacao_dollar.php",true);
		http.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		http.send("iniciar=");
		http.onreadystatechange = function() {
			if (http.readyState == 4) {
				document.getElementById("cotdollar").innerHTML = http.responseText;	
				http=null;
			}
		}
	}
	
	function Janela(theURL,winName,features) {
		var teste = window.open(theURL,winName,features);
		if(teste != null) teste.focus();
	}
	
	var reEmail1 = /^[\w!#$%&'*+\/=?^`{|}~-]+(\.[\w!#$%&'*+\/=?^`{|}~-]+)*@(([\w-]+\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;
	function doEmail(pStr, pFmt)
	{
		eval("reEmail = reEmail" + pFmt);
		if (reEmail.test(pStr)) {
			return true;
		} else if (pStr != null && pStr != "") {
			return false;
		}
	} // doEmail
	
	function ckemail(trab){
		trab=trab.toLowerCase()
		var novo=false
		if ((trab.indexOf("@", 2) == -1) || (trab.indexOf(".", 3) == -1) || (trab.indexOf("@.", 1) != -1) || (trab.indexOf(".@", 1) != -1)) novo=true	
		var pode="0123456789.@_-abcdefghijklmnopqrstuvwxyz"
		for (i=0;i<=trab.length;i++){
			swork = trab.charAt(i);
			if (pode.indexOf(swork, 0) == -1) novo = true		
		}
		return novo
	}
		
	function ccalend(acao,mes,ano) {
		document.getElementById("calendario").innerHTML = "<p align='center'>Aguarde...</p>";
		http=ajax();
		http.open("POST","/pieces/calendario.php",true);
		http.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		http.send("load=true&ano="+ano+"&mes="+mes);
		http.onreadystatechange = function() {
			if (http.readyState == 4) {
				document.getElementById("calendario").innerHTML = http.responseText;	
				http=null;
			}
		}	
	}

	function fechabanner() {
		document.getElementById("banner_lateral").style.display="none";	
		http=ajax();
		http.open("GET","/pieces/fechar_banner_lateral.php",true);
		http.send(null);
		http=null;
	}

	MateriasPassadasVisivel = false;
	document.onmouseup = function() {
		if(MateriasPassadasVisivel) {
			document.getElementById("materiasEdicaoAnterior").style.visibility = 'hidden';
			MateriasPassadasVisivel = false;
		}
	}
	
	function MateriasPassadasLinkOpen() {
		if(!MateriasPassadasVisivel) {
			document.getElementById("materiasEdicaoAnterior").style.visibility = 'visible';
			MateriasPassadasVisivel = true;
		} 	
	}
	
	function BuscarInterno() {
		frm=document.forms['buscaInterna'];
		if(frm.buscaStr.value != '' && frm.buscaStr.value != 'Pesquisar') {
			return window.frm.submit();
		} else return false;
	}