
var strDefaultAction= 'Header_btnPesquisar';
function cmvmSearchKeyCode(e) {
	var eventObj=null;

	if (typeof(event)!='undefined') {
		eventObj=event;
	}
	
	if (typeof(e)!='undefined') {
		eventObj=e;
	}	
	
	if (eventObj!=null) {
		if (typeof(eventObj.keyCode)!='undefined') {
			return eventObj.keyCode;
		}
		
		if (typeof(eventObj.which)!='undefined') {
			return eventObj.which;
		}								
	}						
	
	return 0;
}
function cmvmTextBoxKeyDown(e) {

	if (cmvmSearchKeyCode(e)==13) {
		document.all[strDefaultAction].click();
		return false;
	}
	return true;
}

function redirectMsgPT() {
    return 'Foi activada uma liga\xE7\xE3o para outro s\xEDtio na Internet cujo conte\xFAdo n\xE3o responsabiliza a CMVM. Deseja continuar?';
}

function redirectMsgEN() {
    return 'You are going to be directed to another website. The CMVM is not responsible for the contents therein.';
}

function redirect_siteExterno(url, message) {
    var ok = window.confirm(message);
    if (ok == true) {
        window.location.href = url;
    } else {
        window.close();
    }
}

function redirect(url) 
{
    retorno = window.confirm(redirectMsgPT());
	if (retorno == true) {
		window.open(url)
    }
}

function redirecten(url) 
{
    retorno = window.confirm(redirectMsgEN());
	if (retorno == true) {
	    window.open(url)
	}
}

function redirect_ext(url, message)
{
	retorno = window.confirm (message);
	if (retorno == true) {
	    window.open(url);
	}
}

function redirectmsg(url, message, replaceCurrentPage, goBack) 
{
	retorno = window.confirm (message);
	if (retorno == true) {
		if (replaceCurrentPage) {
			window.location.replace(url);
		}else {
			window.location.href = url;
		}
	} else {
		if (goBack) {
			history.back();
		}
	}
}


function mostraano()
{
var x=window.document.doc.ano.selectedIndex;
var Anodoc=window.document.doc.ano.options[x].value

window.location.href=''+Anodoc+'.asp';
}

function mostra_mes_ano()
{
var y=window.document.comunicados.mes.selectedIndex;
var x=window.document.comunicados.ano.selectedIndex;
var Mesdoc=window.document.comunicados.mes.options[y].value
var Anodoc=window.document.comunicados.ano.options[x].value

window.location.href='/comunicados/comunicados/com'+Mesdoc+Anodoc+'.asp';
}

function mostra_mes_ano_i()
{
var y=window.document.comunicados.mes.selectedIndex;
var x=window.document.comunicados.ano.selectedIndex;
var Mesdoc=window.document.comunicados.mes.options[y].value
var Anodoc=window.document.comunicados.ano.options[x].value

window.location.href='/english_pages/comunicados/comunicados/com'+Mesdoc+Anodoc+'.asp';
}

function nmostra_mes_ano()
{
var y=window.document.novidades.mes.selectedIndex;
var x=window.document.novidades.ano.selectedIndex;
var Mesdoc=window.document.novidades.mes.options[y].value
var Anodoc=window.document.novidades.ano.options[x].value

window.location.href='/novidades/nov'+Mesdoc+Anodoc+'.asp';
}

function dis(param) {

	param.disabled = 'true';
	param.form.submit();

}

function confirmSubmit() {
	var agree = confirm("Por favor confirme a operação");
	if (agree) {
		return true;
	} else {
		return false;
	}
}

function alternaItem(path) {
	var element = document.getElementById(path);
	if(element!=null)
		element.className = "subMenu_On";
}

function alterna(menu) {
	var element = document.getElementById("LeftNavigation");
	var item;
	var itemMenu;
	for(i=0;i<element.childNodes.length;i++) {
		item = element.childNodes.item(i);
		itemMenu = item.childNodes.item(1);
		if(itemMenu.id==menu) {
			if ( itemMenu.style.display == 'none' || itemMenu.style.display == '' ) {
				itemMenu.style.display = 'block';
				document.getElementById(menu + 'ico').src = '/images/col.gif';
			} else {
				itemMenu.style.display = 'none';
				document.getElementById(menu + 'ico').src = '/images/exp.gif';
			}
		} else {
			itemMenu.style.display = 'none';
			if (document.getElementById(itemMenu.id + 'ico').src.indexOf('/images/null.gif')==-1) {
				document.getElementById(itemMenu.id + 'ico').src = '/images/exp.gif';
			}
		}
	}
}

function expandTree(node) {
	
	var element = document.getElementById(node);
	var li;
	for(i=0; i<element.childNodes.length; i++) {
		if (element.childNodes.item(i).tagName=='UL') {
			for(j=0; j<element.childNodes.item(i).childNodes.length; j++) {
				var li = element.childNodes.item(i).childNodes.item(j);
				if (li.style.display == 'none' ) {
					li.style.display ='block';
					document.getElementById(node + 'ico').src = '/images/col.gif';
				} else {
					li.style.display ='none';
					document.getElementById(node + 'ico').src = '/images/exp.gif';
				}
			}
		}
	}
		
}



