// JavaScript Document
// ---------------------------------- FUNÇÕES GERAIS ---------------------------------------------------------- //

function getScrollTop() {
	if (self.pageYOffset) // all except Explorer
	{
		return self.pageYOffset;
	}
	else if (document.documentElement && document.documentElement.scrollTop)
		// Explorer 6 Strict
	{
		return document.documentElement.scrollTop;
	}
	else if (document.body) // all other Explorers
	{
		return document.body.scrollTop;
	}
}

function getViewportHeight() {
	if (window.innerHeight!=window.undefined) return window.innerHeight;
	if (document.compatMode=='CSS1Compat') return document.documentElement.clientHeight;
	if (document.body) return document.body.clientHeight; 

	return window.undefined; 
}

function getViewportWidth() {
	var offset = 17;
	var width = null;
	if (window.innerWidth!=window.undefined) return window.innerWidth; 
	if (document.compatMode=='CSS1Compat') return document.documentElement.clientWidth; 
	if (document.body) return document.body.clientWidth; 
}

function focaCampo(objeto) {
	objeto.focus();
}


function alteraCor(objeto) {
	
	corAtual = objeto.style.color;
	fundoAtual = objeto.style.backgroundColor;
	
	objeto.style.color = "#FFFFFF";
	objeto.style.backgroundColor = "#FF0000";
	
	focaCampo(objeto);
	
	setTimeout(function(){						
						objeto.style.color = corAtual;
						objeto.style.backgroundColor = fundoAtual;						
						}, 2000);
	
}

function AjaxRequest() {

	try	{
		// Firefox, Opera 8.0+, Safari
		Ajax=new XMLHttpRequest();
	}

	catch (e)
	{
		// Internet Explorer
		try
		{
		Ajax=new ActiveXObject("Msxml2.XMLHTTP");
		}
	catch (e)
		{
		try
			{
			Ajax=new ActiveXObject("Microsoft.XMLHTTP");
			}
		catch (e)
		{
			alert("Your browser does not support AJAX!");
			return false;
		}
	}
}
}

function randomico() {
	return "?rnd=" + Math.random();
}


function setTitle(titulo) {
	document.title = "MOL - " + titulo;
}

// --------------------------------- FIM FUNÇÕES GERAIS ------------------------------------------------------ //


