// JScript File
gadgets.util.registerOnLoadHandler(function() {
    host = 8;
	var req = opensocial.newDataRequest();

	if(typeof opensocial.newIdSpec == 'function') {
		var idspec = opensocial.newIdSpec({ "userId" : "OWNER", "groupId" : "SELF" });
		req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.OWNER), 'owner');
	    req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.VIEWER), 'viewer');
	    req.add(req.newFetchPersonAppDataRequest( idspec, "poll_id" ), "owner_data");
	}
	else{
		req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.OWNER), 'owner');
	    req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.VIEWER), 'viewer');
		req.add(req.newFetchPersonAppDataRequest(opensocial.DataRequest.PersonId.OWNER, ["poll_id"]), "owner_data"); 
	}

    req.send(init_Callback);
});

