// Funções comuns

function limpaTexto(txt,valorpadrao){
	if (txt.value == valorpadrao) {
		txt.value = "";
	}
}

//abrir("http://www.blaze.com.br") - abre na mesma janela
//abrir("http://www.blaze.com.br","_blank") - abre em uma nova janela
//abrir("http://www.blaze.com.br","popup",500,800) - abre em uma janela popup
var popUpWin=0;
function abrir(URLStr, NomeJanela, width, height)
{
	if (NomeJanela == "_blank") {
		window.open(URLStr, '_blank', '');
	}
	if (NomeJanela == "popup") {
		var top = (screen.height / 2) - (height / 2);
		var left = (screen.width / 2) - (width / 2);
	
		if(popUpWin)
		{
			if(!popUpWin.closed) popUpWin.close();
		}
		popUpWin = open(URLStr, 'popUpWin', 'toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top+'');
	}
	if (NomeJanela == "modal"){
		caixa = "window.showModelessDialog(URLStr, 'popUpWin', 'Resizable:no; DialogHeight:" + height + "px; DialogWidth:" + width + "px; Edge:raised; Help:no; Scroll:no; Status:no; Center:yes;');";
		eval(caixa);
	}
	if (NomeJanela == ""){
		window.location.href=URLStr;
	}
}

function maxChar(campo,maximo){
    if (campo.value.length >= maximo){return false}
}

function confirmar(Pergunta, URL){
	var pergunta=confirm(Pergunta)
	if (pergunta){
		window.location.href=URL
	}
}

function voltar(){
	history.go(-1);
}