;(function($) {
/**
 * jCarouselLite - jQuery plugin to navigate images/any content in a carousel style widget.
 * @requires jQuery v1.2 or above
 *
 * @author Ganeshji Marwaha
 * @author Karl Swedberg (modifications/enhancements)
 * 
 *
 * http://gmarwaha.com/jquery/jcarousellite/
 *
 * Copyright (c) 2007 Ganeshji Marwaha (gmarwaha.com)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 * Version: 1.1
 * Note: Requires jquery 1.2 or above from version 1.0.1
 */
 
$.jCarouselLite = {
  version: '1.1',
  defaults: {
    btnPrev: null,
    btnNext: null,
    btnGo: null,
    mouseWheel: false,
 
    speed: 200,
    easing: null,
    auto: false, // true to enable auto scrolling
    autoStop: false, // number of times before autoscrolling will stop. (if circular is false, won't iterate more than number of items)
    timeout: 4000, // milliseconds between scrolls
    pause: true, // pause scrolling on hover
    
    vertical: false,
    circular: true, // continue scrolling when reach the last item
    visible: 3,
    start: 0, // index of item to show initially in the first posiition
    scroll: 1, // number of items to scroll at a time
 
    beforeStart: null,
    afterEnd: null
  }
};
 
$.fn.jCarouselLite = function(options) {
  var o = $.extend({}, $.jCarouselLite.defaults, options);
 
  return this.each(function() {
    
    var running = false,
        animCss=o.vertical?"top":"left", 
        sizeCss=o.vertical?"height":"width";
 
    var div = $(this), ul = div.find('ul'), tLi = ul.children('li'), tl = tLi.length, v = o.visible;
 
    if (o.circular) {
        ul.prepend(tLi.slice(tl-v-1+1).clone(true))
          .append(tLi.slice(0,v).clone(true));
        o.start += v;
    }
 
    var li = ul.children('li'), itemLength = li.length, curr = o.start;
    div.css("visibility", "visible");
 
    li.css({overflow: o.vertical ? "hidden" : 'visible', 'float': o.vertical ? "none" : "left"});
    ul.css({margin: "0", padding: "0", position: "relative", "list-style-type": "none", "z-index": "1"});
    div.css({overflow: "hidden", position: "relative", "z-index": "2", left: "0px"});
 
    var liSize = o.vertical ? height(li) : width(li);   // Full li size(incl margin)-Used for animation
    var ulSize = liSize * itemLength;                   // size of full ul(total length, not just for the visible items)
    var divSize = liSize * v;                           // size of entire div(total length for just the visible items)
 
    li.css({width: li.width(), height: li.height()});
    ul.css(sizeCss, ulSize+"px").css(animCss, -(curr*liSize));
 
    div.css(sizeCss, divSize+"px");                     // Width of the DIV. length of visible images
 
    if (o.btnPrev) {
      $(o.btnPrev).click(function() {
        return go(curr-o.scroll);
      });
    }
    if (o.btnNext) {
      $(o.btnNext).click(function() {
        return go(curr+o.scroll);
      });
    }
    if (o.btnGo) {
      $.each(o.btnGo, function(i, val) {
        $(val).click(function() {
          return go(o.circular ? o.visible+i : i);
        });
      });
    }
    if (o.mouseWheel && div.mousewheel) {
      div.mousewheel(function(e, d) {
        return d>0 ? go(curr-o.scroll) : go(curr+o.scroll);
      });
    }
 
    if (o.auto) {
      // CHANGED: Added pause on hover (Karl Swedberg)
      var setAutoAdvance,
          advanceCounter = 0,
          autoStop = iterations(tl,o);
 
      var advancer = function() {
        setAutoAdvance = setTimeout(function() {
          if (!autoStop || autoStop > advanceCounter) {
            go(curr+o.scroll);
            advanceCounter++;
            advancer();
          }
        }, o.auto+o.speed);
      };
      
      advancer();
      
      $(document)
      .bind('pauseCarousel', function() {
        clearTimeout(setAutoAdvance);
        div.data('paused', true);
      })
      .bind('resumeCarousel', function() {
        advancer();
        div.data('paused', true);
      });
    }
    
    function vis() {
      return li.slice(curr).slice(0,v);
    }
 
    function go(to) {
      if (!running) {
 
        if (o.beforeStart) {
          o.beforeStart.call(this, vis());
        }
        if (o.circular) {             // If circular we are in first or last, then goto the other end
          if (to<=o.start-v-1) {           // If first, then goto last
            ul.css(animCss, -((itemLength-(v*2))*liSize)+"px");
            // If "scroll" > 1, then the "to" might not be equal to the condition; it can be lesser depending on the number of elements.
            curr = to==o.start-v-1 ? itemLength-(v*2)-1 : itemLength-(v*2)-o.scroll;
          } else if (to>=itemLength-v+1) { // If last, then goto first
            ul.css(animCss, -( (v) * liSize ) + "px" );
            // If "scroll" > 1, then the "to" might not be equal to the condition; it can be greater depending on the number of elements.
            curr = to==itemLength-v+1 ? v+1 : v+o.scroll;
          } else {
            curr = to;
          }
        } else {                    // If non-circular and to points beyond first or last, we change to first or last.
          if (to<0) {
            curr = 0;          
          } else if  (to>itemLength-v) {
            curr = itemLength-v;
          } else {
            curr = to;
          }
        }
 
        running = true;
 
        ul.animate(animCss == "left" ? { left: -(curr*liSize) } : { top: -(curr*liSize) } , o.speed, o.easing, function() {
          if (o.afterEnd) {
            o.afterEnd.call(this, vis());
          }
          running = false;
        });
        // Disable buttons when the carousel reaches the last/first, and enable when not
        if (!o.circular) {
          $(o.btnPrev + "," + o.btnNext).removeClass("disabled");
          $( (curr-o.scroll<0 && o.btnPrev)
             ||
             (curr+o.scroll > itemLength-v && o.btnNext)
             ||
             []
          ).addClass("disabled");
        }
      }
      return false;
    } // end if !running
  });
};
 
function css(el, prop) {
  return parseInt($.css(el[0], prop), 10) || 0;
}
function width(el) {
  return  el[0].offsetWidth + css(el, 'marginLeft') + css(el, 'marginRight');
}
function height(el) {
  return el[0].offsetHeight + css(el, 'marginTop') + css(el, 'marginBottom');
}
function iterations(itemLength, options) {
  return options.autoStop && (options.circular ? options.autoStop : Math.min(itemLength, options.autoStop));
}
})(jQuery);// used to prevent multiple animation on gallery
var blockAnimation = false;
 
