$(document).ready(function(){
	var qs = new Querystring();
	var social_session_key=getQueryStringValue("social_session_key");
	var promoUrl=render_app + "&path=promotions.php&action=get_all";
	if(social_session_key!=""){
		promoUrl=promoUrl+"&social_session_key="+social_session_key;
	}
	
	asynRequest(promoUrl+"&format=JSON&callback=handlePromotionData");

});

function handlePromotionData(json) {
	var uid=getQueryStringValue("fb_sig_user");
	var user_name=getQueryStringValue("user_name");			
	var pictureController=new PromotionPagerClass(json.content,render_fbml,uid,user_name);
	pictureController.onFbmlSet=function(fbml){
		var suggestionDiv = document.getElementById('suggestions');
		//log("This FBML is in the suggestions div:"+fbml);
		suggestionDiv.innerHTML=fbml;
		rswidget.renderAllWidgets({apiKey:'c8ac26c11d2aae19f9511bc7bb7da12f',
			renderEndpoint:'http://fulcrum.ringsidenetworks.com/ringside/render.php',
			loginServer:'http://www.facebook.com',
			trustEndpoint:'http://fulcrum.ringsidenetworks.com/ringside/trust.php',
			trustKey:'facebook',
			supressErrors:true
		});
		
	}
	pictureController.render();
}