// JavaScript Document
//=========================== palyer winmedia player =====================================================
function PlayClick(){
   MPlay1.play();
}

function StopClick(){
   MPlay1.stop();
}
function full(){
   MPlay1.fullScreen='true';
}
function UpVolumeClick() {
	if (document.MPlay1.Volume <= -300) 
		document.MPlay1.Volume = document.MPlay1.Volume + 300;
}

function DownVolumeClick() {
	if ( document.MPlay1.Volume >= -8000) 
		document.MPlay1.Volume = document.MPlay1.Volume - 300;
}
//========================================= esconde camadas ===============================================
function alterar_display(elm) {
		var e = document.getElementById(elm);
		if(e.className=="escondido") {
			e.className="amostra";
		} else {
			e.className="escondido";
		}
	}

// ========================================= pop up ========================================================
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function sobe() {
window.document.body.scrollTop=0;
}
///////////////////////////////////////////////////// PRELOAD IMAGENS
var myimages = new Array();
function preloading(){
for (x=0; x<preloading.arguments.length; x++){
myimages[x] = new Image();
myimages[x].src = "img/" + preloading.arguments[x];
}
}
preloading("circulo.gif");

//========================================= AJAX ===========================================================
function openAjax() { 
var Ajax; 
try {Ajax = new XMLHttpRequest(); // XMLHttpRequest para browsers mais populares, como: Firefox, Safari, dentre outros. 
}catch(ee) { try {Ajax = new ActiveXObject("Msxml2.XMLHTTP"); // Para o IE da MS 
}catch(e) { try {Ajax = new ActiveXObject("Microsoft.XMLHTTP"); // Para o IE da MS 
}catch(e) {Ajax = false; 
} } } return Ajax; } 

function carregaAjax(id,url,metodo,obj,carregando,txt_carregando) { 

if(document.getElementById) { // Para os browsers complacentes com o DOM W3C. 
var exibeResultado = document.getElementById(id); // div que exibirá o resultado. 
var Ajax = openAjax(); // Inicia o Ajax. 
Ajax.open(metodo, url, true); // fazendo a requisição 

if (metodo == 'Post') { Ajax.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;charset=utf-8');}

Ajax.onreadystatechange = function() 
{ 

if (carregando != "") {
if(Ajax.readyState == 1) { // Quando estiver carregando, exibe: carregando... 
//window.document.body.scrollTop=0;
exibeResultado.innerHTML = "<div id='tabelab' align='center'><table width='100%' height='20' border='0' cellpadding='0' cellspacing='0' ><tr><td align='center' height='10'><br><img src='../img/" + carregando + "'>"+txt_carregando+"</td></tr></table></div>"; 
}
}
 
if(Ajax.readyState == 4) { // Quando estiver tudo pronto. 

//if(Ajax.status == 200) { 
var resultado = Ajax.responseText; // Coloca o retornado pelo Ajax nessa variável 
//window.document.body.scrollTop=0;
exibeResultado.innerHTML = resultado; 
//} else { 
//exibeResultado.innerHTML = "Erro: " + Ajax.statusText; 
//} 
} 
} 



if (metodo == 'Post') { 


//Monta os paramtros do post
      
	
} // submete 

if (metodo == 'Get') {Ajax.send(null);}
} 

} 
//========================================= IFRAME - AJAX REMOTE =================================
	function remote(id,url,larg,alt)
    {
	var	ExibeResultado =  document.getElementById(id)
	ExibeResultado.innerHTML = "<IFRAME src='"+url+"' width='"+larg+"' height='"+alt+"' frameborder='0'></IFRAME>";
    }
//====================================== MINI AJAX ===============================================
function miniAjax(url) {

		if (window.XMLHttpRequest) { 
        req = new XMLHttpRequest(); 
    } else if (window.ActiveXObject) { 
        req = new ActiveXObject("Microsoft.XMLHTTP"); 
	}

	req.open('GET', url, false); 
	req.send(null);

	resultado = req.responseText;
	return resultado;
}
// ====================== muda tamanho da fonte ====================================
var tam=12;
function mudaFonte(tipo){		
if (tipo=="mais"){
	tam+=3;
	}else{
	tam-=3;
	}
document.getElementById('corp_texto').style.fontSize=tam;
}
// =========================== fecha banner =======================================
function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
///=================================== valida formulario ==================================
function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- O campo de e-mail precisa conter um e-mail válido.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- O campo '+nm+' está vazio.\n'; }
    } if (errors) alert('Erro de preenchimento:\n'+errors);
    document.MM_returnValue = (errors == '');
} }
