// usage: log('inside coolFunc', this, arguments);
// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
window.log = function(){
    log.history = log.history || [];   // store logs to an array for reference
    log.history.push(arguments);
    arguments.callee = arguments.callee.caller;  
    if(this.console) console.log( Array.prototype.slice.call(arguments) );
};
// make it safe to use console.log always
(function(b){
    function c(){}
    for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();)b[a]=b[a]||c
        })(window.console=window.console||{});


// place any jQuery/helper plugins in here, instead of separate, slower script files.

//  $.fn.lettering 1.0  -- MIT/GPL Licensed - More info: http://github.com/maranomynet/Lettering.js/
(function(f){var l=f.fn.lettering=function(a,c){var b=f.extend({},m,j[a]||a||j.letters,c);return this.each(function(){b.textTransform=f(this).css("text-transform");b.prep&&b.prep(this);k.call(this,b);b.num&&f(this).find(b.tag+"."+b.cl.replace(/\s/g,".")).addClass(function(a){return b.cl+(a+1)})})},k=function(a){for(var c=this.nodeType,c=a.split?f(this).text().split(a.split):c==3?this.nodeValue.split(""):c==1?this.childNodes:[],b,i=[],g=c.length,h=a.textTransform;g--;){var d=c[g];if(d)if(typeof d== "string"){var e=d;if(h!="none")if(h=="uppercase")e=d.toUpperCase();else if(h=="lowercase")e=d.toLowerCase();else if(h=="capitalize"&&(g==0||g>0&&c[g-1]==" "))e=d.toUpperCase();b="";a.addAttr&&(e=a.matAttr?a.mapAttr.call(e):e,b=' data-cont="'+(e=='"'?"&quot;":e)+'"');i.push('<span class="'+a.cl+'"'+b+">"+d+"</span>"+(a.after||""))}else k.call(d,a)}i.length&&f(this)[a.split?"html":"replaceWith"](i.reverse().join(""))},j=l.presets={letters:{},kern:{addAttr:!0,num:!1},words:{split:/\s+/,cl:"word",after:" "}, lines:{cl:"line",prep:function(a){this.split="|"+(new Date).getTime()+"|";f(a).find("br").replaceWith(this.split)}}},m=l.defaults={tag:"span",cl:"char",num:!0}})(jQuery);


