// Protótipo para função trim das strings
String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g, '');
}

// Protótipo de função que retorna se a string é um email válido ou não
String.prototype.isEmail = function() {
	var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
	return emailPattern.test(this);
} 


// Função para validar a busca por data
function check_search(f) {
	if (f.elements['month'].value == '' || f.elements['year'].value == '') {
		alert('Por favor, escolha mês e ano.');
		return false;
	}
	
	return true;
}



// Funções para aumentar e diminuir o tamanho do texto
function text_size_grow() {
	var t = document.getElementById('text');
	
	text_size_change(t, 1);

	return false;
}

function text_size_shrink() {
	var t = document.getElementById('text');
	
	text_size_change(t, -1);
	
	return false;
}

function text_size_change(e, t) {
	if (document.defaultView) {
		var v = document.defaultView.getComputedStyle(e, "").getPropertyValue('font-size');
	}
	else if (e.currentStyle) {
		var v = e.currentStyle.fontSize;
	}
	
	if (v.indexOf('px') != -1) {
		e.style.fontSize = (parseInt(v)+t) + 'px';
	}
	else {
		e.size = (parseInt(v)+t);
	}
	
	for (var i = 0; i < e.childNodes.length; i++) {
		if (e.childNodes[i].nodeType == 1) text_size_change(e.childNodes[i], t);
	}
}