<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="friend count" description="" author="" author_email="" thumbnail="" screenshot="" height="380">
   <Require feature="opensocial-0.7"/>
</ModulePrefs>
<Content type="html">

<![CDATA[
<script type="text/javascript">
function init(){
	/* only interested in friendCount, not the actual friends */
	var params = {max: 1};
	
	var req = opensocial.newDataRequest();
	req.add(req.newFetchPeopleRequest(opensocial.DataRequest.Group.OWNER_FRIENDS, params), 'owner_friends');
	req.send(callback);
}
function callback(dataResponse){
        var owner_friends = dataResponse.get('owner_friends').getData();
        /* owner_friends is of type Collection */
        var friendCount = owner_friends.getTotalSize();
		document.getElementById('content').innerHTML = "Total amount of Owner friends is: " + friendCount;
}
gadgets.util.registerOnLoadHandler(init);
</script>
<div id="content"></div>
]]>
</Content>
</Module>