// JavaScript Document
// JavaScript Document
// JavaScript Document
bws = null;
if(navigator.appVersion.indexOf('MSIE') > -1)
	bws = 2;
else
	bws = 1;

cont = 0;

function var_dump(obj) {
   if(typeof obj == "object") {
      return "Type: "+typeof(obj)+((obj.constructor) ? "\nConstructor: "+obj.constructor : "")+"\nValue: " + obj;
   } else {
      return "Type: "+typeof(obj)+"\nValue: "+obj;
   }
}//end function var_dump

String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}

function jxReq(){
	jxObj = false;
	if(window.XMLHttpRequest){
		jxObj = new XMLHttpRequest();
	}
	else if(window.ActiveXObject){
		try{
			jxObj = new ActiveXObject("Msxml12.XMLHTTP");
		} catch (e) {
			try{
				jxObj = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
}

function getNoticias(){
	jxReq();
	if(!jxObj){
		window.alert("Erro na chamada.");
		return;
	}
	jxObj.onreadystatechange = function (){
		//document.getElementById('dv_not').innerHTML = '<div align="center"><img src="images/load.gif" width="16" height="16" style="padding-top:20px" /></div>'
		if(jxObj.readyState == 4){
			if(jxObj.status == 200){
				//document.getElementById('dv_not').innerHTML = '';
				var div = document.getElementById('dv_not');
				
				tab = document.createElement('table');
				tab.setAttribute("width",233);
				tab.setAttribute("border",0);
				tab.setAttribute("align","center");
				tab.setAttribute("cellspacing",4);
				tab.setAttribute("cellpadding",2);
				
				tbd = document.createElement('tbody')
				
				var result = jxObj.responseXML;
				var links = result.getElementsByTagName("link");
				var titles = result.getElementsByTagName("title");
				var tx_tit = null;
				var tx_lk = null;
				var li = null;
				var lk = null;
				var not = null;
				var br = null;
				var imm = null;
				for(var ix=2;ix<=3;ix++){
					tx_tit = titles[ix].childNodes[0].data;
					tx_lk = links[ix].childNodes[0].data;
					
					tr = document.createElement('tr');
					td = document.createElement('td');
					td.setAttribute("width",18);
					td.setAttribute("valign","top");
					td.setAttribute("align","left");
					imm = document.createElement('img');
					imm.setAttribute("src","images/bullet_bolaMetal.jpg");
					imm.setAttribute("width",14);
					imm.setAttribute("height",14);
					imm.setAttribute("border",0);
					td.appendChild(imm);
					tr.appendChild(td);
					
					td = document.createElement('td');
					td.setAttribute("align","left");
					td.setAttribute("width",215);
					fn = document.createElement('font');
					fn.setAttribute("size",1);
					fn.setAttribute("face","verdana");
					lk = document.createElement('a');
					lk.setAttribute("href",tx_lk);
					lk.setAttribute("target","_blank");
					not = document.createTextNode(tx_tit.ltrim());
					lk.appendChild(not);
					fn.appendChild(lk);
					td.appendChild(fn);
					tr.appendChild(td);
					
					tbd.appendChild(tr);
				}
				tab.appendChild(tbd);
				div.appendChild(tab);
			}
		}
	};
	jxObj.open('GET','inc/get_rss.asp?ttrs='+Math.floor(Math.random()*1000), true);
	jxObj.send(null);
}

function altClass(nm,cls){
	document.getElementById('dv_'+nm).className = nm+cls;
}