// used to show a clicked item in the gallery 
function galShow( item ) {
	// hide all the other ones
	if ( item.search('1') == -1 ) 
		$('#img1').hide();
	if ( item.search('2') == -1 )
		$('#img2').hide();
	if ( item.search('3') == -1 )
		$('#img3').hide();
	if ( item.search('4') == -1 )
		$('#img4').hide();
	
	// show the one we want to show
	
	var itemToShow = '#img'.concat( item.substr( item.length-1, 1 ) );
	$(itemToShow).show();
}
 
jQuery(document).ready( function() {
	
	// Display "Search" text in search field
	$(".search").attr("value", "Search");
	$(".search").css("color","#92a2d2");
	$(".search").bind("focus",function() {
		if( $(".search").attr("value") == "Search" ) {
			$(".search").attr("value", "");
			$(".search").css("color","#000");
		}
	});
	$(".search").bind("focusout",function() {
		if( $(".search").attr("value") == "" ) {
			$(".search").attr("value", "Search");
			$(".search").css("color","#92a2d2");
		}
	});
	
	// Draw rounded corners in IE
	if ( typeof(DD_roundies) != 'undefined' ) {
		DD_roundies.addRule('.sub-nav', '0 0 10px 10px' );
		DD_roundies.addRule('.advancing-crsl, .casestudies-crsl','10px');
		DD_roundies.addRule('.casestudies-crsl .crsl-prev', '10px 0 0 10px' );
		DD_roundies.addRule('.casestudies-crsl .crsl-next', '0 10px 10px 0' );
		DD_roundies.addRule('#banner .featured-crsl .crsl-prev','10px 0 0 10px');
		DD_roundies.addRule('#banner .featured-crsl .crsl-next','0 10px 10px 0');
	}
	
	// Quick little anonymous function to bind Services Sub-nav slide-down animation
	var onServices = false;
	var offTimer = null;
	(function(){
	var navigation = jQuery('#navigation li:has(.services)');
	var sub_nav = navigation.children('.sub-nav');
	navigation.hover(
	  	function(e){
	  		onServices = true;
	  		sub_nav.slideDown('fast', function() { blockAnimation = false; } );
	    	navigation.children('a').addClass('hover');
	  	},
	  	function(e){
	  		onServices = false;
	  		clearTimeout( offTimer );
	  		offTimer = setTimeout( function() { 
	  	  		if (! onServices ) {
	  	  			sub_nav.slideUp('fast', function() { blockAnimation = false; 
						navigation.children('a').removeClass('hover'); }); 
	  	  		};
	  	  	},600);	  		
	  	}
	  );
	})();
  
  if ($('.advancing-crsl').size() > 0) {
    // Load the Flickr Carousel
    (function(){
  		var crsl = $('.advancing-crsl .crsl-bd');
  		var stream = "http://api.flickr.com/services/feeds/photos_public.gne?id=76156161@N00&lang=en-us&format=json&jsoncallback=?"
  		var navigation = '<div class="crsl-prev crsl-nav"><a class="previous" href="javascript:;">Previous</a></div>';
  		navigation += '<div class="crsl-next crsl-nav"><a class="next" href="javascript:;">Next</a></div>';
 
  		jQuery.getJSON(stream,function(data){
  			jQuery.each(data.items,function(i,val){
          var imgA = val.media.m.split("_m");
  				var li = $('<li><a href="'+val.link+'" class="img" target="_new"><img src="'+imgA[0]+'_s.jpg" /></a></li>');
  				li.find('img').attr('alt',val.title);
  				crsl.children('ul').append(li);
  			});
  			crsl.before(navigation);
				crsl.jCarouselLite({
					btnNext: '.next',
					btnPrev: '.previous',
					visible: 7,
          circular: true,
					speed: 500
				});
  		});
  	})();  	
  }
  
  if ($('.casestudies-crsl').size() > 0) {
    // Load the Case Study Carousel
    (function(){
  		var crsl = $('.casestudies-crsl .crsl-bd');
  		var navigation = '<div class="crsl-prev crsl-nav"><a class="previous" href="javascript:;">Previous</a></div>';
  		navigation += '<div class="crsl-next crsl-nav"><a class="next" href="javascript:;">Next</a></div>';
      
  		crsl.before(navigation);
  		crsl.jCarouselLite({
  			btnNext: '.next',
  			btnPrev: '.previous',
  			visible: 5,
        circular: true,
  			speed: 500
  		});
  	})();
    
    $('.casestudies-crsl .casestudy').bind( "mouseenter",function() {
      var srcfull = this.children[0].src;
      var srccut = srcfull.split(".png");
      var srcnew = srccut[0] + "-over.png";
      $(this.children[0]).attr( "src", srcnew );
    });
    $('.casestudies-crsl .casestudy').bind( "mouseleave",function() {
      var srcfull = this.children[0].src;
      var srccut = srcfull.split("-over.png");
      var srcnew = srccut[0] + ".png";
      $(this.children[0]).attr( "src", srcnew );
    });
  }
  
  // Featured carousel in colored banner
  if ($('#banner .featured-crsl').size() > 0) {
	  (function(){
	    var crsl = $('#banner .featured-crsl');
	    var navigation = '<div class="crsl-prev crsl-nav"><a class="previous" href="#">Previous</a></div>';
  		navigation += '<div class="crsl-next crsl-nav"><a class="next" href="#">Next</a></div>';
  		var panes = crsl.find('ul > li');
  		var controls = crsl.children('.controls');
  		var indicators = controls.children('a');
  		var control_ary = [];
  		
  		/* If there are less panes than there are indicators, we need to get rid of those indicators */
      if (panes.size() < indicators.size()) {
        var indicator_count = indicators.size();
        (function(){
          var i = (indicator_count - panes.size());
          while (i > 0) {
            indicator_count = indicator_count - 1;
            indicators.eq(indicator_count).remove();
            i = i-1;
          }
        })();
      }
  		
  		panes.each(function(i,val) {
  		  var indicator = indicators.eq(i);
  		  $(val).attr({
  		    'data-index':i+'',
  		    'id':'feature-'+i
  		  });
  		  indicator.addClass('control-'+i);
  		  control_ary.push('.controls .control-'+i);
  		});
  		
  		// set controls width to value of number of panes plus margin
  		var indicWidth = indicators.first().width() + ( parseInt(indicators.first().css('marginRight')) * 2 );
  		controls.width( indicWidth * panes.size() );
  		
  		controls.css({
  		  'left':'50%',
  		  'margin-left':'-'+(controls.width()/2)+'px'
  		});
  		
  		indicators.eq(0).addClass('active');
      crsl.prepend(navigation);
	    crsl.jCarouselLite({
	      btnNext: '.next',
				btnPrev: '.previous',
	      visible: 1,
        auto: 5000,
	      circular: true,
	      btnGo: control_ary,
	      afterEnd: function(e){
	        var index = e.attr('data-index');
	        controls.children('.active').removeClass('active');
	        controls.find('.control-'+index).addClass('active');
	      }
	    });
	    
	    var nav = crsl.find('.crsl-nav a');
	    nav.bind('click',function(e){
	      crsl.trigger('pauseCarousel');
	    });
	  })();
	}
	
	// Small function to handle the click actions on the Articles Gallery thumbnails
	$('.thumba').click( function(){ 
		var curId = $(this).attr('id');
		galShow( curId );
	});
	
	// functionality for white papers
	if ($('.white-papers img.summary').size() > 0) {
	  (function(){
	    var images = $('.white-papers img.summary');
	    images.each(function(i,val){
	      var $this = $(val);
	      var src = $this.attr('src');
	      var image_url = src.split('.');
        if(image_url.length == 2)
  	      {var rollover = image_url[0]+'-rollover.'+image_url[1];}
        else
          {var rollover = image_url[0]+image_url[1]+image_url[2]+'-rollover.'+image_url[3];}
 
        $this.hover(
          function(e){
            $(this).attr('src', rollover);
          },
          function(e){
            $(this).attr('src', src);
          }
        );
	    });
 
	  })();
	}
  
  // Open up all external links in a new window
  // old method -- all links that start with http -- $("a[href^='http']").attr('target','_new');
  $("a[href^='http']:not([href*='www.jumpassociates.com'])").attr('target','_new');
  // Open up all PDF links in a new window
  $("a[href*=.pdf]").attr('target','_new');
  
  // Hack for iPhone
  if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
    $("#banner").css("height", "435px");
    $("#header").css("margin-top", "-20px");
    $("#jump-articles #content").css("margin-top", "-100px");
  }
});var log = function(msg) {
	try {
		console.log(msg);
	} catch(e) {}
};
 
 
var findClass = function(_class, _needle) {
	var _classes = _class.split(" ");
	for(var i=0; i < _classes.length; i++) {
		if(_classes[i].indexOf(_needle)>-1) {
			return _classes[i];
		}
	}
};
 
