
// 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||{});

/**
 * jQuery Plugin to obtain touch gestures from iPhone, iPod Touch and iPad, should also work with Android mobile phones (not tested yet!)
 * Common usage: wipe images (left and right to show the previous or next image)
 * 
 * @author Andreas Waltl, netCU Internetagentur (http://www.netcu.de)
 * @version 1.1.1 (9th December 2010) - fix bug (older IE's had problems)
 * @version 1.1 (1st September 2010) - support wipe up and wipe down
 * @version 1.0 (15th July 2010)
 */
(function($){$.fn.touchwipe=function(settings){var config={min_move_x:20,min_move_y:20,wipeLeft:function(){},wipeRight:function(){},wipeUp:function(){},wipeDown:function(){},preventDefaultEvents:true};if(settings)$.extend(config,settings);this.each(function(){var startX;var startY;var isMoving=false;function cancelTouch(){this.removeEventListener('touchmove',onTouchMove);startX=null;isMoving=false}function onTouchMove(e){if(config.preventDefaultEvents){e.preventDefault()}if(isMoving){var x=e.touches[0].pageX;var y=e.touches[0].pageY;var dx=startX-x;var dy=startY-y;if(Math.abs(dx)>=config.min_move_x){cancelTouch();if(dx>0){config.wipeLeft()}else{config.wipeRight()}}else if(Math.abs(dy)>=config.min_move_y){cancelTouch();if(dy>0){config.wipeDown()}else{config.wipeUp()}}}}function onTouchStart(e){if(e.touches.length==1){startX=e.touches[0].pageX;startY=e.touches[0].pageY;isMoving=true;this.addEventListener('touchmove',onTouchMove,false)}}if('ontouchstart'in document.documentElement){this.addEventListener('touchstart',onTouchStart,false)}});return this}})(jQuery);

/***============== Onebyone.min.js instead of adding in footer (used for fun facts slider) ================ */

(function(a){var b=["rollIn","fadeIn","fadeInUp","fadeInDown","fadeInLeft","fadeInRight","fadeInRight","bounceIn","bounceInDown","bounceInUp","bounceInLeft","bounceInRight","rotateIn","rotateInDownLeft","rotateInDownRight","rotateInUpLeft","rotateInUpRight"];var c=b.length;a.fn.oneByOne=function(d){function C(){var a=h;a--;a=a<0?q-1:a;y(a)}function B(){var a=h;a++;a=a>=q?0:a;y(a)}function A(){clearInterval(g.data("interval"));slideShowInt=setInterval(function(){B()},e.slideShowDelay);g.data("interval",slideShowInt)}function z(){clearInterval(g.data("interval"))}function y(d){if(e.slideShow){z()}g.stop(true,true).animate({left:-d*i},e.delay,function(){if(d!=h){r=h;if(p[r]){if(!(a.browser.msie||a.browser.opera)){p[r].fadeOut()}a(".buttonArea a:eq("+r+")",f).removeClass("active")}a(".buttonArea a:eq("+d+")",f).addClass("active");if(e.easeType.toLowerCase()!="random"){p[d].show().children().each(function(b){if(a(this).hasClass(e.easeType)){a(this).removeClass(e.easeType);a(this).hide()}var c=b;a(this).show().addClass("animate"+c+" "+e.easeType)})}else{o=b[Math.floor(Math.random()*c)];n[d]=o;if(p[r]){p[r].children().each(function(b){if(a(this).hasClass(n[r])){a(this).removeClass(n[r]);a(this).hide()}})}p[d].show().children().each(function(b){var c=b;a(this).show().addClass("animate"+c+" "+o)})}g.delay(p[d].children().length*200).queue(function(){if(e.slideShow)A()});if(u)u.css("cursor","pointer");h=d}})}var e={className:"oneByOne",sliderClassName:"oneByOne_item",easeType:"fadeInLeft",width:960,height:420,delay:300,tolerance:.25,enableDrag:true,showArrow:true,showButton:true,slideShow:false,slideShowDelay:3e3};if(d){a.extend(e,d)}var f;var g;var h=-1;var i=e.width;var j=e.height;var k=0;var l=false;var m=false;var n=[];var o;var p=[];var q=0;var r=0,s,t,u;g=this;g.wrap('<div class="'+e.className+'"/>');f=g.parent();f.css("overflow","hidden");g.find("."+e.sliderClassName).each(function(b){a(this).hide();q++;a(this).css("left",i*b);p[b]=a(this)});g.bind("touchstart",function(a){a.preventDefault();var b=a.originalEvent.touches[0]||a.originalEvent.changedTouches[0];if(!l){l=true;this.mouseX=b.pageX}if(t)t.fadeIn();if(u)u.fadeIn();return false});g.bind("touchmove",function(a){a.preventDefault();var b=a.originalEvent.touches[0]||a.originalEvent.changedTouches[0];if(l){k=b.pageX-this.mouseX;g.css("left",-h*i+k);if(e.slideShow){z()}}return false});g.bind("touchend",function(a){var b=h;a.preventDefault();var c=a.originalEvent.touches[0]||a.originalEvent.changedTouches[0];l=false;if(!k)return false;var d=parseInt(e.width);var f=d/2;if(-k>f-d*e.tolerance){b++;b=b>=q?q-1:b;y(b)}else if(k>f-d*e.tolerance){b--;b=b<0?0:b;y(b)}else{y(b);if(e.slideShow){A()}}k=0;if(t)t.delay(400).fadeOut();if(u)u.delay(400).fadeOut();return false});if(e.enableDrag){g.mousedown(function(a){if(!l){l=true;this.mouseX=a.pageX}return false});g.mousemove(function(a){if(l){k=a.pageX-this.mouseX;g.css("left",-h*i+k);if(e.slideShow){z()}}return false});g.mouseup(function(a){l=false;var b=h;if(!k)return false;var c=parseInt(e.width);var d=c/2;if(-k>d-c*e.tolerance){b++;b=b>=q?q-1:b;y(b)}else if(k>d-c*e.tolerance){b--;b=b<0?0:b;y(b)}else{y(b);if(e.slideShow){A()}}k=0;return false});g.mouseleave(function(b){a(this).mouseup()})}f.mouseover(function(a){if(u)u.fadeIn()});f.mouseleave(function(a){if(u)u.fadeOut()});if(e.showButton){s=a('<div class="buttonArea"><div class="buttonCon"></div></div>');f.append(s);t=s.find(".buttonCon");for(var v=0;v<q;v++){t.append('<a class="theButton" rel="'+v+'">'+(v+1)+"</a>").css("cursor","pointer")}a(".buttonCon a:eq("+h+")",s).addClass("active");a(".buttonCon a",s).bind("click",function(b){if(a(this).hasClass("active"))return false;var c=a(this).attr("rel");y(c)})}if(e.showArrow){u=a('<div class="arrowButton"><div class="prevArrow"></div><div class="nextArrow"></div></div>');f.append(u);var w=a(".nextArrow",u).bind("click",function(a){B()});var x=a(".prevArrow",u).bind("click",function(a){C()})}if(u)u.hide();y(0);if(e.slideShow){slideShowInt=setInterval(function(){B()},e.slideShowDelay);g.data("interval",slideShowInt)}return this}})(jQuery)
