function openPopup(URL, width, height, scroll){  
   window.open(URL,'Title', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=' + scroll + ',resizable=yes,copyhistory=no,width='+width+'px,height='+height+'px');
}

function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

  function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }

function somenteMoeda(){
	var tecla = event.keyCode;
	alert(tecla);
	if (!(tecla < 48 || tecla > 57) || tecla == 44 || tecla == 46){
		return true;	
	}else{
		return false;
	}
}


function somenteFloat(){
	var tecla = event.keyCode;
	if (!(tecla < 48 || tecla > 57) || !(tecla < 96 || tecla > 105) || tecla == 188 || tecla == 110 || tecla == 8 || tecla == 46){
		return true;	
	}else{
		return false;
	}
}
function fillColor(layer, rgb){
	document.all[layer].style.backgroundColor = rgb;
}

function hdAll(layerFather, layerSon, nivel, totalNivel, rgbOn, rgbOff){
	var indice = 0;
	while(indice < totalNivel){
		document.all[layerSon + '' + indice].style.display = 'none';
		fillColor(layerFather + '' + indice,rgbOff);
		indice = indice + 1;
	}
	fillColor(layerFather + '' + nivel,rgbOn);
	document.all[layerSon + '' + nivel].style.display = 'block';
}


function fillColorMenu(layerFather, layerSon, rgb){
	if(document.all[layerSon].style.display != 'block'){
		fillColor(layerFather, rgb);	
	}
}

function changeImageMenu(layer, nivel, totalNivel, image01, image02){
	var indice = 0;
	while(indice < totalNivel){
		document.all[layer + '' + indice].src = image01;
		indice = indice + 1;
	}
	document.all[layer + '' + nivel].src = image02;
}

function changeFontBold(layer, nivel, totalNivel){
	var indice = 0;
	while(indice < totalNivel){
		document.all[layer + '' + indice].style.fontWeight = 'normal';
		indice = indice + 1;
	}
	document.all[layer + '' + nivel].style.fontWeight = 'bold';
}

function hideVertical(id){
	obj = document.getElementById(id);
	
	if(obj.style.display == 'none'){
		obj.style.display = 'block';
	}else{
		obj.style.display = 'none'
	}
}
