var myAppId = '/guid/9202a8c04000641f8000000005b7bd4b';
var urlTestArgs = {};

// TEMPLATE:sample_header.js
// Written by Will Moffat for Metaweb Technologies
mjt.error_reporting.developer = "Will";
mjt.error_reporting.email     = "will_mjt_bugs@hamstersoup.com";
mjt.error_reporting.enabled   = true; // mjt errors will be reported
mjt.error_reporting.app_id = myAppId; // create your own topic on Freebase for your app
mjt.sanitytest.set_query( urlTestArgs ); 
// END:sample_header.js
    
mjt.sanitytest.verify = function() { return $('.fbFullName:contains(Robert Cook)').length == 1; }; //HACK: this shouldn't really PASS because mjt.error is called!

var q;
var mjt;
var locations = {};
var userCount=0;

var query1json = [{
    "member":[{
	"type":"/freebase/user_profile",
	"/common/topic/image":[{
	    "guid":null,
	    "limit":1,
	    "name":null,
	    "optional":true
	}],
	"birthday":null,
	"hometown":[],
	"my_full_name":null,
	"personal_quote":null,
	"id":null,
	"name":null,
	"timestamp":null
    }],
    "name":getSearchStrFromURL(),
    "type":"/type/usergroup"
}];


function getSearchStrFromURL() {
    return mjt.urlquery.searchStr || "Metaweb Staff";
}


function doQueryFinished() {
    if (!q.result.length) { return; } 
    var members = q.result[0].member;
}

function addImage(image) {
    var width = 200;
    var height = 200;
    if (!image) { return ''; } //no image found
    var imageGuid = image.guid;
    var title = image.name || '';
    var html='';
    html +='<span style="float:left; margin-right:5px; width:'+width+'px; height:'+height+'px;" >';
    html += "<img src='http://www.freebase.com/api/trans/image_thumb/"+encodeURIComponent(imageGuid)+"?maxwidth="+width+"&maxheight="+height+"' title='"+title+"' style='border:thin solid black;'></a>";
    html += "</span>";
    return html;
}

