

var strSearch = location.search.split('?op=');

function menu(){
	
	var op = new Array(
			'quem_somos',
			'diretoria',
			'estatuto',
			'termo_adesao',
			'boletins',
			'noticias',
			'documentos',
			'assessoria_imprensa',
			'fale_conosco'
		);
	
	var label = new Array(
			'Quem Somos',
			'Diretoria',
			'Estatuto',
			'Termo de Adesão',
			'Boletins',
			'Notícias',
			'Documentos',
			'Assessoria de Imprensa',
			'Fale Conosco'
		);

	for(i =0; i < label.length; i++){
		document.write('<li><a href="?op='+op[i]+'"');
		
		if(strSearch[1] == op[i]){
			document.write(' class="menu_selected" ');
		}

		if(i == 7)
			document.write(' style="font-size:12px" ');
			
		document.write(' >'+label[i]+'</a></li>');
		
	}

}

function completeValueInput(obj,strVerificacao){
	
	if(obj.value == strVerificacao){
		obj.value = '';
	}else{
		if(obj.value == ''){
			obj.value = strVerificacao;
		}
	}
	
}

function validaContato(){
	var sMsg = '';
	var bReturn = true;
	
	if($('nome').value == '' || $('nome').value == ' ' || $('nome').value == 'Nome Completo' ){
		sMsg += 'Nome Completo é obrigatório.<BR>';
		bReturn = false;
	}
	
	if($('email').value == '' || $('email').value == ' ' || $('email').value == 'E-mail Válido' ){
		sMsg += 'E-mail Valido é obrigatório.<BR>';
		bReturn = false;
	}
	
	if($('mensagem').value == '' || $('mensagem').value == ' ' || $('mensagem').value == 'Mensagem' ){
		sMsg += 'Mensagem é obrigatória.<BR>';
		bReturn = false;
	}
	
	if(sMsg!=''){
		$('msgError').innerHTML = '<b>Atenção para os seguintes erros encontrados:</b><br>'+sMsg;
		$('msgError').style.display = 'block';
	}else{
		$('msgError').style.display = 'none';
	}
	
	return bReturn;
}


String.prototype.fillToLength = function(theLength, theFillValue) {
	var l = this.length;
	var n = this;
	for (var i = l; i < theLength; i++) {
		n = String(theFillValue) + n;
	}
	return n;
};

Number.prototype.fillToLength = function(theLength) {
	var nbr = new String(this);
	return nbr.fillToLength(theLength, "0");
}; 

Date.prototype.getFullMonth = function() {
	var month = new Number(this.getMonth() + 1);
	return month.fillToLength(2);
}; 

Date.prototype.getFullDay = function() {
	var day = new Number(this.getDate());
	return day.fillToLength(2);
}; 

Date.prototype.getFullDate = function() {
	return this.getFullDay() + "/" + this.getFullMonth() + "/" + this.getFullYear();
}; 

function date(){
	var now = new Date();
	var date = now.getFullDate();
	$('data').innerHTML = date;
}

function controlerDisplayElement(id){
		$(id).style.display = ($(id).style.display == 'none')?'block':'none';
}

var arrDocs = new Array('memoria_reunioes','atas','notas_tecnicas','cartas','outros');

function noneElementsDocs(){
	for(var i = 0; i < arrDocs.length; i++  ){
		noneDisplayElement(arrDocs[i]);
	}
}

function noneDisplayElement(id){
	$(id).style.display = 'none';
}

function blockDisplayElement(id){
	$(id).style.display = 'block';
}

function addClass(id, className){
	$(id).addClassName(className);
}

function delClass(id, className){
	$(id).removeClassName(className);
}

objAppear = function(obj){
		new  Effect.Appear(obj,{duration:1.5});
};

objFade = function(obj){
		new  Effect.Fade(obj, {duration:0.2});
};