/*
 * utils.js compiled on 2012-02-21 15:15:13 +0100
 */
(function($){$.cacheJSON=function(json,options){$.post("/cache/",{key:options.key,value:JSON.stringify(json),expires_in:options.expires_in})};$.stealJSON=function(url,options,callback){if(arguments.length==2&&$.isFunction(arguments[1]))var callback=arguments[1];$.getJSON(url,function(json){if(callback)callback(json);$.cacheJSON(json,$.extend({key:url},options))})}})(jQuery);(function($){$.fn.disable=function(){return this.each(function(){var e=$(this);if(e.is("button")||e.is("input"))e.attr("disabled","disabled")});return false}})(jQuery);(function($){$.fn.enable=function(){return this.each(function(){var e=$(this);if(e.is("button")||e.is("input"))e.removeAttr("disabled")});return false}})(jQuery);function in_groups_of(number,array){var slices=[],i=0,count=Math.ceil(array.length/number);while(i<count){var slice=array.slice(i*number,i*number+number);slices.push(slice);i+=1}return slices};(function($){$.linkify=function(text){return text.replace(/(https?:\/\/[\w\-:;?&=+.%#\/]+)/gi,'<a href="$1">$1</a>').replace(/(^|\W)@(\w+)/g,'$1<a href="http://twitter.com/$2">@$2</a>').replace(/(^|\W)#(\w+)/g,'$1#<a href="http://search.twitter.com/search?q=%23$2">$2</a>')}})(jQuery);(function($){$.extend($.fn,{max:function(){return this.sort(function(a,b){return a-b})[this.length-1]},min:function(){return this.sort()[0]},sum:function(){var sum=0;$.each(this,function(i,value){sum+=value});return sum},mapOuterHeight:function(){return this.map(function(){return $(this).outerHeight()})},mapOuterWidth:function(){return this.map(function(){return $(this).outerWidth()})},mapInnerHeight:function(){return this.map(function(){return $(this).innerHeight()})},mapInnerWidth:function(){return this.map(function(){return $(this).innerWidth()})},
mapHeight:function(){return this.map(function(){return $(this).height()})},mapWidth:function(){return this.map(function(){return $(this).width()})},maxOuterHeight:function(){return this.mapOuterHeight().max()},totalOuterHeight:function(){return this.mapOuterHeight().sum()},totalOuterWidth:function(){return this.mapOuterWidth().sum()}})})(jQuery);function redirect_to(url){document.location=url};(function($){$.suggest=function(query,callback){$.getJSON("http://boss.yahooapis.com/ysearch/spelling/v1/"+query+"?appid=YMmp0rnV34FK6y0DzrEzCVftwRfVyFSHiOcXnz0NH2S7e5udxAsarF7y1dBzWfhVMTuy&format=json&callback=?",function(data){if(parseInt(data.ysearchresponse.totalhits)>0){var suggestion=data.ysearchresponse.resultset_spell[0].suggestion;callback(suggestion)}})}})(jQuery);function strip_html(html){var tmp=document.createElement("DIV");tmp.innerHTML=html;return tmp.textContent||tmp.innerText};(function($){$.truncate=function(text,limit){if(text.length>limit)text=text.substr(0,limit-4)+" ...";return text}})(jQuery);
