Drupal.behaviors.sonyCoppa = function(context) {
  var $u13 = $('input[name="U13"]').not('.sony-coppa-checked');
  if ($u13.length) {
    var ts = new Date();
    var url = 'http://cc.sonymusic.com/check/?' + ts.getTime();
    $u13.addClass('sony-coppa-checked');
    $.getScript(url, function() {
      if (typeof SONYMUSIC_COPPA_13 != 'undefined' && SONYMUSIC_COPPA_13.u13 == true) {
        // We were using the methods that come with the SONYMUSIC_COPPA_13 object,
        // but that code didn't work well. Now we only check the u13 property and
        // change the form items using jQuery.
        $u13.attr("value", true);
      }
    });
  };
};;
if (Drupal.CTools) {
  Drupal.CTools.AJAX.commands.reload = function() {
    location.reload();
  };

  Drupal.CTools.AJAX.commands.redirect = function (data) {
    location.href = data.url;
  };

  Drupal.CTools.AJAX.commands.loadCSS = function (data) {
    var url = Drupal.settings.basePath + data.file;
    if ($('link[href="' + url + '"]').size() == 0) {
      $('<link href="' + url +'" rel="stylesheet" type="text/css" />').appendTo($('body'));
    }
  };
};
Drupal.sonyConnect.twitter = {
  init: function() {
  },

  connect: function(callback) {
    //var popup = window.open(this.href, 'connect', 'width=800,height=400,toolbar=0,scrollbars=0,statusbar=0,menubar=0,resizable=0');
    //$(popup).unload(callback);
  }
};;
Drupal.sonyConnect.facebook = {
  loaded: false,

  init: function() {
    if (!Drupal.sonyConnect.facebook.loaded) {
      Drupal.sonyConnect.facebook.loaded = true;
      // Create the necessary hidden container to avoid the document.write()
      // that the connect.facebook.net js will do otherwise.
      $('<div id="FB_HiddenContainer"></div>')
        .css({
          width: 0,
          height: 0,
          position: 'absolute',
          top: -10000
        }).prependTo($('body'));
      // Load the connect.facebook.net js library.
      $.getScript(document.location.protocol + '//connect.facebook.net/en_US/all.js');
    }
  }
};
;

