/********************************************************************************************
MENU DE PAÍSES
********************************************************************************************/
function findPosX(obj){
	var curleft = 0;
	if (obj.offsetParent){
		while (obj.offsetParent){
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}else if (obj.x)
		curleft += obj.x;
		return curleft;
}

function findPosY(obj){
	var curtop = 0;
	if (obj.offsetParent){
		while (obj.offsetParent){
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
		}else if (obj.y)
			curtop += obj.y;
		 return curtop;
}

function position(obj, reference) {
	if (document.all) {
		var newX = findPosX(reference);
		var newY = findPosY(reference); 
	}else{ 
		var newX = findPosX(reference)+2;
		var newY = findPosY(reference);
	}
	obj.style.left = newX;
	obj.style.top = newY - obj.style.height.substring(0, obj.style.height.indexOf("px"));
}

function abrirMenu(reference,menu) {
	stopTime();	
	var menuDiv = document.getElementById(menu);
	if (menuDiv.style.visibility == "hidden") {
		position(menuDiv, reference);
		menuDiv.style.visibility = "visible";
	}else{
		menuDiv.style.visibility = "hidden";						
	}
}

var intval = ""
function startTime(reference, menu){
	var menuDiv = document.getElementById(menu);
	if(intval=="" && menuDiv.style.visibility == "visible"){
		intval=window.setInterval("abrirMenu('"+ reference +"','"+ menu +"')",2000)
	}else{
		stopTime()
	}
}

function stopTime(){
	if(intval!=""){
		window.clearInterval(intval)
		intval = ""
	}
}
/********************************************************************************************
FIM: MENU DE PAÍSES
********************************************************************************************/
  
/********************************************************************************************
COMBO DE PAISES
********************************************************************************************/
function collapseMenu( whichEl, displayValue ){
	objeto = document.getElementById(whichEl);
	objeto.style.display = displayValue;	
}
/********************************************************************************************/
