function tMenu(idA,idB) {
	document.getElementById(idA).style.display = 'none';
	document.getElementById(idB).style.display = 'block';			
}

function tMenuA(id) {
	document.getElementById(id).style.display=document.getElementById(id).style.display=='none'?'block':'none';
}

function popcoment(num) {
	lnk = "comentarios.asp?tid=" + num;
	window.open(lnk,'pop'+num,'width=400,height=360,resizable=0,status=0,menubar=0,scrollbars=1,left=100,top=100');	
}
function popenvia() {
	lnk = "enviamail.asp?loc=" + location.href;
	window.open(lnk,'popenvia','width=385,height=440,resizable=0,status=0,menubar=0,scrollbars=0,left=100,top=100');	
}
function popup(lnk,pop,w,h) {
	window.open(lnk,pop,'width='+w+',height='+h+',top=100,left=100,resizable=0,status=0,menubar=0,scrollbars=0');
}
function popupsc(lnk,pop,w,h) {
	window.open(lnk,pop,'width='+w+',height='+h+',top=100,left=100,resizable=0,status=0,menubar=0,scrollbars=1');
}
function popprint(num) {
	lnk = "textoprint.asp?tid=" + num;
	window.open(lnk,'pop'+num,'width=600,height=450,resizable=0,status=0,menubar=0,scrollbars=1,left=100,top=100');	
}

var msg = '';

function votar(obj,uid) {
	if(obj.id == 'voto') {
		alert('Obrigado por participar!');
	} else {
		msg = new xmlObj( { url:'votar.asp?uid=' + uid } );
		obj.id = 'voto';
	}
}

function confirma(m) {
	alert(m);
	msg = null;
}

function xmlObj(args) {
	this._args = args;
	this.load();
}

xmlObj.prototype.load = function() {
	//get a new XMLHTTPRequest and store it in an instance var.
	this._request = this._getXMLHTTPRequest();
	//set the var so we can scope the callback
	var _this = this;
	// callback will be an anonymous function that calls back into our class
	// this allows the call back in which we handle the response (_onData())
	// to have the correct scope.
	this._request.onreadystatechange = function(){_this._onData()};
	this._request.open("GET",this._generateDataUrl(), true);
	this._request.send(null);
}

/* --------------------------------------------------------------- */

//return the URL from which the data will be loaded
xmlObj.prototype._generateDataUrl = function() {
	return this._args.url;
}

//callback for when the data is loaded from the server
xmlObj.prototype._onData = function() {
	if(this._request.readyState == 4) {
		if(this._request.status == "200") {
			confirma(this._request.responseText);
		} else {
			//check if an error callback handler has been defined
			if(this.onError != undefined) {
				//pass an object to the callback handler with info
				//about the error
				this.onError({status:this_request.status, 
						statusText:this._request.statusText});
			}
		}
		//clean up
		delete this._request;
	}
}

//returns an XMLHTTPRequest instance (based on browser)
xmlObj.prototype._getXMLHTTPRequest = function(){
	var xmlHttp;
	try	{
		xmlHttp = new ActiveXObject("Msxml2.XMLHttp");
	} catch(e) {
		try {
			xmlHttp = new ActiveXObject("Microsoft.XMLHttp");
		} catch(e2) {}
	}
	if(xmlHttp == undefined && (typeof XMLHttpRequest != 'undefined')) {
		xmlHttp = new XMLHttpRequest();
	}
	return xmlHttp;
}