function show_user_box() {
	document.getElementById("fbUserBox").style.display='block';
}

function update_user_box() {
  var user_box = document.getElementById("fbUserBox");

  // add in some XFBML. note that we set useyou=false so it doesn't display "you"
  user_box.innerHTML =
      "<span>"
    + "Welcome, <fb:name uid='loggedinuser' useyou='false'></fb:name>"
    + "</span>";
    //+ "<fb:profile-pic uid='loggedinuser' ></fb:profile-pic>"
	linkUser();
  // because this is XFBML, we need to tell Facebook to re-process the document 
  FB.XFBML.Host.parseDomTree();
  document.getElementById("fbUserBox").style.display='block';
}

function linkUser() {
	new Ajax.Request('ajax.php?m=linkUser', {
	  onSuccess: function(transport) {
	      // done
	  }
	});	
}

function setTag(tagid) {
	// used on history page
	document.getElementById("tagid").value=tagid;
}

function recordLink(linkid) { // from inbox
	new Ajax.Request('ajax.php?m=recordLink&linkid='+linkid, {
	  onSuccess: function(transport) {
	      // done
	  }
	});		
}

function recordPageVisit(trackid,pageid) {
	// from history page
	new Ajax.Request('ajax.php?m=recordPageVisit&trackid='+trackid+'&pageid='+pageid, {
	  onSuccess: function(transport) {
	      // done
	  }
	});		
}


function refreshInbox() {
	document.getElementById('refreshMsg').innerHTML='...please wait...';
		new Ajax.Request('ajax.php?m=refreshInbox', {
		  onSuccess: function(transport) {
		      // done
			document.location.href='inbox.php';
		  }
		});		
}