$(window).load(function(){

	/* Position the images */
	var win = $(window)
	var $l = $('#images img');
	var minW = $l.width()*$('#images').height()/$l.height();
	win.resize(function(){
		var w = win.width();
		if(w < minW) w = minW;
		$l.width(w);
		$l.css('margin-top',(410-$l.height())/2);
	}).resize();
	
	/* Rotate the images */
	noimg = $("#images > img").size();
	if (noimg > 1) {
		$('#images img:first').addClass('active').css('z-index',99).fadeIn({duration:1000,easing:'linear'});
		var loadNext = function(){
			var $t = $('#images img.active');
			var $n = $t.next();
			if($n.length==0)$n = $('#images img:first');
			$n.css('z-index',98).show();
			$t.delay(3300).fadeOut({duration:1000,easing:'linear',complete:function(){
				$n.addClass('active').css('z-index',99);
				$(this).removeClass('active');
				loadNext();
			}});
		};
		setTimeout(function(){loadNext();},1000);
	} else {
		$('#images img:first').addClass('active').css('z-index',99).fadeIn({duration:1000,easing:'linear'});
	};

});

$(document).ready(function() {

	$('ul.sf-menu').superfish();
	
	Cufon.replace('#banner #bottombar h1');
	$('#banner #bottombar h1').css('font-size','480%');
	
	$("a[rel='gal']").colorbox();

});


window.log = function(){
  log.history = log.history || [];
  log.history.push(arguments);
  arguments.callee = arguments.callee.caller;  
  if(this.console) console.log( Array.prototype.slice.call(arguments) );
};

(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||{});
