$(document).ready(function(){
						   
  if ($.browser.msie) {
    alert( "This site, like the rest of the internet, runs much more primo on Firefox, Chrome or Safari than it does on Internet Explorer. For the best DtI site experience, please visit using one of those browsers." );
  }						   
						   
	  function filterPath(string) {
	  return string
		.replace(/^\//,'')
		.replace(/(index|default).[a-zA-Z]{3,4}$/,'')
		.replace(/\/$/,'');
	  }
	  var locationPath = filterPath(location.pathname);
	  var scrollElem = scrollableElement('html', 'body');
	
	  $('a[href*=#]').each(function() {
		var thisPath = filterPath(this.pathname) || locationPath;
		if (  locationPath == thisPath
		&& (location.hostname == this.hostname || !this.hostname)
		&& this.hash.replace(/#/,'') ) {
		  var $target = $(this.hash), target = this.hash;
		  if (target) {
			var targetOffset = $target.offset().top;
			$(this).click(function(event) {
			  event.preventDefault();
			  $(scrollElem).animate({scrollTop: targetOffset}, 400, function() {
				location.hash = target;
			  });
			});
		  }
		}
	  });
	
	  // use the first element that is "scrollable"
	  function scrollableElement(els) {
		for (var i = 0, argLength = arguments.length; i <argLength; i++) {
		  var el = arguments[i],
			  $scrollElement = $(el);
		  if ($scrollElement.scrollTop()> 0) {
			return el;
		  } else {
			$scrollElement.scrollTop(1);
			var isScrollable = $scrollElement.scrollTop()> 0;
			$scrollElement.scrollTop(0);
			if (isScrollable) {
			  return el;
			}
		  }
		}
		return [];
	  }						   
						   
	(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("http://www.drinkingtheink.com/images/topsplash.png", "http://www.drinkingtheink.com/images/topsplash.png");						   
	//$('#navpanel').addClass("hidden");	
	//$('.jshowoff-controls').addClass("invisible").delay(4000).removeClass("invisible");
	//$('#innerwrapper').css("visibility", "hidden");
	//$('#features').addClass("hidden").delay(2000).slideDown(2000);	
	//$("div").animate({width:"200px"},400);
	//$('#innerwrapper').attr("style", "visibility:hidden;");
	$('#topsplash,#navpanel').animate({
    opacity: 1.00,
  	}, 500, function() {
    // Animation complete.
  	});	
	
	$('#navpanel').hide().fadeIn();
	
	$(window).load(
    function() {

		$('#main,#features').animate({
		opacity: 1.00,
		}, 5000, function() {
		// Animation complete.
		});
	   }
	);
	
});

