var i18n = {"en":{"general":{"confirm":"Are you sure?"},"headers":{"available_widgets":"Available widgets","edit_page_properties":"Edit page and version properties","edit_widget":"Edit widget","media_items":"Media items","versions":"Versions","finalize_version":"Finalize version","publish_version":"Publish version","sitemap":"Sitemap"},"sitemap":{"enter_title":"Enter title","loading":"Loading","new_page":"New page"},"actions":{"ok":"Ok","cancel":"Cancel","preview":"Preview"}},"nl":{"general":{"confirm":"Weet u het zeker?"},"headers":{"available_widgets":"Beschikbare widgets","edit_page_properties":"Eigenschappen van pagina en versie bewerken","edit_widget":"Widget bewerken","media_items":"Media items","versions":"Versies","finalize_version":"Versie voltooien","publish_version":"Versie publiceren","sitemap":"Sitemap"},"sitemap":{"enter_title":"Voer titel in","loading":"Laden","new_page":"Nieuwe pagina"},"actions":{"ok":"Ok","cancel":"Annuleren","preview":"Voorbeeld"}}};

function currentLocale(){ return $('meta[name=locale]').attr('content') || 'en' };
/*!
 * jQuery Raty - A Star Rating Plugin - http://wbotelhos.com/raty
 * 
 * @author  Washington Botelho
 * @twitter wbotelhos
 * @version 1.4.3
 * 
 * Licensed under The MIT License
 * http://opensource.org/licenses/mit-license.php
 * 
 */


