//--------------------------------------------------------
//Formatação e validação de número de telefone
//Colocar onKeyUp="tel(this)" no campo do formulário
//Formatar o campo com 14 caracteres
//Mesclar esta função com a função com a formatação de
//campo somente numérico
//--------------------------------------------------------
function tel(elemento){
var telefone
if (elemento.value.length > 0 )
{
if (elemento.value.length == 1)
{
telefone = elemento.value;
elemento.value = '(' + telefone;
elemento.focus();
}
if (elemento.value.length == 3)
{
telefone = elemento.value;
elemento.value = telefone + ') ';
elemento.focus();
}
}
return 0;
}


//--------------------------------------------------------
//Campo somente numérico
// Colocar onkeypress='return numerico(event)' no campo do formulário
//--------------------------------------------------------
function numerico(e) { 
    var tecla=(window.event)?event.keyCode:e.which;
    if((tecla > 47 && tecla < 58)) return true;
    else{
    if (tecla != 8) return false;
    else return true;
    }if(tecla != 9){
		return false;
	}else{
		return true;
	}
    
} 


window.addEvent('domready', function() {
	
	//create our Accordion instance
	var myAccordion = new Accordion($('accordion'), 'h2.toggler', 'div.element', {
		opacity: false,
		onActive: function(toggler, element){
			toggler.setStyle('color', '#CC0000');
		},
		onBackground: function(toggler, element){
			toggler.setStyle('color', '#000000');
		}
	});

});