/* Função utilizada para obter um objet HttpRequest */
function getXmlHttpRequest() {
  var xmlHttp = null;
  try {
    // Objeto utilizando no Firefox, Opera e Safari
    xmlHttp=new XMLHttpRequest();
  }
  catch(e) {
    try {
      // Objeto utilizado no Internet Explorer 6.0
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    } catch(e) {
      // Objeto utilizado no Internet Explorer 5.5
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    }
  return xmlHttp;
}

function getXmlDoc( xml ) {
	if (window.DOMParser) {
		parser = new DOMParser();
		xmlDoc = parser.parseFromString( xml , "text/xml");
		return xmlDoc;
	}
	else {
		// Internet Explorer
		xmlDoc = new ActiveXObject( "Microsoft.XMLDOM");
		xmlDoc.async= "false";
		xmlDoc.loadXML( xml );
		return xmlDoc;
	}
}

//funcao util
function print_r(theObj){
   if(theObj.constructor == Array || theObj.constructor == Object) {
      document.write(" * ");
      for(var p in theObj){
       if(theObj[p].constructor == Array|| theObj[p].constructor == Object){ document.write(" ["+p+"] => "+typeof(theObj)+" "); 
       document.write(" ");
       print_r(theObj[p]); document.write(" ");
       }
       else { 
       document.write(" ["+p+"] => "+theObj[p]+" * "); } } document.write(" ");
   }
}



