
function showHide(id)
	{
	var obj = document.getElementById(id);
	if(obj.style.display == "")
		{
		obj.style.display = "none";
		}
	else
		{
		obj.style.display = "";
		 }
	}
	
function Carregado(id)
	{
	showHide(id);
	}

function checablur(campo,valor)	{ if (campo.value=="") { campo.value=valor; } }
function checafocus(campo,valor) { if (campo.value==valor) { campo.value=""; } }

function ajustaID(id,x,y,w,h)
	{
	var obj = document.getElementById(id);
	if (w!=''){ obj.style.width = w; }
	if (h!=''){ obj.style.height = h; }
	if (x!=''){ obj.style.left = x; }
	if (y!=''){ obj.style.top = y; }
	}

function getWindowXY(tp)
	{
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		myWidth = window.innerWidth; myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth ||document.documentElement.clientHeight ) ) {
		myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		myWidth = document.body.clientWidth; myHeight = document.body.clientHeight;
	}
	if (tp == "X") { return myWidth; }
	if (tp == "Y") { return myHeight; }
	}

function getScrollXY(tp)
	{
	var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		scrOfY = window.pageYOffset; scrOfX = window.pageXOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		scrOfY = document.body.scrollTop; scrOfX = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		scrOfY = document.documentElement.scrollTop; scrOfX = document.documentElement.scrollLeft;
	}
	if (tp == "X") { return scrOfX; }
	if (tp == "Y") { return scrOfY; }
	}

function MouseXY(e,tp) // works on IE6,FF,Moz,Opera7
	{ 
	if (!e) e = window.event;
	if (e)
		{ 
		if (e.pageX || e.pageY)
			{ // this doesn't work on IE6!! (works on FF,Moz,Opera7)
			mousex = e.pageX;
			mousey = e.pageY;
			}
		else if (e.clientX || e.clientY)
			{ // works on IE6,FF,Moz,Opera7
			mousex = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
			mousey = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
			algor = '[e.clientX]';
			if (e.pageX || e.pageY) algor += ' [e.pageX] '
			}
		}
	if (tp == "X") { return mousex; }
	if (tp == "Y") { return mousey; }
	}


function Favorito(titulo,url)
	{
	if (window.sidebar) { window.sidebar.addPanel(titulo, url,""); } // firefox
	else if( window.external ) { window.external.AddFavorite( url, titulo); } // ie
	else if( window.opera && window.print) { return true; } // opera e outros
	}

function Imprimir(url)
	{
	window.open(url,"ImprimeSITE","width=600,height=500,directories=no,toolbar=yes,resizable=yes,menubar=yes,scrollbars=yes");
	}

function Indique(var1)
	{
	window.open("indique.php?codeps="+var1,"IndiqueSITE","width=500,height=350,directories=no,toolbar=no,resizable=yes,menubar=no,scrollbars=no");
	}


function ContaChar(campo1,campo2,maximo)
	{
	if (campo1.value.length > maximo)
		{
		campo1.value = campo1.value.substring(0,maximo);
		alert( 'Esse campo não pode ter mais do que '+maximo+' caracteres.');
		return false;
		}
	else
		{
		campo2.value = maximo-campo1.value.length;
		}
	}

