<!--
//FUNCAO AREALIVE
	function abreop(){
	window.open('../arealive/pop_operador.php','operador','width=600, height=420, statusbar=no, scrollbars=no');
	}
//FUNCAO VALIDA LOGIN
function valida(){
		logar_jax(document.logar.login.value,document.logar.senha.value);

}

//DECODIFICA STRING EM HTML
function url_decode(str) { 
   var n, strCode, strDecode = ""; 
        for (n = 0; n < str.length; n++) { 
            if (str.charAt(n) == "%") { 
                strCode = str.charAt(n + 1) + str.charAt(n + 2); 
                strDecode += String.fromCharCode(parseInt(strCode, 16)); 
                n += 2; 
            } else { 
                strDecode += str.charAt(n); 
            } 
        } 
        return strDecode; 
    }

//ESCONDE E MOSTRA DIV
function hideandseek(id,status){
	document.getElementById(id).style.display = status;
}


//AJAX FUNCTIONS


/* ####################################### */
//OBJETO HTTP
function getHTTPObject() {
var req;

try {
 if (window.XMLHttpRequest) {
  req = new XMLHttpRequest();

  if (req.readyState == null) {
   req.readyState = 1;
   req.addEventListener("load", function () {
   req.readyState = 4;

   if (typeof req.onReadyStateChange == "function")
    req.onReadyStateChange();
   }, false);
  }

  return req;
 }

 if (window.ActiveXObject) {
  var prefixes = ["MSXML2", "Microsoft", "MSXML", "MSXML3"];

  for (var i = 0; i < prefixes.length; i++) {
   try {
    req = new ActiveXObject(prefixes[i] + ".XmlHttp");
    return req;
   } catch (ex) {};

  }
 }
} catch (ex) {}

alert("Seu navegaor não suporta!!!!");
}
var http = getHTTPObject();

/* ####################################### */

//FUNCAO POSTAR LOGIN
function logar_jax(email,senha){
dados = 'email='+email+'&senha='+senha
url='logar.php';
http.open("POST", url, true);
http.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
http.onreadystatechange = responselogin;
http.send(dados);
}
function responselogin()
{
  if (http.readyState == 4) {
	retorno2=http.responseText.split('|');
	if(retorno2[0]=='1'){	
		window.location='home.php';
	}
	else{
		document.getElementById('retorno').innerHTML=url_decode(retorno2[1]);
	}
}
}


//FUNCAO CADATRAR INSTITUCIONAL
function xpag_isntitucional_jax(titulo,data,texto,id){
dados = 'titulo='+titulo+'&data='+data+'&texto='+texto+'&id='+id;
url='xpage_institucional.php';
http.open("POST", url, true);
http.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
http.onreadystatechange = responsexinst;
http.send(dados);
}
function responsexinst()
{
		hideandseek('Layer1','block');
if (http.readyState == 0) {
		hideandseek('mensagem','block');
		document.getElementById('mensagem').innerHTML='<h1>Aguarde....</h1>';
	}

if (http.readyState == 1) {
		hideandseek('mensagem','block');
		document.getElementById('mensagem').innerHTML='<h1>Aguarde....</h1>';
	}

if (http.readyState == 2) {
		hideandseek('mensagem','block');
		document.getElementById('mensagem').innerHTML='<h1>Aguarde....</h1>';
	}

if (http.readyState == 3) {
		hideandseek('mensagem','block');
		document.getElementById('mensagem').innerHTML='<h1>Aguarde....</h1>';
	}


  if (http.readyState == 4) {
		retorno=http.responseText;
		hideandseek('mensagem','none');
		hideandseek('mensagem2','block');
		document.getElementById('mensagem2').innerHTML=url_decode(retorno);
	}
}
//FUNCAO TRAZ A TELA
function traztela(tela)
{
  http.open("GET", "secao.php?tela="+tela, true);
  http.onreadystatechange = handleHttpResponse;
  http.send(null);
}
function handleHttpResponse()
{
	document.getElementById('main').innerHTML=http.responseText;
}
/* #################### */




//ROLLOVER
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}



//CALENDARIO

   var oldLink = null;
   // code to change the active stylesheet
   function setActiveStyleSheet(link, title) {
     var i, a, main;
     for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
       if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
         a.disabled = true;
         if(a.getAttribute("title") == title) a.disabled = false;
       }
     }
     if (oldLink) oldLink.style.fontWeight = 'normal';
     oldLink = link;
     link.style.fontWeight = 'bold';
     return false;
   }

   function selected(cal, date) {
     cal.sel.value = date; // just update the date in the input field.
     if (cal.sel.id == "sel1" || cal.sel.id == "sel3")
       cal.callCloseHandler();
   }

   function closeHandler(cal) {
     cal.hide();                        // hide the calendar
   }

   function showCalendar(id, format) {
     var el = document.getElementById(id);
     if (calendar != null) {
       calendar.hide();                 // so we hide it first.
     } else {
       var cal = new Calendar(false, null, selected, closeHandler);
       cal.weekNumbers = false;
       calendar = cal;                  // remember it in the global var
       cal.setRange(1900, 2070);        // min/max year allowed.
       cal.create();
     }
     calendar.setDateFormat(format);    // set the specified date format
     calendar.parseDate(el.value);      // try to parse the text in field
     calendar.sel = el;                 // inform it what input field we use
     calendar.showAtElement(el);        // show the calendar below it

     return false;
   }

   var MINUTE = 60 * 1000;
   var HOUR = 60 * MINUTE;
   var DAY = 24 * HOUR;
   var WEEK = 7 * DAY;

   function isDisabled(date) {
     var today = new Date();
     return (Math.abs(date.getTime() - today.getTime()) / DAY) > 10;
   }

   function flatSelected(cal, date) {
     var el = document.getElementById("preview");
     el.innerHTML = date;
   }

   function showFlatCalendar() {
     var parent = document.getElementById("display");
     var cal = new Calendar(false, null, flatSelected);
     cal.weekNumbers = false;
     cal.setDisabledHandler(isDisabled);
     cal.setDateFormat("DD, M d");
     cal.create(parent);
     cal.show();
   }
//-->