//--------------------------------------------------------------
//	Limpa campos do formulário Fale Conosco
//--------------------------------------------------------------

function limpa(obj) {
	obj.value="";
}

function reseta() {
	limpa(document.getElementById('frnome'));
	limpa(document.getElementById('fremail'));
	limpa(document.getElementById('frtelefone'));
	limpa(document.getElementById('frassunto'));
	limpa(document.getElementById('frmensagem'));
}


//--------------------------------------------------------------
//	Envia dados do form Fale Conosco
//--------------------------------------------------------------

function enviar1() {   
	if (confirm('Enviar estes dados?')==true) {
   		f = document.getElementById('form_faleconosco');
   		f.submit();
	}
}


//--------------------------------------------------------------
//	Envia dados do form Trabalhe Conosco
//--------------------------------------------------------------

function enviar2() {   
	if (confirm('Enviar estes dados?')==true) {
   		f = document.getElementById('form_trabalhe');
   		f.submit();
	}
}



//--------------------------------------------------------------
//	Formata os campos com números
//--------------------------------------------------------------

function formata(campo, mask, evt) { 

	if(document.all) { // Internet Explorer 
		key = evt.keyCode;
	 	} 
	  	else{ // Nestcape 
		key = evt.which; 
	} 

	teclasPermitidas = Array(0, 8, 13);

	for (i=0; i < teclasPermitidas.length; i++) {
		if (key == teclasPermitidas[i]) return true;
	}

	string = campo.value;  
	i = string.length;

	if (i < mask.length) {
		if (mask.charAt(i) == '§') {
			return (key > 47 && key < 58);
			} else {
					if (mask.charAt(i) == '!')
						{
							return true;
							}
		for (c = i; c < mask.length; c++) {
			if (mask.charAt(c) != '§' && mask.charAt(c) != '!')
				campo.value = campo.value + mask.charAt(c);
			else if (mask.charAt(c) == '!'){
				return true;
			} else {
					return (key > 47 && key < 58);
					}
		}
	}
	} else return false;
}


//--------------------------------------------------------------
//	Abre pop-up
//--------------------------------------------------------------

function popupp(pagina,nome,w,h,scroll,pos) {
	if (pos=="random") {
		LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
		TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
	}
	if (pos=="center") {
		LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;
	} else if ((pos!="center" && pos!="random") || pos==null) {
		LeftPosition=0;TopPosition=20
	}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win=window.open(pagina,nome,settings);
}
