(function($){window.MashedIn={opts:{},init:function(opts){var default_opts={rootURL:"/"};this.opts=$.extend({},default_opts,opts);this.opts.jsURL=this.opts.rootURL+"static/js";this.opts.xmlURL=this.opts.rootURL+"static/xml";this.opts.jsonURL=this.opts.rootURL+"static/json";var self=this;$(function(){self.attachEvent.targetAttributes();self.attachEvent.onErrorHandling()})},Ajax:{_xhr_cache:{},_xhr_cache_count:0,Request:function(url,options,success_callback){var last_num=this._xhr_cache_count-1,last_obj=this._xhr_cache[last_num];if(last_obj&&last_obj.url==url&&last_obj.xhr.readyState!==4){delete this._xhr_cache[last_num];last_obj.xhr.abort()}if($.isFunction(options)){success_callback=options}if(!$.isPlainObject(options)){options={}}options.url=url;var default_opts={},opts=$.extend({},default_opts,options),self=this,old_success=success_callback||opts.success||function(){};opts.success=function(){delete self._xhr_cache[self._xhr_cache_count-1];return old_success.apply(this,arguments)};self._xhr_cache[self._xhr_cache_count++]={url:url,xhr:$.ajax(opts)};return}},attachEvent:{onErrorHandling:function(){var $imgs=$("img.profile");if(!$imgs.length){return}$imgs.each(function(){var $self=$(this);$self.error(function(){var pid=$self.attr("id").split("_")[1];(_gaq=window._gaq||[]).push(["_trackEvent","User","ErrorPhotoOnError",pid])})})},targetAttributes:function(){$("a.target_blank").attr("target","_blank");$("a.target_top").attr("target","_top")}},Cookie:{set:function(name,value,options){if(typeof value!="undefined"){options=options||{};if(value===null){value="";options.expires=-1}var expires="";if(options.expires&&(typeof options.expires=="number"||options.expires.toUTCString)){var date;if(typeof options.expires=="number"){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000))}else{date=options.expires}expires="; expires="+date.toUTCString()}var path=options.path?"; path="+(options.path):"";var domain=options.domain?"; domain="+(options.domain):"";var secure=options.secure?"; secure":"";document.cookie=[name,"=",encodeURIComponent(value),expires,path,domain,secure].join("")}else{var cookieValue=null;if(document.cookie&&document.cookie!==""){var cookies=document.cookie.split(";");for(var i=0;i<cookies.length;i++){var cookie=$.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+"=")){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break}}}return cookieValue}},get:function(name){return this.set(name)},remove:function(name,options){return this.set(name,null,options)}},Page:{},Template:{_cache:{},append:function(tpl,data){return this._replacement(tpl,data)},draw:function(selector,data){if(!this._cache[selector]){this._cache[selector]=$(selector).html()}return this._replacement(this._cache[selector],data)},_replacement:function(t,data){return t.replace(/<%=?(.*?)%>/g,function(matched,group){var g=group.replace(/^\s+|\s+$/g,"");return(data&&typeof(data[g])!=="undefined")?data[g]:matched})}}}})(jQuery);function log(){(window.console&&console.log&&console.log.apply(console,arguments))};
