// MENU

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'block':(v=='hide')?'none':v; }
    obj.display=v; }
}

function busca(acao) {
	if (acao == 0) {MM_showHideLayers('busca_completa','','hide');}
	if (acao == 1) {MM_showHideLayers('busca_completa','','show');}
}

var palavraChave = 'palavra chave...';

function submeteBusca(frmForm){

	frmForm.cl.value = escape(getSelectedRadio('tipo_busca'));
	frmForm.cl.value += (frmForm.categoria.options[frmForm.categoria.options.selectedIndex].value != "") ? "/" + frmForm.categoria.options[frmForm.categoria.options.selectedIndex].value : "" ;
	frmForm.cl.value += ((frmForm.ano.value != "") && (!frmForm.ano.disabled)) ? "/" + frmForm.ano.value : "" ;

	if((frmForm.qu.value != palavraChave) && (frmForm.cl.value != "")){
		frmForm.submit();
		return true;
	}else{
		alert("Preencha o campo de texto");
		return false;
	}

}

function getSelectedRadio(strRadio){

	var arrObjRadio = window.document.getElementsByName(strRadio);

	for(i = 0; i < arrObjRadio.length; i++)
	{
		if(arrObjRadio[i].checked)
		{
			return arrObjRadio[i].value.substring(0,arrObjRadio[i].value.length);
		}
	}

	return "";

}

function changeCategoria(itemForm){
	itemForm.form.ano.disabled = (itemForm.options[itemForm.options.selectedIndex].value == '');
}

function getPalavraChave(itemForm){
	if (itemForm.value==palavraChave){itemForm.value='';}
}

function getPalavraChaveBlur(itemForm){
	if (itemForm.value==''){itemForm.value=palavraChave;}
}