$(function(){
  var gigya_config={
      widgetTitle: $("#wall_title").text(),
      widgetDescription: "A 3D wall of rich media brought to you by Cooliris",
      useFacebookMystuff: 'false', 
      // facebookURL: 'http://www.cooliris.com/',
      defaultContent: "gigya_embed_code", 
      facebookURL: 'http://www.facebook.com/sharer.php?u='+encodeURIComponent(location)+'&t='+encodeURIComponent($("#wall_title").text()),
      UIConfig: '<config baseTheme="v2"><display showEmail="false" useTransitions="false" showPost="true" showBookmark="false" networksToHide="igoogle" networksToShow="blogger, typepad, wordpress, facebook, twitter, myspace, yahoo, livejournal, livespaces, friendster, orkut, bebo, tagged, hi5, piczo, freewebs, blackplanet, myyearbook, vox, xanga, multiply, netvibes, pageflakes, migente, ameba, liverdoor, eons, overblog, *"></display><body><background frame-color="#000000" background-color="Transparent" frame-thickness="0" gradient-color-begin="Transparent" gradient-color-end="Transparent" corner-roundness="1;1;1;1"></background><controls color="#F4F4F4" font="Arial" size="12"><snbuttons frame-color="#666666" over-frame-color="#dbdbdb" color="#F4F4F4" gradient-color-begin="#6A6A6A" gradient-color-end="#2B2B2B" bold="true" down-frame-color="#074F7F" down-gradient-color-begin="#000000" over-gradient-color-end="#606060" down-gradient-color-end="#4A4A4A" over-color="#074F7F" down-color="#074F7F" over-bold="true" over-gradient-color-begin="#8A8A8A" down-bold="true"><more frame-color="#666666" over-frame-color="#dbdbdb" gradient-color-begin="#6A6A6A" gradient-color-end="#2B2B2B" over-gradient-color-begin="#8A8A8A" over-gradient-color-end="#606060" down-frame-color="#074F7F" down-gradient-color-begin="#000000" down-gradient-color-end="#4A4A4A"></more><previous frame-color="#666666" over-frame-color="#dbdbdb" gradient-color-begin="#6A6A6A" gradient-color-end="#2B2B2B" over-gradient-color-begin="#8A8A8A" over-gradient-color-end="#606060" down-frame-color="#074F7F" down-gradient-color-begin="#000000" down-gradient-color-end="#4A4A4A"></previous></snbuttons><servicemarker gradient-color-begin="#074F7F" gradient-color-end="#074F7F"></servicemarker></controls><texts color="#F4F4F4" bold="true"><messages color="#FFFFFF" background-color="#666666"></messages><links color="#F4F4F4"></links></texts></body></config>'
  };

  // Wildfire.initPost('902051', 'divWildfirePost', 260, 300, gigya_config);
  
  $("#shareDialog").dialog({
    autoOpen: false,
    modal: true,
    resizable: false,
    title: "Share",
    width: 300,
    buttons: {
      "Cancel": function(){
        $(this).dialog('close');
      }
    }
  });
  
  $("a.share_wall").click(function(){
    $("#shareDialog").dialog('open');
    Wildfire.initPost('902051', 'divWildfirePost', 260, 300, gigya_config);
    return false;
  });
  
  $("a.delete_wall").click(function(){
    var that = this;
    var wall_id = $(this).attr("id").replace("delete-", "");
    var wall_title = $("#wall_title").text();
    if (confirm('Are you sure you want to delete the wall "' + wall_title + '"?  This action cannot be undone.')) {
      var data = {
          wall_id: wall_id,
          session_token: User.getSessionToken()
      };
      
      $.postJSON("delete.php", data, function(response){
        if (response.success) {
          window.location = "/yoursite/express/builder/";
          // $(that).parent().fadeOut(function(){$(this).remove();});
        }
      });
    }
    return false;
  });
  
  User.init();
});