(function(e){e.fn.raty=function(r){if(this.length==0){a("Selector invalid or missing!");return;}else{if(this.length>1){return this.each(function(){e.fn.raty.apply(e(this),[r]);});}}var o=e.extend({},e.fn.raty.defaults,r),v=e(this),m=this.attr("id"),n=0,w=o.starOn,s="",u=o.target,l=(o.width)?o.width:(o.number*o.size+o.number*4);if(m===undefined){m="raty-"+v.index();v.attr("id",m);}if(o.number>20){o.number=20;}else{if(o.number<0){o.number=0;}}if(o.path.substring(o.path.length-1,o.path.length)!="/"){o.path+="/";}v.data("options",o);if(!isNaN(parseInt(o.start))&&o.start>0){n=(o.start>o.number)?o.number:o.start;}for(var t=1;t<=o.number;t++){w=(n>=t)?o.starOn:o.starOff;s=(t<=o.hintList.length&&o.hintList[t-1]!==null)?o.hintList[t-1]:t;v.append('<img id="'+m+"-"+t+'" src="'+o.path+w+'" alt="'+t+'" title="'+s+'" class="'+m+'"/>').append((t<o.number)?"&nbsp;":"");}if(o.iconRange&&n>0){b(m,n,o);}var q=e("<input/>",{id:m+"-score",type:"hidden",name:o.scoreName}).appendTo(v);if(n>0){q.val(n);}if(o.half){c(v,e("input#"+m+"-score").val(),o);}if(!o.readOnly){if(u!==null){u=e(u);if(u.length==0){a("Target selector invalid or missing!");}}if(o.cancel){var p=e("img."+m),x='<img src="'+o.path+o.cancelOff+'" alt="x" title="'+o.cancelHint+'" class="button-cancel"/>';if(o.cancelPlace=="left"){v.prepend(x+"&nbsp;");}else{v.append("&nbsp;").append(x);}e("#"+m+" img.button-cancel").mouseenter(function(){e(this).attr("src",o.path+o.cancelOn);p.attr("src",o.path+o.starOff);d(u,"",o);}).mouseleave(function(){e(this).attr("src",o.path+o.cancelOff);v.mouseout();}).click(function(y){e("input#"+m+"-score").removeAttr("value");if(o.click){o.click.apply(v,[null,y]);}});v.css("width",l+o.size+4);}else{v.css("width",l);}v.css("cursor","pointer");h(v,o,u);}else{v.css("cursor","default");k(v,n,o);}return v;};function h(n,m,o){var q=n.attr("id"),p=e("input#"+q+"-score"),l=n.children("img."+q);n.mouseleave(function(){g(n,p.val(),m);f(o,p,m);});l.bind(((m.half)?"mousemove":"mouseover"),function(s){b(q,this.alt,m);if(m.half){var r=parseFloat(((s.pageX-e(this).offset().left)/m.size).toFixed(1));r=(r>=0&&r<0.5)?0.5:1;n.data("score",parseFloat(this.alt)+r-1);c(n,n.data("score"),m);}else{b(q,this.alt,m);}d(o,this.alt,m);}).click(function(r){p.val(m.half?n.data("score"):this.alt);if(m.click){m.click.apply(n,[p.val(),r]);}});}function f(n,o,l){if(n!==null){var m="";if(l.targetKeep){m=o.val();if(l.targetType=="hint"){if(o.val()==""&&l.cancel){m=l.cancelHint;}else{m=l.hintList[Math.ceil(o.val())-1];}}}if(i(n)){n.val(m);}else{n.html(m);}}}function b(l,n,m){var o=e("img."+l).length,t=0,r=0,s,p;for(var q=1;q<=o;q++){s=e("img#"+l+"-"+q);if(q<=n){if(m.iconRange&&m.iconRange.length>t){p=m.iconRange[t][0];r=m.iconRange[t][1];if(q<=r){s.attr("src",m.path+p);}if(q==r){t++;}}else{s.attr("src",m.path+m.starOn);}}else{s.attr("src",m.path+m.starOff);}}}function k(m,o,l){var n="";if(o!=0){o=parseInt(o);n=(o>0&&l.number<=l.hintList.length&&l.hintList[o-1]!==null)?l.hintList[o-1]:o;}else{n=l.noRatedMsg;}m.attr("title",n).children("img").attr("title",n);}function i(l){return l.is("input")||l.is("select")||l.is("textarea");}function g(m,n,l){var o=m.attr("id");if(isNaN(parseInt(n))){m.children("img."+o).attr("src",l.path+l.starOff);e("input#"+o+"-score").removeAttr("value");return;}if(n<0){n=0;}else{if(n>l.number){n=l.number;}}b(o,n,l);if(n>0){e("input#"+o+"-score").val(n);if(l.half){c(m,n,l);}}if(l.readOnly||m.css("cursor")=="default"){k(m,n,l);}}function d(o,n,l){if(o!==null){var m=n;if(l.targetType=="hint"){if(n==0&&l.cancel){m=l.cancelHint;}else{m=l.hintList[n-1];}}if(i(o)){o.val(m);}else{o.html(m);}}}function c(n,p,m){var q=n.attr("id"),l=Math.ceil(p),o=(l-p).toFixed(1);if(o>0.25&&o<=0.75){l=l-0.5;e("img#"+q+"-"+Math.ceil(l)).attr("src",m.path+m.starHalf);}else{if(o>0.75){l--;}else{e("img#"+q+"-"+l).attr("src",m.path+m.starOn);}}}e.fn.raty.cancel=function(l,n){var m=(n===undefined)?false:true;if(m){return e.fn.raty.click("",l,"cancel");}else{return e.fn.raty.start("",l,"cancel");}};e.fn.raty.click=function(o,m){var n=j(o,m,"click"),l=e(m).data("options");if(m.indexOf(".")>=0){return;}g(n,o,l);if(l.click){l.click.apply(n,[o]);}else{a('You must add the "click: function(score, evt) { }" callback.');}return n;};e.fn.raty.readOnly=function(o,m){var n=j(o,m,"readOnly"),l=e(m).data("options"),p=n.children("img.button-cancel");if(m.indexOf(".")>=0){return;}if(p[0]){(o)?p.hide():p.show();}if(o){e("img."+n.attr("id")).unbind();n.css("cursor","default").unbind();}else{h(n,l);n.css("cursor","pointer");}return n;};e.fn.raty.start=function(o,m){var n=j(o,m,"start"),l=e(m).data("options");if(m.indexOf(".")>=0){return;}g(n,o,l);return n;};function j(p,m,l){var n=undefined;if(m==undefined){a("Specify an ID or class to be the target of the action.");return;}if(m){if(m.indexOf(".")>=0){var o;return e(m).each(function(){o="#"+e(this).attr("id");if(l=="start"){e.fn.raty.start(p,o);}else{if(l=="click"){e.fn.raty.click(p,o);}else{if(l=="readOnly"){e.fn.raty.readOnly(p,o);}}}});}n=e(m);if(!n.length){a('"'+m+'" is a invalid identifier for the public funtion $.fn.raty.'+l+"().");return;}}return n;}function a(l){if(window.console&&window.console.log){window.console.log(l);}}e.fn.raty.defaults={cancel:false,cancelHint:"cancel this rating!",cancelOff:"cancel-off.png",cancelOn:"cancel-on.png",cancelPlace:"left",click:null,half:false,hintList:["bad","poor","regular","good","gorgeous"],noRatedMsg:"not rated yet",number:5,path:"img/",iconRange:[],readOnly:false,scoreName:"score",size:16,starHalf:"star-half.png",starOff:"star-off.png",starOn:"star-on.png",start:0,target:null,targetKeep:false,targetType:"hint",width:null};})(jQuery);
(function() {

  $.fn.extend({
    setupReadOnlyRating: function(options) {
      return this.each(function() {
        var $this, element_options;
        $this = $(this);
        element_options = $.extend({
          path: '/assets/raty/',
          start: $this.html(),
          readOnly: true
        }, options || {});
        $this.html('');
        return $this.raty(element_options);
      });
    },
    setupRatings: function() {
      return this.each(function() {
        return $('.rating', $(this)).setupReadOnlyRating();
      });
    },
    setupResponseRating: function() {
      return this.each(function() {
        var $responseRating, $this;
        $this = $(this);
        $responseRating = $('#response_rating', $this);
        $('<div id="response-rating-visualisation"></div>').insertBefore($responseRating);
        $('#response-rating-visualisation').raty({
          path: '/assets/raty/',
          target: '#response_rating',
          targetKeep: true,
          targetType: 'number'
        });
        return $responseRating.hide();
      });
    },
    refreshRatings: function() {
      return this.each(function() {
        var $this;
        $this = $(this);
        $this.find('.average-rating').setupReadOnlyRating({
          size: 24,
          starHalf: 'star-half-big.png',
          starOff: 'star-off-big.png',
          starOn: 'star-on-big.png'
        });
        return $this.setupRatings().setupResponseRating();
      });
    }
  });

  $(function() {
    var $responses;
    $responses = $('#responses-area');
    $responses.refreshRatings();
    $responses.delegate('.delete', 'ajax:success', function() {
      return $(this).closest('.response').remove();
    });
    $responses.bind('ajax:update', function(event) {
      if (event.target !== this) return true;
      return $(this).refreshRatings();
    });
    return $responses.delegate('form', 'ajax:update', function() {
      return $(this).setupResponseRating();
    });
  });

}).call(this);
(function() {



}).call(this);
/*
 * jQuery LiveTwitter 1.7.1
 * - Live updating Twitter plugin for jQuery
 *
 * Copyright (c) 2009-2011 Inge Jørgensen (elektronaut.no)
 * Licensed under the MIT license (MIT-LICENSE.txt)
 * Modified by Bas Veeling on 2011/07/25 for Radio 1 (dutch-y-fied and adapted for Radio 1 Design)
 * $Date: 2011/07/12$

 */

