/**
 * Retorna TRUE se o browser for Internet Explorer.
 */
function F_isIExplorer() {
    return (navigator.appName != "Netscape");
}

/** Pega o valor de um atributo do objeto **/
function getAttribute(obj, attrName) {
	if(obj == null) return null;
	if(obj.attributes) return obj.getAttribute(attrName);
	return null;
}

function getTBody(obj) {
  nTBody = obj.childNodes.length;
  for (iTBody = 0; iTBody < nTBody; iTBody++) {
      if (obj.childNodes[iTBody].nodeName == 'TBODY') {
         return obj.childNodes[iTBody];
      }
  }
  return null;
}

function isTextNode(node) {
  return (node.nodeName == '#text');
}

function F_openPage(url){
	//contexto absoluto
	if(url.indexOf("/") == 0 || url.indexOf("http://") == 0){
		document.location.href = url
		return
	}
	
	//verifica se existe a tag "base"
	arrayBase = document.getElementsByTagName("BASE")
	if(arrayBase == null || arrayBase[0] == null){
		document.location.href = url
	}else{
		objBase = arrayBase[0]
		hrefBase = new String(objBase.href)
		posBarra = hrefBase.lastIndexOf("/")
		hrefBase = hrefBase.substring(0, posBarra + 1)
		document.location.href = hrefBase + url
	}
}

function F_getElementByNameOrId(doc,nameOrId){
	var obj = doc.getElementById(nameOrId);
	if(obj == null){
		var objs = doc.getElementsByName(nameOrId);
		
		if((objs==null)||(objs.childNodes)){
			return null;
		}
		return objs[0];
	}
	return obj;
}
