//para agregar amigos
//var blockuserPr	 = "http://localhost/shared/sections_inc/account/blockusersr_for_ajax.php"
var blockuserPr	 = "http://www.viveamor.com/shared/sections_inc/account/blockusersr_for_ajax.php"

function PostCommand(_URL_, _VALS_, _UID_){
	
	var retval	= null;
	shapePage();
	document.getElementById("loading_flag").style.display = "block";

	try{
		_obj = AJAXobj();
	}catch(err){
		shapePage();
	}
	_obj.open("POST", _URL_, true);
	_obj.onreadystatechange = function(){
		if(_obj.readyState == 4){
			if(_obj.status == 200){
				hideRow(_UID_);
				document.getElementById("loading_flag").style.display = "none";
				unshapePage();
			}else{
				alert(_obj.status+"\nOcurrió un error al bloquear el usuario");
				document.getElementById("loading_flag").style.display = "none";
				unshapePage();
			}
		}
	}
	_obj.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	_obj.send(_VALS_);
}

function addFriend(userid){
	flagMsg('Agregando...');
	
}

function flagMsg(msg){
	document.getElementById("msgflag").innerHTML = msg;
}

function blockUser(userid){
	var proce = document.getElementById('prblock'+userid).value;
	var param = 'user_id='+userid+'&procedure='+proce;
	var btnpr = 'blockbtn'+userid;
	
	flagMsg('Bloqueando...');
	document.getElementById("loading_flag").style.display = "block";
	PostCommand(blockuserPr, param, userid);
	flagMsg('Cargando...');
}

function hideRow(userid){
	document.getElementById("tr"+userid).style.display = "none";
}