jQuery(document).ready(function() {
	
	//if (document.all) {$(".nav li").hoverClass ("sfHover");	}
	$(".colorbox").colorbox();
});

function closeColorbox() {
	$.fn.colorbox.close();
}

$.fn.hoverClass = function(c) {
	return this.each(function(){
		$(this).hover( 
			function() { $(this).addClass(c);},
			function() { $(this).removeClass(c); }
		);
	});
};

function showOverlay(id) {
	if ( !$('#'+id).is(':visible') ) {
		$('#'+id).show();
		console.log('not visible, show');
	}
}
function hideOverlay(id) {
	if ( $('#'+id).is(':visible') ) {
		$('#'+id).hide();
	}
}


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);
  }
};

function trackClick(pagename, tracktype) {
	
	var url = '/tracking/';
	if ( tracktype != undefined ) {
		url += tracktype + '/';
	}
	else {
		url += 'google/';
	}
	url += pagename;
	
	if ( pageTracker != undefined ) {
		pageTracker._trackPageview(url);
	}
}

