function question( pergunta )
{
	if ( confirm( pergunta ) ) {
		return true;
	} else {
		return false;
	}
}

// Abre uma janela popup
function popup ( url, nome, largura, altura, posicao, resize, barras ) {
	if ( posicao == 0 ) {
		posleft = 20;
		postop  = ( screen.height ) ? ( screen.height - altura ) / 2 - 50 : 100;
	} else if ( posicao == 1 ) {
		posleft = ( screen.width ) ? ( screen.width - largura ) / 2 : 100;
		postop  = ( screen.height ) ? ( screen.height - altura ) / 2 - 50 : 100;
	} else if (posicao == 2 ) {
		posleft = ( screen.width ) ? ( screen.width - largura ) - 28 : 100;
		postop  = ( screen.height ) ? ( screen.height - altura ) / 2 - 50 : 100;
	}
	opBarras = ( barras ) ? "yes" : "no";
	opResize = ( resize ) ? "yes" : "no";

	settings = 'z-lock=yes, width=' + largura + ', height=' + altura + ', top=' + postop + ', left=' + posleft + ', scrollbars=' + opBarras + ', location=no, directories=no, status=no, menubar=no, toolbar=no, resizable=' + opResize;
	window.open( url, nome, settings );
}

function checkForm()
{

	var erro = '';
	
	if (document.f.nome.value=='') {
		erro += '- O campo NOME é obrigatório!\n';
	}
	
	if (document.f.email.value=='') {
		erro += '- O campo EMAIL é obrigatório!\n';
	}
	
	if (document.f.mensagem.value=='') {
		erro += '- O campo MENSAGEM é obrigatório!\n';
	}
	
	if (erro != '') {
		alert( 'ERROS:\n\n' + erro );
		return false;
	}
}

function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else 
countfield.value = maxlimit - field.value.length;
}