$(document).ready(vb_Init);

function vb_Init() {
	$("#share").live("click", function(event){
		js_share();		
 	});
	$("#invite").live("click", function(event){
		js_invite();		
 	});
	$("#donate").live("click", function(event){
		js_donate();		
 	});

	//FB.Event.subscribe('edge.create',
	//    function(response) {
	//	$("#thankyou").fadeIn();
	//	$("#start").fadeIn();
	//    }
	//);
	
}
function js_auth() {
	top.location.href=$("#auth_url").val();
}
function js_refresh() {
	top.location.href=$("#fp_app_canvas").val();
}
function js_donate() {
	top.location.href="http://www.unicef.ie";
}
function js_cancel() {
	top.location.href="http://facebook.com";
}
function js_share() {
    
    FB.ui(
       {
         method: 'feed',
         name: "Unicef Just One Appeal",
         link: $("#fp_app_canvas").val(),
	 picture: "http://facebook.nightbluefruit.com/apps/unicefjustone/images/coin.png",
         caption: "I've just donated \u20AC1 and helped save a child's life.",    
         description: " You can too. In the Republic of Ireland, text EURO to 57501 to donate your \u20AC1 to Unicef or just visit justone.ie."
       }
     );

}
function js_invite() {
    FB.ui(
       {
         method: 'apprequests',
         message: "I've just donated \u20AC1 and helped save a child's life. You can too. In the Republic of Ireland, text EURO to 57501 to donate your \u20AC1 to Unicef or just visit justone.ie.",
	 data: 'respond',
	 title: 'Unicef Just One Appeal'
       },
	  function(response) {
	    if (response) {
	      
	    } 
	  }
     );
}

