// JavaScript Document
function $(o){
	if( ! document.getElementById(o)) { alert('Objeto com nome de '+o+' não encontrado'); return false; }
	else return document.getElementById(o);
}

var iniciou = false;
var menuO = 0;
var lO = null;

function ajusta(lista){
	
	
	var l = lista.split(',');
	
	
	//alert(dump(l,0));
	var maior = 0;
	maior = parseInt($(l[0]).offsetHeight);	
	
	for(i=1;i<l.length;i++)		{
		if( is_numeric($(l[i]).offsetHeight) && is_numeric(maior) )
			if( parseInt($(l[i]).offsetHeight) > parseInt(maior) )
				maior = $(l[i]).offsetHeight;
	}
	
	for(i=0;i<l.length;i++){
		$(l[i]).style.height = maior + "px";
	}
	
	var espacoPlus = 160;
	
	if( (document.URL.indexOf('index.htm') > -1) || (document.URL.indexOf('.htm') == -1) )
		var menuTam = parseInt($('menu').offsetHeight) - parseInt($('sobre-chaleira').style.height);
	else
		var menuTam = $('menu').offsetHeight - $('sobre-chaleira').style.height;
		
	if( (document.URL.indexOf('index.htm') > -1) || (document.URL.indexOf('.htm') == -1) ){
		
		maior += 673;
		
		if(  menuTam > maior )
			espacoPlus = 615;
		else
			espacoPlus = 0;
	}
	
	if(menuTam > maior)
		for(i=0;i<l.length;i++){
			$(l[i]).style.height = (menuTam - espacoPlus) + "px";		
			//alert( $(l[i]).style.height );
		}
	else if(menuTam < maior){
		var diff = maior - menuTam;
		$('sobre-chaleira').style.height = (diff + espacoPlus) + 'px';
	}
	
	//alert(menuTam  + ":" + maior + " : " + $(l[0]).style.height + " : " + espacoPlus );
	
}

/**
* Function : dump()
* Arguments: The data - array,hash(associative array),object
*    The level - OPTIONAL
* Returns  : The textual representation of the array.
* This function was inspired by the print_r function of PHP.
* This will accept some data as the argument and return a
* text that will be a more readable version of the
* array/hash/object that is given.
*/
function dump(arr,level) {
var dumped_text = "";
if(!level) level = 0;

//The padding given at the beginning of the line.
var level_padding = "";
for(var j=0;j<level+1;j++) level_padding += "    ";

if(typeof(arr) == 'object') { //Array/Hashes/Objects
 for(var item in arr) {
  var value = arr[item];
 
  if(typeof(value) == 'object') { //If it is an array,
   dumped_text += level_padding + "'" + item + "' ...\n";
   dumped_text += dump(value,level+1);
  } else {
   dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
  }
 }
} else { //Stings/Chars/Numbers etc.
 dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
}
return dumped_text;
} 