(function($) {
	$.fn.tabgroup = function(_config) {
		$(this).each(function() {
			var _defaults = {
				tab      : ".tab",
				trigger  : ".tab a",
				selected : "selected",
				content_container : ".tab-group-container",
				content_indicator : "get-content-",
				content_prefix    : "content-",
				callback : function() {}
			};
			var _options = $.extend(_defaults, _config);
	
			var _self = $(this);
			var _current_tab = _self.find(_options.tab+"."+_options.selected);
			var _current_body = _self.find(_options.content_container+" ."+_options.selected);
			
			$(this).find(_options.trigger).click(function() {
				var _trigger = $(this);
			
				var _content_name = findClass($(this).parent().attr("class"), _options.content_indicator).substring(_options.content_indicator.length);
				var _content_panel = $(_options.content_container+" ."+_options.content_prefix + _content_name);
				
				_current_body = _self.find(_options.content_container+" ."+_options.selected);
				
				var _change = function() {
					_current_tab.removeClass(_options.selected);
					_current_tab = _trigger.parent();
					_current_tab.addClass(_options.selected);
					
					_current_body.removeClass(_options.selected);
					_current_body = _content_panel;
					_current_body.addClass(_options.selected);
					
					_current_body.find(".pagination-control").paginate();
					
					_options.callback(_self);
				};
				
				if(_content_panel.size() > 0) {
					_change();
				} else {
					var _data_url = $(this).attr("href");
					$.get(_data_url, {}, function(data) {
						if(data!="null") {
							_content_panel = $(data);
							_content_panel.appendTo(_self.find(_options.content_container));
							_change();
						}
					});
				}
				
				return false;
			});
		});
	}
})(jQuery);
 
 
(function($) {
	$.fn.paginate = function(_config) {
		$(this).each(function() {
			var _defaults = {
				callback : function() {}
			};
			var _options = $.extend(_defaults, _config);
	
			var _self = $(this);
			var _container = _self.parents(".pagination-container");
			
			_self.find("a").unbind("click");
			_self.find("a").click(function() {
				var _data_url = $(this).attr("href");
				$.get(_data_url, {}, function(data) {
					if(data!="null") {
						var _content = $(data);
						_container.replaceWith(_content);
						_content.find(".pagination-control").paginate();
					}
				});
				return false;
			});
		});
	}
})(jQuery);
 
