function xmlhttpPost(str,Url,tipo) {
	var xmlHttpReq = false;
	var self = this;
	//var strUrl = Url;
	var strURL = Url;
	// Mozilla/Safari
	self.opt=tipo;
	if (window.XMLHttpRequest) {
		self.xmlHttpReq = new XMLHttpRequest();
	}
	// IE
	else if (window.ActiveXObject) {
		self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
	}
	self.xmlHttpReq.open('POST', strURL, true);
	self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	self.xmlHttpReq.onreadystatechange = function(tipo) {
		if (self.xmlHttpReq.readyState == 4) {
				updateSuscrito(self.xmlHttpReq.responseText);
		}
	}
	self.xmlHttpReq.send(str);
}

function updateSuscrito(str){
	document.getElementById("DIV-suscribirse").innerHTML = str;
}

function suscribirse(codCategoria, codUsuario){
	qstr = 'codCategoria=' + codCategoria + '&codUsuario=' + codUsuario + '&tipo=1';  // NOTE: no '?' before querystring
	xmlhttpPost(qstr,"/categorias/suscribirse.phtml",3);
}
function quitarSuscrito(codCategoria, codUsuario){
	qstr = 'codCategoria=' + codCategoria + '&codUsuario=' + codUsuario + '&tipo=2';  // NOTE: no '?' before querystring
	xmlhttpPost(qstr,"/categorias/suscribirse.phtml",3);
}

