<!-- Google Freind Connect -->
function initAllData() { 
	var req = opensocial.newDataRequest();
	req.add(req.newFetchPersonRequest('VIEWER'), "viewer_data");
	req.send(onData);
}
function onData(data) {
	if (!data.get("viewer_data").hadError()) {
		var viewer = data.get("viewer_data").getData();
		//new Ajax.Request(getRoot()+'/users/gfc_login/'+viewer.getId()+'/'+viewer.getDisplayName(), {method: 'post',asynchronous:true,evalScripts:true,
		  //onSuccess:function(request){window.location = request.responseText; }
	  	//});
		$.ajax({url: '/users/gfc_login/'+viewer.getId()+'/'+viewer.getDisplayName(),
			  success: function(data) {
			    window.location = data;
			  }
		});
	}
}
function show_gfc_image() {
	var req = opensocial.newDataRequest();
	req.add(req.newFetchPersonRequest('VIEWER'), "viewer_data");
	req.send(get_gfc_image);
}		
function get_gfc_image(data) {
	var viewer = data.get("viewer_data").getData();
	var profile_img = viewer.getField(opensocial.Person.Field.THUMBNAIL_URL);
	if ($('gfc_profile_img') != null) {
		$('gfc_profile_img').show();	
		$('gfc_profile_img').innerHTML = "<a href="+getRoot()+"/users/n_view'><img src=" + profile_img + " /></a>";
	}
}
	    							
<!-- End Google Freind Connect -->