/*jslint browser: true, devel: true, onevar: false, immed: false, regexp: false, indent: 2 */
/*global window: false, jQuery: false */

/*
 * Usage example:
 * $("#twitterSearch").liveTwitter('bacon', {limit: 10, rate: 15000});
 */



(function ($) {

  // Extend jQuery with a reverse function if it isn't already defined
  if (!$.fn.reverse) {
    $.fn.reverse = function () {
      return this.pushStack(this.get().reverse(), arguments);
    };
  }
  
  $.fn.liveTwitter = function (query, options, callback) {
    var domNode = this;
    $(this).each(function () {
      var settings = {};

      // Does this.twitter already exist? Let's just change the settings.
      if (this.twitter) {
        settings = $.extend(this.twitter.settings, options);
        this.twitter.settings = settings;
        if (query) {
          this.twitter.query = query;
        }
        if (this.twitter.interval) {
          this.twitter.refresh();
        }
        if (callback) {
          this.twitter.callback = callback;
        }

      // ..if not, let's initialize.
      } else {

        // These are the default settings.
        settings = $.extend({
          mode:      'search', // Mode, valid options are: 'search', 'user_timeline', 'list', 'home_timeline'
          rate:      15000,    // Refresh rate in ms
          limit:     10,       // Limit number of results
          imageSize: 24,       // Size of image in pixels
          refresh:   true,
          timeLinks: true,
          retweets:  false,
          service:   false,
          localization: {
             seconds: 'seconden geleden',
					    minute:  'een minuut geleden',
					    minutes: 'minuten geleden',
					    hour:    'een uur geleden',
					    hours:   'uur geleden',
					    day:     'een dag geleden',
					    days:    'dagen geleden'
          }
        }, options);
        // showAuthor should default to true unless mode is 'user_timeline'.
        if (typeof settings.showAuthor === "undefined") {
          settings.showAuthor = (settings.mode === 'user_timeline') ? false : true;
        }

        // Set up a dummy function for the Twitter API callback.
        if (!window.twitter_callback) {
          window.twitter_callback = function () {
            return true;
          };
        }

        this.twitter = {
          settings:      settings,
          query:         query,
          interval:      false,
          container:     this,
          lastTimeStamp: 0,
          callback:      callback,

          // Convert the time stamp to a more human readable format
          relativeTime: function (timeString) {
            var parsedDate = Date.parse(timeString);
            var delta = (Date.parse(Date()) - parsedDate) / 1000;
            var r = '';
            if  (delta < 60) {
              r = delta + " " + settings.localization.seconds;
            } else if (delta < 120) {
              r = settings.localization.minute;
            } else if (delta < (45 * 60)) {
              r = (parseInt(delta / 60, 10)).toString() + " " + settings.localization.minutes;
            } else if (delta < (90 * 60)) {
              r = settings.localization.hour;
            } else if (delta < (24 * 60 * 60)) {
              r = '' + (parseInt(delta / 3600, 10)).toString() + " " + settings.localization.hours;
            } else if (delta < (48 * 60 * 60)) {
              r = settings.localization.day;
            } else {
              r = (parseInt(delta / 86400, 10)).toString() + " " + settings.localization.days;
            }
            return r;
          },

          // Update the relative timestamps
          updateTimestamps: function () {
            var twitter = this;
            $(twitter.container).find('span.time').each(function () {
              var time_element = twitter.settings.timeLinks ? $(this).find('a') : $(this);
              time_element.html(twitter.relativeTime(this.timeStamp));
            });
          },
          
          apiURL: function () {
            var params = {};

            var protocol = (window.location.protocol === 'https:') ? 'https:' : 'http:';
            var baseURL  = 'api.twitter.com/1/';
            var endpoint = '';
            
            // Override for Twitter-compatible APIs like Status.net
            if (this.settings.service) {
              baseURL = this.settings.service + '/api/';
            }
            
            // Search mode
            if (this.settings.mode === 'search') {
              baseURL  = (this.settings.service) ? this.settings.service + '/api/' : 'search.twitter.com/';
              endpoint = 'search';
              params   = {
                q:        (this.query && this.query !== '') ? this.query : null,
                geocode:  this.settings.geocode,
                lang:     this.settings.lang,
                rpp:      (this.settings.rpp) ? this.settings.rpp : this.settings.limit
              };
              
            // User/home timeline mode
            } else if (this.settings.mode === 'user_timeline' || this.settings.mode === 'home_timeline') {
              endpoint = 'statuses/' + this.settings.mode + '/' + encodeURIComponent(this.query);
              params = {
                count:       this.settings.limit,
                include_rts: (this.settings.mode === 'user_timeline' && this.settings.retweets) ? '1' : null
              };

            // List mode
            } else if (this.settings.mode === 'list') {
              endpoint = encodeURIComponent(this.query.user) + 
                         '/lists/' + 
                         encodeURIComponent(this.query.list) + 
                         '/statuses';
              params = {
                per_page: this.settings.limit
              };
            }

            // Construct the query string
            var queryString = [];
            for (var param in params) {
              if (params.hasOwnProperty(param) && typeof params[param] !== 'undefined' && params[param] !== null) {
                queryString[queryString.length] = param + '=' + encodeURIComponent(params[param]);
              }
            }
            queryString = queryString.join("&");

            // Return the full URL
            return protocol + '//' + baseURL + endpoint + '.json?' + queryString + '&callback=?';
          },
          
          // The different APIs will format the results slightly different,
          // so this method normalizes the tweet object.
          parseTweet: function (json) {
            var tweet = {
              id:         (json.id_str) ? json.id_str : json.id,
              text:       json.text,
              created_at: json.created_at
            };

            // Search/regular API differences
            if (this.settings.mode === 'search') {
              tweet = $.extend(tweet, {
                screen_name:       json.from_user,
                profile_image_url: json.profile_image_url
              });
            } else {
              tweet = $.extend(tweet, {
                screen_name:       json.user.screen_name,
                profile_image_url: json.user.profile_image_url,
                created_at:        json.created_at.replace(/^(\w+)\s(\w+)\s(\d+)(.*)(\s\d+)$/, "$1, $3 $2$5$4") // Fix for IE
              });
            }
            
            // Twitter/Status.net
            if (this.settings.service) {
              tweet = $.extend(tweet, {
                url:         'http://' + this.settings.service + '/notice/' + tweet.id,
                profile_url: json.user.statusnet_profile_url
              });
              if (window.location.protocol === 'https:') {
                tweet.profile_image_url = tweet.profile_image_url.replace('http:', 'https:');
              }

            } else {
              tweet = $.extend(tweet, {
                url:         'http://twitter.com/#!/' + tweet.screen_name + '/status/' + tweet.id,
                profile_url: 'http://twitter.com/#!/' + tweet.screen_name
              });
              // Someday, Twitter will add HTTPS support to twimg.com, but until then
              // we have to rewrite the profile image urls to the old Amazon S3 urls.
              if (window.location.protocol === 'https:') {
                var matches = tweet.profile_image_url.match(/http[s]?:\/\/a[0-9]\.twimg\.com\/(\w+)\/(\w+)\/(.*?)\.(\w+)/i);
                if (matches) {
                  tweet.profile_image_url = "https://s3.amazonaws.com/twitter_production/" + matches[1] + "/" + matches[2] + "/" + matches[3] + "." + matches[4];
                } else {
                  // Failsafe, if profile image url does not match the pattern above
                  // then, at least, change the protocol to HTTPS.
                  // The image may not load, but at least the page stays secure.
                  tweet.profile_image_url = tweet.profile_image_url.replace('http:', 'https:');
                }
              }
            }
            
            return tweet;
          },
          
          // Parses the tweet body, linking URLs, #hashtags and @usernames.
          parseText: function (text) {
            // URLs
            text = text.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+/, function (m) {
              return '<a href="' + m + '" rel="external">' + m + '</a>';
            });

            // Twitter
            if (!this.settings.service) {
              // @usernames
              text = text.replace(/@[A-Za-z0-9_]+/g, function (u) {
                return '<a href="http://twitter.com/#!/' + u.replace(/^@/, '') + '" rel="external">' + u + '</a>';
              });
              // #hashtags
              text = text.replace(/#[A-Za-z0-9_\-]+/g, function (u) {
                return '<a href="http://twitter.com/#!/search' + u.replace(/^#/, '%23') + '" rel="external">' + u + '</a>';
              });
              
            // Other APIs
            } else {
              text = text.replace(/@[A-Za-z0-9_]+/g, function (u) {
                return '<a href="http://' + settings.service + '/' + u.replace(/^@/, '') + '" rel="external">' + u + '</a>';
              });
              text = text.replace(/#[A-Za-z0-9_\-]+/g, function (u) {
                return '<a href="http://' + settings.service + '/search/notice?q?' + u.replace(/^#/, '%23') + '" rel="external">' + u + '</a>';
              });
            }
            
            return text;
          },
          
          // Renders a tweet to HTML
          renderTweet: function (tweet) {
            var html = '<li class="tweet tweet-' + tweet.id + '">';

            if (this.settings.showAuthor) {
              html += '<div class="avatar"><a href="' + tweet.profile_url + '" rel="external"><img title="' + tweet.screen_name + '" alt="' + tweet.screen_name + '" width="' + this.settings.imageSize + '" height="' + this.settings.imageSize + '" src="' + tweet.profile_image_url + '" /></a></div>';
              //html += '<p class="text"><span class="username"><a href="' + tweet.profile_url + '" rel="external">' + tweet.screen_name + '</a>:</span> ';
            } else {
              html += '';
            }

            html += '<div class="text">' + this.parseText(tweet.text);
            
            if (this.settings.timeLinks) {
              html += ' <span class="time">';
              html += '<a href="' + tweet.url + '" rel="external">';
              html += this.relativeTime(tweet.created_at);
              html += '</a></span>';
            } else {
              html += ' <span class="time">' + this.relativeTime(tweet.created_at) + '</span>';
            }

            html += '</div></li>';

            return html;
          },

          // Handle reloading
          refresh: function (initialize) {
            var twitter = this;
            if (twitter.settings.refresh || initialize) {

              $.getJSON(twitter.apiURL(), function (json) {
                var newTweets = 0;

                // The search and regular APIs differ somewhat
                var results = (twitter.settings.mode === 'search') ? json.results : json;

                $(results).reverse().each(function () {
                  var tweet = twitter.parseTweet(this);
                  
                  // Check if tweets should be filtered
                  if (!twitter.settings.filter || twitter.settings.filter(this)) {
                    // Check if this is actually a new tweet
                    if (Date.parse(tweet.created_at) > twitter.lastTimeStamp) {

                      // Insert the HTML
                      $(twitter.container).prepend(twitter.renderTweet(tweet));

                      // Make a note of the timestamp on the first span
                      // so we can update it later.
                      $(twitter.container).find('span.time:first').each(function () {
                        this.timeStamp = tweet.created_at;
                      });

                      // Fade in new tweets unless this is the first load.
                      if (!initialize) {
                        $(twitter.container).find('.tweet-' + tweet.id).hide().fadeIn();
                      }

                      // Remember the last timestamp for the next refresh.
                      twitter.lastTimeStamp = Date.parse(tweet.created_at);

                      newTweets += 1;
                    }
                  }
                });
                // Did we get any new tweets?
                if (newTweets > 0) {
                  // Remove old entries exceeding the limit
                  $(twitter.container).find('.tweet:gt(' + (twitter.settings.limit - 1) + ')').remove();

                  // Run callback
                  if (twitter.callback) {
                    twitter.callback(domNode, newTweets);
                  }

                  // Trigger event
                  $(domNode).trigger('tweets');
                }
              });
            }  
          },

          // Start refreshing
          start: function () {
            var twitter = this;
            if (!this.interval) {
              this.interval = setInterval(function () {
                twitter.refresh();
              }, twitter.settings.rate);
              this.refresh(true);
            }
          },

          // Stop refreshing
          stop: function () {
            if (this.interval) {
              clearInterval(this.interval);
              this.interval = false;
            }
          },

          // Clear all tweets
          clear: function () {
            $(this.container).find('.tweet').remove();
            this.lastTimeStamp = null;
          }
        };

        var twitter = this.twitter;

        // Update the timestamps in realtime
        this.timeInterval = setInterval(function () {
          twitter.updateTimestamps();
        }, 5000);

        this.twitter.start();
      }
    });
    return this;
  };
})(jQuery);
(function() {

  $.extend({
    getHeaderParam: function(xhr, param) {
      try {
        return xhr.getResponseHeader("X-Glance-" + param);
      } catch (e) {

      }
    },
    getMeta: function(name) {
      return $('meta[name=' + name + ']').attr('content');
    },
    isAdmin: function() {
      return typeof $.getMeta('is_admin') === 'undefined';
    },
    isUser: function() {
      return typeof $.getMeta('user_id') !== 'undefined';
    },
    isGuest: function() {
      return typeof $.getMeta('user_id') === 'undefined';
    }
  });

  $.fn.extend({
    setupContent: function() {
      this.find('.hide-on-load').hide();
      if ($.isGuest()) this.find('.show-for-user').hide();
      if ($.isUser()) this.find('.hide-for-user').hide();
      if ($.isAdmin()) this.find('.show-for-admin').hide();
      return this;
    },
    isEmpty: function() {
      return this.size() === 0;
    }
  });

  $(function() {
    var ajaxFormHandler;
    ajaxFormHandler = function(event, data, status, xhr) {
      var container, result, updates, updatesSelector;
      result = $.getHeaderParam(xhr, "result");
      if (result === "redirect") {
        return window.location = $.parseJSON(data).url;
      } else if (result === "error" || result === "replace") {
        container = $(this).parent();
        $(this).replaceWith(data);
        return container.find("form[data-ajax-form]").setupContent().trigger("ajax:update");
      } else if (result === "update") {
        updatesSelector = $(this).data('updates');
        if (updatesSelector) updates = $(this).closest(updatesSelector);
        if (!updates.isEmpty()) {
          return updates.html(data).setupContent().trigger("ajax:update");
        }
      }
    };
    $("form[data-ajax-form]").live("submit", function(e) {
      var el;
      el = $(this);
      el.data('type', 'html');
      $.rails.handleRemote(el);
      return false;
    }).live("ajax:success", ajaxFormHandler);
    $("a[data-ajax-link]").live("click", function(e) {
      var el;
      el = $(this);
      el.data('type', 'html');
      el.data('method', $(this).data('ajax-method') || 'GET');
      $.rails.handleRemote(el);
      return false;
    }).live("ajax:success", ajaxFormHandler);
    $('body').setupContent();
    return $('.widget-container').trigger('widget:loaded', 'load');
  });

}).call(this);
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//







;

