
// apply popups JS if that module exists
Drupal.communityPopupsAfterSubmit = function(data, options, element) {
  if (typeof Popups == 'function') {
    var typeName = Drupal.settings.community.nodeType;
    var $element = $(element);
    var html = $element.html();
    if ($(html + ":contains('Join " + typeName + "')")) {
      Popups.message('You have successfully joined this ' + typeName + '.');
    }
    else if ($(html +":contains('Leave " + typeName + "')")) {
      Popups.message('You have left this ' + typeName + '.');
    }
    location.reload();
    return false;
  };
}

//Ad definition: BugzID:23422 - mvijay
Drupal.dartWallpaperRender = function(options) {
  $(document).ready(function() {
    $("body").css("background", options.background_color + " url(" + options.image_url + ")  top center " + options.background_tiling + " fixed");
    $("body").css("cursor", "pointer");
    $("#wrap > div").css("cursor", "default"); // make the main body section not appear clickable
    $("body").click(function(e) {
      if(e.target.tagName.toLowerCase() == "body"
        || e.target.id.toLowerCase() == "container"
        || e.target.id.toLowerCase() == "wrap") {
        window.open(options.link_url);
      }
    });
  });
}
