(function(jQuery) {
  jQuery.bannerRotate = {};

  jQuery.fn.bannerRotate = function(items, opts) {
    var $s = jQuery.extend(jQuery.evalJSON(jQuery.toJSON(jQuery.bannerRotate.defaultSettings)), (opts && typeof(opts) == 'object' ? opts : {}));
    $s.items = items;
    if ($s.randomize) $s.items.sort(function() {return 0.5 - Math.random();});
    jQuery.bannerRotate.preload($s);

    jQuery(this).each(function() {
      var self = this;
      jQuery(self).empty().css({'position':'relative'}).addClass('banner_rotate');
      jQuery.bannerRotate.rotate(this, $s, true);
      $s.to = setInterval(function() {jQuery.bannerRotate.rotate(self, $s);}, $s.speed);
      return this;
    });
  }

	jQuery.extend(jQuery.bannerRotate, {
	  defaultSettings : {items:[],index:0,speed:5000, randomize:false, fade:false, to:false},
    preload : function($s) {
      var preload = [];
      jQuery.each($s.items, function(i) {
        preload.push(new Image());
        preload[i].src = (typeof(this) == 'object' ? this.src : this);
      });

    },
	  rotate : function(self, $s, first) {
	    var p_index = $s.index, e_prev = jQuery('.item_'+ p_index, self), cur = $s.items[$s.index], replace = '';
	    if (cur) {
	      if (typeof(cur) == 'object') {
	        replace = '<a class="item_'+$s.index+'" href="'+cur.href+'"><img src="'+cur.src+'" title="'+cur.title+'" alt="" border="0" /></a>';
	      } else {
	        replace = '<img class="item_'+$s.index+'" src="'+cur+'" title="" alt="" />';
	      }
      }

      if (!first && $s.fade) {
        e_prev.css({'z-index':1999});
        jQuery(self).append(replace);
        jQuery('.item_'+ $s.index, self).css({'opacity':0, 'z-index':2000, 'position':'absolute'}).animate({'opacity':1}, 250, function(){e_prev.remove();});
      } else {
        jQuery(self).html(replace).find('.item_'+ $s.index).css({'position':'absolute'});
      }

      $s.index++;
      if ($s.index >= $s.items.length) $s.index = 0;
	  }
	});
})(jQuery);

(function(jQuery) {   
  function toIntegersAtLease(n) {return n < 10 ? '0' + n : n;}
  Date.prototype.toJSON = function(date) {return this.getUTCFullYear()   + '-' + toIntegersAtLease(this.getUTCMonth()) + '-' + toIntegersAtLease(this.getUTCDate());};
  var escapeable = /["\\\x00-\x1f\x7f-\x9f]/g, meta = {'\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\'};
  jQuery.quoteString = function(string) {if (escapeable.test(string)) {return '"' + string.replace(escapeable, function (a) {var c = meta[a]; if (typeof c === 'string') return c; c = a.charCodeAt(); return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16);}) + '"';} return '"' + string + '"';};
  jQuery.toJSON = function(o, compact) {var type = typeof(o); if (type == "undefined") {return "undefined";} else if (type == "number" || type == "boolean") {return o + "";} else if (o === null) {return "null";} if (type == "string") return jQuery.quoteString(o); if (type == "object" && typeof o.toJSON == "function") return o.toJSON(compact); if (type != "function" && typeof(o.length) == "number") {var ret = []; for (var i = 0; i < o.length; i++) ret.push( jQuery.toJSON(o[i], compact) ); return "[" + ret.join(compact ? "," : ", ") + "]";} /*if (type == "function") throw new TypeError("Unable to convert object of type 'function' to json.");*/ var ret = []; for (var k in o) {var name; type = typeof(k); if (type == "number") {name = '"' + k + '"';} else if (type == "string") {name = jQuery.quoteString(k);} else {continue;} var val = jQuery.toJSON(o[k], compact); if (typeof(val) != "string") continue; ret.push(name + (compact ? ":" : ": ") + val);} return "{" + ret.join(", ") + "}";};
  jQuery.compactJSON = function(o) {return jQuery.toJSON(o, true);};
  jQuery.evalJSON = function(src) {return eval("(" + src + ")");};
  jQuery.secureEvalJSON = function(src) {var filtered = src.replace(/\\["\\\/bfnrtu]/g, '@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').replace(/(?:^|:|,)(?:\s*\[)+/g, ''); if (/^[\],:{}\s]*$/.test(filtered)) {return eval("(" + src + ")");} else {throw new SyntaxError("Error parsing JSON, source is not valid.");}};
})(jQuery);


function gaTrackPage(url) {if (!url || url == '') return; try {pageTracker._trackPageview(parse_path(url));} catch (err) {}}
function gaTrackEvent(cat, action, opt_label, opt_val) {if (!cat || cat == '') return; try {if (!action || action == '') action = '-n/a-'; pageTracker._trackEvent(cat, action, opt_label, opt_val);} catch(err) {}}


function fbs_click(u, t) {window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}