/*! Copyright (c) 2010 Tom Ellis (http://www.webmuse.co.uk)
* Licensed under the MIT License (LICENSE.txt).
*/
(function(a){function r(g){g=a.trim(g).replace(t,"").replace(u,v);g=g.replace(w,x);return g.split("|")}if(a.cssHooks){var g=/\s/,t=/\s/g,w=/\,rgb/gi,u=/\,hsl/gi,x="|rgb",v="|hsl",n=/(rgb|hsl)(a?)(\()/i,y="background backgroundImage listStyleImage".split(g),i=document.createElement("div");i.style.cssText="background-image:gradient(linear,left top,right bottom, from(#9f9), to(white));background-image:-webkit-gradient(linear,left top,right bottom,from(#9f9),to(white));background-image:-moz-gradient(linear,left top,right bottom,from(#9f9),to(white));background-image:-o-gradient(linear,left top,right bottom,from(#9f9),to(white));background-image:-ms-gradient(linear,left top,right bottom,from(#9f9),to(white));background-image:-khtml-gradient(linear,left top,right bottom,from(#9f9),to(white));background-image:linear-gradient(left top,#9f9, white);background-image:-webkit-linear-gradient(left top,#9f9, white);background-image:-moz-linear-gradient(left top,#9f9, white);background-image:-o-linear-gradient(left top,#9f9, white);background-image:-ms-linear-gradient(left top,#9f9, white);background-image:-khtml-linear-gradient(left top,#9f9, white);"; a.support.linearGradient=i.style.backgroundImage.indexOf("-moz-linear-gradient")>-1?"-moz-linear-gradient":i.style.backgroundImage.indexOf("-webkit-gradient")>-1?"-webkit-gradient":i.style.backgroundImage.indexOf("linear-gradient")>-1?"linear-gradient":!1;i.style.cssText="background-image:-webkit-gradient(radial, center center, 0, center center, 100, from(orange), to(red)); gradient(radial,left top,right bottom, from(#9f9), to(white));background-image:-webkit-gradient(radial,left top,right bottom,from(#9f9),to(white));background-image:-moz-gradient(radial,left top,right bottom,from(#9f9),to(white));background-image:-o-gradient(radial,left top,right bottom,from(#9f9),to(white));background-image:-ms-gradient(radial,left top,right bottom,from(#9f9),to(white));background-image:-khtml-gradient(radial,left top,right bottom,from(#9f9),to(white));background-image:radial-gradient(left top,#9f9, white);background-image:-webkit-radial-gradient(left top,#9f9, white);background-image:-moz-radial-gradient(left top,#9f9, white);background-image:-o-radial-gradient(left top,#9f9, white);background-image:-ms-radial-gradient(left top,#9f9, white);background-image:-khtml-radial-gradient(left top,#9f9, white);"; a.support.radialGradient=i.style.backgroundImage.indexOf("-moz-radial-gradient")>-1?"-moz-radial-gradient":i.style.backgroundImage.indexOf("-webkit-gradient")>-1?"-webkit-gradient":i.style.backgroundImage.indexOf("radial-gradient")>-1?"radial-gradient":!1;var p=null,z={"left top":"left top, right bottom","left bottom":"left bottom, right bottom","right top":"right top, left bottom","right bottom":"right bottom, left bottom","right center":"right bottom, left bottom","left center":"left bottom, right bottom", "center top":"left top, left bottom","center bottom":"left bottom, left top","center center":"-100% -100%, 0% 0%","top left":"top left, bottom right",top:"left top, left bottom",bottom:"left bottom, left top",left:"left top, right top",right:"left top, right top"},s={center:"center center, 0, center center","farthest-side":"60%",standard:"center center, 0, center center"};a.support.isWebkit=a.support.linearGradient==="-webkit-gradient"?!0:!1;a.cssHooks||a.error("jQuery 1.4.3+ is needed for this plugin to work"); a.support.linearGradient&&a.support.linearGradient!=="linear-gradient"&&a.each(y,function(i,o){a.cssHooks[o]={set:function(i,k){if(/^(.*)(:?linear-gradient|linearGradient)(.*)$/i.test(k)){var q=i.style;var e=k,h=/^(.*)(:?linear-gradient|linearGradient)(\()(.*)(\))(.*)$/i.exec(e),c=[],f,b,j,e=e.replace(h[2],a.support.linearGradient),c=n.test(a.trim(h[4]))?r(h[4]):a.trim(h[4]).split(",");if(c.length===2)a.support.isWebkit&&(e="-webkit-gradient(linear, {position} {colours} )".replace("{colours}","left top, left bottom, from("+ c[0]+"), to("+c[1]+")"),e=e.replace("{position}",""),e=h[1]+e+" "+h[6]);else{b=c[0];c[1]=a.trim(c[1]);j=c[1].split(g).length!==1?parseInt(c[1].split(g)[1])/100:"0";f="color-stop("+j+"%, "+c[1].split(" ")[0]+")";for(var l=[],m=1,d=2;d<c.length;d++)c[d]=a.trim(c[d]),n.test(a.trim(c[d]))?j=d==c.length-1?"100":100/d:(j=c[d].split(g).length!==1?parseInt(c[d].split(g)[1])/100:Math.round(100/(c.length-2))/100,j=d==c.length-1?"100":j*m),l.push("color-stop("+j+"%, "+c[d].split(g)[0]+")"),m++;c=l.join(", "); a.support.isWebkit&&(e="-webkit-gradient(linear, {position} {colours} )".replace("{colours}",","+f+","+c),e=e.replace("{position}",z[b]||b),e=h[1]+e+" "+h[6])}q[o]=e}else if(/(^|\s)(:?radial-gradient|radialGradient)(.*)$/i.test(k)){p=i;q=i.style;f=k;h=/^(.*)(:?radial-gradient|radialGradient)(\()(.*)(\))(.*)$/i.exec(f);b=[];f=f.replace(h[2],a.support.radialGradient);b=n.test(a.trim(h[4]))?r(h[4]):a.trim(h[4]).split(",");if(b.length===2)a.support.isWebkit&&(f="-webkit-gradient(radial, {position} {colours} )", e=a(p).width()*0.8,f=f.replace("{colours}",s.standard+","+e+", from("+b[0]+"), to("+b[1]+")"),f=f.replace("{position}",""),f=h[1]+f+" "+h[6]);else{e=b[0];b[1]=a.trim(b[1]);j=b[1].split(g).length!==1?parseInt(b[1].split(g)[1])/100:"0";c="color-stop("+j+", "+b[1].split(" ")[0]+")";l=[];m=1;for(d=2;d<b.length;d++)b[d]=a.trim(b[d]),n.test(a.trim(b[d]))?j=d==b.length-1?"100":100/d:(j=b[d].split(g).length!==1?parseInt(b[d].split(g)[1])/100:Math.round(100/(b.length-2))/100,j=d==b.length-1?"100":j*m),l.push("color-stop("+ j+"%, "+b[d].split(g)[0]+")"),m++;b=l.join(", ");a.support.isWebkit&&(f="-webkit-gradient(radial, {position} {colours} )".replace("{colours}",","+c+","+b),b=s[e]||e,e=a(p).width()*0.8,f=f.replace("{position}",b+","+e),f=h[1]+f+" "+h[6])}q[o]=f}else i.style[o]=k}}});i=null}else a.error("jQuery 1.4.3+ is needed for this plugin to work")})(jQuery);



// Plugin that provides a "pathchange" event on the window object, notifying an application when the URL changes
// This is accomplished by watching the hash, using the hashchange event from HTML5 or a polling interval in older browsers.
// In addition, in some modern browsers, HTML5 History Management is used to support changing the URL's path without reloading the page.
// This plugin also provides a method to navigate to a URL safely, that will use HTML5 History Management to avoid a page load.
// Everything degrades gracefully, and supports RESTful client development.

// Browser Support:
// Chrome - Any recent version of Chrome supports everything.
// Safari - Any recent version of Safari supports everything.
// Firefox - Newer versions of Firefox support the hashchange event
// Firefox 4 betas also support HTML5 History Management
// Internet Explorer - IE8 supports hashchange
// IE6 and 7 receive inferior hashchange support through a polling interval.
// Others - Other modern browsers probably support some subset of features.

// This plugin was authored by Ben Cherry (bcherry@gmail.com), and is released under an MIT License (do what you want with it).
// Some of the code in this plugin was adapted from Modernizr, which is also available under an MIT License.
(function($) {
  // can use $(window).bind("pathchange", fn) or $(window).pathchange(fn)
  $.fn.pathchange = function(handler) {
    return handler ? this.bind("pathchange", handler) : this.trigger("pathchange");
  };

  var my = $.pathchange = {
    // default options
    options: {
      useHistory: true, // whether we use HTML5 History Management to change the current path
      useHashchange: true, // whether we use HTML5 Hashchange to listen to the URL hash
      pollingInterval: 250, // when using Hashchange in browsers without it, how often to poll the hash (in ms)
      interceptLinks: true, // do we intercept all relative links to avoid some page reloads?
      disableHashLinks: true // do we ensure all links with href=# are not followed (this would mess with our history)?
    },

    // call this once when your app is ready to use pathchange
    init: function(options) {
      var lastHash;
      $.extend(my.options, options);

      // Listen to the HTML5 "popstate" event, if supported and desired
      if (my.options.useHistory && my.detectHistorySupport()) {
        $(window).bind("popstate", function(e) {
          $(window).trigger("pathchange");
        });
      }

      // Listen to the HTML5 "hashchange" event, if supported and desired
      if (my.options.useHashchange) {
        $(window).bind("hashchange", function(e) {
          $(window).trigger("pathchange");
        });

        // Hashchange support for older browsers (IE6/7)
        if (!my.detectHashchangeSupport()) {
          lastHash = window.location.hash;
          setInterval(function() {
            if (lastHash !== window.location.hash) {
              $(window).trigger("hashchange");
              lastHash = window.location.hash;
            }
          }, my.options.pollingInterval);
        }
      }

      // Intercept all relative links on the page, to avoid unneccesary page refreshes
      if (my.options.interceptLinks) {
        $("body").delegate("a[href^='/']", "click", function(e) {
          my.changeTo($(this).attr("href"));
          e.preventDefault();
        });
      }

      // Ensure all the href=# links on the page don't mess with things
      if (my.options.disableHashLinks) {
        $("body").delegate("a[href='#']", "click", function(e) {
          e.preventDefault();
        });
      }
    },

    // Call to manually navigate the app somewhere
    changeTo: function(path) {
      // If we're using History Management, just push an entry
      if (my.options.useHistory && my.detectHistorySupport()) {
        window.history.pushState(null, null, path);
        $(window).trigger("pathchange");
      } else {
        // Make sure there's a hash (going from foo.com#bar to foo.com would trigger a reload in Firefox, sadly)
        if (path.indexOf("#") < 0) {
          path = "#"+path;
        }
        // Otherwise, navigate to the new URL. Might reload the browser. Might trigger a hashchange.
        window.location.href = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : "") + window.location.pathname + path;
      }
    },

    // Simple feature detection for History Management (borrowed from Modernizr)
    detectHistorySupport: function() {
      return !!(window.history && history.pushState);
    },

    // Simple feature detection for hashchange (adapted from Modernizr)
    detectHashchangeSupport: function() {
      var isSupported = "onhashchange" in window;
      if (!isSupported && window.setAttribute) {
        window.setAttribute("onhashchange", "return;");
        isSupported = typeof window.onhashchange === "function";
      }
      return isSupported;
    }
  };
}(jQuery));