var sDomain = "http://www.jumpassociates.com";
(function($) {
  var cache = [];
  // Arguments are image paths relative to the current page.
  $.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  }
})(jQuery);
jQuery.preLoadImages(
  sDomain+"/wp-content/themes/jumpsite60/img/button-its-time-to-grow-over.png",
  sDomain+"/wp-content/themes/jumpsite60/img/icon-contact-over.png",
  sDomain+"/wp-content/themes/jumpsite60/img/cs-clorox.png",
  sDomain+"/wp-content/themes/jumpsite60/img/cs-ge01.png",
  sDomain+"/wp-content/themes/jumpsite60/img/cs-ge02.png",
  sDomain+"/wp-content/themes/jumpsite60/img/cs-generalmills.png",
  sDomain+"/wp-content/themes/jumpsite60/img/cs-harley.png",
  sDomain+"/wp-content/themes/jumpsite60/img/cs-hp.png",
  sDomain+"/wp-content/themes/jumpsite60/img/cs-kellogg.png",
  sDomain+"/wp-content/themes/jumpsite60/img/cs-nbc.png",
  sDomain+"/wp-content/themes/jumpsite60/img/cs-nike.png",
  sDomain+"/wp-content/themes/jumpsite60/img/cs-sandiegozoo.png",
  sDomain+"/wp-content/themes/jumpsite60/img/cs-saturn.png",
  sDomain+"/wp-content/themes/jumpsite60/img/cs-sk.png",
  sDomain+"/wp-content/themes/jumpsite60/img/cs-steelcase.png",
  sDomain+"/wp-content/themes/jumpsite60/img/cs-target.png",
  sDomain+"/wp-content/themes/jumpsite60/img/cs-wrangler.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/bigidea-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/brandcommunities-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/bwdesire-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/bwempathygrowth-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/bwopportunitymaps-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/chiefgrowthofficer-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/contextisking-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/designpackaging-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/designstrategies-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/differentbydesign-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/fundamentals-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/ge-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/greenadoption-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/harley-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/holygrail-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/hp-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/insightintoaction-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/managingchange-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/nbc-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/needfinding-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/newoppdevelopment-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/nike-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/openempathy-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/opportunitymaps-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/saturn-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/saturnshowroom-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/sdzoo-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/sktelecom-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/steelcase-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/sundaynight-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/sustaining-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/systemlogics-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/target-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/wkk-rollover.png",
  sDomain+"/wp-content/themes/jumpsite60/img/white-papers/craftstrategy-rollover.png"
 
);
 
 
 
 
 
 
 