function tamanhofonte(operador, div)
{
	var maxfont = 19;
	var minfont = 9;
	var fontpadrao = 11;

	if(div.style.fontSize == "")
	{
		div.style.fontSize = fontpadrao;
	}

	var font = parseInt(div.style.fontSize);
	if(operador == '+')
	{
		if(font <= 18 )
		{
			div.style.fontSize = font +=1;
		}
	}
	else
	{
		if(operador == '-')
		{
			if(font >= 10 )
			{
				div.style.fontSize = font -= 1;
			}
		}
	}
}


function limita_caracteres(evtKeyPress ,obj, max)
{
	nTecla = (evtKeyPress.which) ? evtKeyPress.which : evtKeyPress.keyCode;

	if ((nTecla == 8) || (nTecla==9))
	{
		return true;
	}
	else if(obj.value.length>=max)
	{
		return false;
	}
	else
	{
		return true;
	}
}


function isset(varname)
{
	if(typeof( window[ varname ] ) != "undefined") return true;
	else return false;
}



String.prototype.trim = function()
{
	return this.replace(/^\s*/, "").replace(/\s*$/, "");
}



function tamanhofonte(operador, div)
{
	var maxfont = 19;
	var minfont = 9;
	var fontpadrao = 11;

	if(div.style.fontSize == "")
	{
		div.style.fontSize = fontpadrao;
	}

	var font = parseInt(div.style.fontSize);
	if(operador == '+')
	{
		if(font <= 18 )
		{
			div.style.fontSize = font +=1;
		}
	}
	else
	{
		if(operador == '-')
		{
			if(font >= 10 )
			{
				div.style.fontSize = font -= 1;
			}
		}
	}
}


function confirma(texto,pagina)
{
	var resposta=confirm(texto);
	if (resposta==true)
	{
		if(pagina)
		{
			window.location.href=pagina;
		}
		return true;
	}
	return false;
}




function findPosX(obj)
{
	var curleft = 0;
	if(obj.offsetParent)
	while(1)
	{
		curleft += obj.offsetLeft;
		if(!obj.offsetParent)
		break;
		obj = obj.offsetParent;
	}
	else if(obj.x)
	curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if(obj.offsetParent)
	while(1)
	{
		curtop += obj.offsetTop;
		if(!obj.offsetParent)
		break;
		obj = obj.offsetParent;
	}
	else if(obj.y)
	curtop += obj.y;
	return curtop;
}

function pre_load_img(img)
{
	var imagem = new Image();
	imagem.src = img;
}

