function Widget() {
	
	this.rbsProxy;
	
	this.loaded = function(obj) {
		var t, objs = obj.parentNode.childNodes;
		
		for (var i=0; i<objs.length; i++)
			if (objs[i].className == "ct") {
				if (objs[i].getAttribute("rel") == undefined)
					obj = objs[i].firstChild;
				else
					obj = objs[i];
			}
		
		t = (obj.getAttribute("rel")).replace(/,/ig, "_");
		
		obj.id += "_";
		obj.id += t;
		
		widRbs.getContent(getUrl(obj), obj, obj.id);
	}
	
	this.getContent = function(url, obj, t) {
		var sc,n;
		
		sc = document.createElement("script");
		n = 0;
		
		obj.innerHTML = "<p class=\"nresult\">Carregando...</p>";
		
		sc.src = "http://www.clicrbs.com.br/widgets/noticias/jsp/proxy.jsp?url="+ escape(url) +"&callback=widRbs.getContentAux&id="+ t;
		obj.parentNode.appendChild(sc);
	}
	
	function getUrl(obj) {
		var arr,uf,lc,cn,sc,ct,es;
		
		arr = obj.getAttribute("rel").split(",");
		uf = arr[0];
		lc = arr[1];
		cn = arr[2];
		sc = arr[3];
		ct = arr[4];
		es = arr[5];
		
		return "http://www.clicrbs.com.br/widgets/noticias/jsp/default.jspx?uf="+ uf +"&local="+ lc +"&action=widgetContent&canal="+ cn +"&secao="+ sc +"&cartola="+ ct +"&especial="+ es +"&omit=true";
	}
	
	this.getContentAux = function(t, ct) {
		try {
			widRbs.rbsProxy = ct;
			var dv = document.getElementById(t);
			
			if (ct) {
				dv.innerHTML = ct;
				try {
					wizRbs.setLinksNull();
				} catch(e) {}
			} else
				dv.innerHTML = "Erro";
		} catch(e) {}
	}
	
} var widRbs = new Widget();