// JavaScript Document
/* SHOW */
function Show(id)
{
	var el = document.getElementById(id);
	
	if(el)
		el.style.visibility = 'visible';
}

/* HIDE*/
function Hide(id)
{
	var el = document.getElementById(id);
	
	if(el)
		el.style.visibility = 'hidden';
}

/* AJAX - TROCA CONTEÚDO*/
function TrocaConteudo(file,value,div)
{
//Clear our fetching variable
var xmlhttp = false; 

try 
{
	//Try the first kind of active x object…
	xmlhttp = new ActiveXObject('Msxml2.XMLHTTP');
} 
catch (e) 
{
	try
	{
		xmlhttp = new
		ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object
	} 
	catch (E) 
	{
		xmlhttp = false;
	}
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined') 
{
	 //If we were able to get a working active x object, start an XMLHttpRequest
	xmlhttp = new XMLHttpRequest();
}

// Exibir o Carregando
document.getElementById(div).innerHTML = "<div align=\"center\" style=\"margin:10px 0 10px 0;\"><img src=\"img/testeLoad.gif\" alt=\"Carregando...\" /></div>";
//Open the file through GET, and add the page we want to retrieve as a GET variable **
xmlhttp.open('GET', file + value, true);

xmlhttp.onreadystatechange = function()
{

//Check if it is ready to recieve data
if (xmlhttp.readyState == 4) 
{ 
	var content = xmlhttp.responseText; //The content data which has been retrieved ***

	//Make sure there is something in the content variable
	if(content)
	{ 
		 //Change the inner content of your div to the newly retrieved content ****
		document.getElementById(div).innerHTML = content;
	}
}
}

//Nullify the XMLHttpRequest
xmlhttp.send(null)

return;
}

/* MUDA CLASSES*/
function ClassSwap(div, class_n, class_a)
{
	var el = document.getElementById(div);
	
	if(el)
	{
		el.className = el.className == class_n ? class_a : class_n;
	}
}

/* DESATIVA OUTROS 2 BOTÕES*/
function ClassDeactive(div_a, class_a, div_b, class_b)
{
	var div_c = document.getElementById(div_a);
	if (div_c)
	{
		div_c.className = class_a;
	}
	
	var div_d = document.getElementById(div_b);
	if (div_d)
	{
		div_d.className = class_b;
	}
}