goBack = function(){
	history.back();
}

selectArea = function(obj){
	if(obj)
		var area = obj.value;
	else
		var area = document.getElementById('selectArea').value;
	$("#selectSubarea").load("contents/contato_subarea.php?area="+area);
}

onClickTop = function(){
	document.location = '/index.php';
}

$ = function (e) { return document.getElementById(e) ; };

contactSend = function () {
	
	nomeCompleto	=	$('nomeCompleto').value;
	email			=	$('email').value;
	fone			=	$('fone').value;
	cidade			=	$('cidade').value;
	mensagem		=	$('mensagem').value;
	
	if(nomeCompleto.length < 5) {
		nomeCompleto.select();
		nomeCompleto.focus();
		return false;
	}
	
	if(email.length < 5) {
		email.select();
		email.focus();
		return false;
	}
	
	if(fone.length < 5) {
		fone.select();
		fone.focus();
		return false;
	}
	
	if(cidade.length < 5) {
		cidade.select();
		cidade.focus();
		return false;
	}
	
	if(mensagem.length < 5) {
		mensagem.select();
		mensagem.focus();
		return false;
	}
	
	return true; 
}

detalhaImagem = function (obj) {
	var url = "/ampliada.php?url=" + escape(obj.src);
	if( url.indexOf('%26w%3D220') > 0 ){
		url = url.substr(0,url.indexOf('%26w%3D220'));
	}
	var janela = window.open(url, 'janela_foto', 'location=0,status=0,scrollbars=0,width=500,height=500');

}

abreVideo = function (url) {
	var janela = window.open(url, 'janela_video', 'location=0,status=0,scrollbars=0,width=350,height=350');
}

checka = function (obj) {
	for(var i=0; i< obj.parentNode.parentNode.childNodes.length; i++) {
		var objeto_atual = obj.parentNode.parentNode.childNodes[i].firstChild;
		
		if(objeto_atual.tagName.toLowerCase() == 'a' && objeto_atual != obj) {
			objeto_atual.className = "";
		}
	}
	
	obj.className = "a_selecionado";
}

subLink = function(){
	var content = document.getElementById('contentC');
	var links = content.getElementsByTagName('a');
	for(i=0;i<links.length;i++){
		if( (links[i].href.indexOf('cid') != -1) && (links[i].href.indexOf('hash') != -1) && links[i].target != '_blank' ){
			var l = links[i].href.substr(links[i].href.indexOf("?")+1);
			links[i].href = "?area=6&"+l;
		}
	}
}

openDiv = function(div){
	var d = document.getElementById(div);
	if(d.style.display == 'none')
		d.style.display = '';
	else
		d.style.display = 'none';
}