/*--------------------------------------------*
 * https://github.com/kilhage/jquery-storage
 *--------------------------------------------*
 * Author Emil Kilhage
 * MIT Licensed
 *--------------------------------------------*
 * Last Update: 2011-04-06 20:07:39
 * Version x
 *--------------------------------------------*/
(function(b){b.storage=function(a,c){if(this instanceof b.storage)this._={};else{if(!a)return b.storage._;var d=typeof a;if(d=="string"||d=="number"){if(!(1 in arguments))return b.storage._[a];b.storage._[a]=c}else d=="object"&&b.storage.puts(a)}};b.storage.prototype={put:function(a,c){this._[a]=c},all:function(){return this._},puts:function(a){var c=0,d=a.length;if(d!=null)for(;c<d;c++)this._[c]=a[c];else for(c in a)this._[c]=a[c]},get:function(a){return this._[a]},exists:function(a){return this._.hasOwnProperty(a)},remove:function(a){delete this._[a]},clear:function(){this._={}}};b.each({exist:"exists",set:"put",reset:"clear"},function(a,c){b.storage.prototype[a]=b.storage.prototype[c]});b.extend(b.storage,new b.storage)})(jQuery);

// http://jdbartlett.github.com/innershiv | WTFPL License
window.innerShiv=function(){function i(c,e,b){return g.test(b)?c:e+"></"+b+">"}function f(d,f){if(!c){c=document.createElement("div");var b=c.cloneNode(!1);b.innerHTML="<nav></nav>";if(e=b.childNodes.length!==1)c.style.display="none"}d=d.replace(/^\s\s*/,"").replace(/\s\s*$/,"").replace(j,"").replace(k,i);(b=d.match(l))&&(d="<table>"+d+"</table>");e&&document.body.appendChild(c);c.innerHTML=d;e&&document.body.removeChild(c);b=b?c.getElementsByTagName(b[1])[0].parentNode:c;if(f===!1)return b.childNodes;for(var h=document.createDocumentFragment(),g=b.childNodes.length;g--;)h.appendChild(b.firstChild);return h}var c,e,l=/^<(tbody|tr|td|col|colgroup|thead|tfoot)/i,k=/(<([\w:]+)[^>]*?)\/>/g,g=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,j=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;f.b=!0;return f}();
