// common functions
var currentTime = new Date()
var year = currentTime.getFullYear()

String.prototype.trim = function() {
	a = this.replace(/^\s+/, '');
	return a.replace(/\s+$/, '');
}


// jquery functions 
$(document).ready(function() {
	function resizeContent() {
		if ( $('#main .nav').height() < $(window).height() ) {
			var windowHeight = $(window).height() - 78;
			if (windowHeight < 600) {
				windowHeight = 600;
			}
			$('#main .content').css({
				'overflow' : 'auto',
				'height' : windowHeight
			});
		} else {
			$('#main .content').css({
				'overflow' : '',
				'height' : ''
			});
		}
	}
	resizeContent();
	$(window).bind("resize", function() {
		resizeContent();
	});
	
	$.preloadImages = function() {
		for (var i = 0; i<arguments.length; i++) {
			img = new Image();
			img.src = arguments[i];
		}
	}
	$.preloadImages(
		'/images/pogo-ani.gif',
		'/images/nav-buy-active.png'
	);
	
	$("a[href*='http://']:not([href*='"+location.hostname+"'])").attr("target","_blank");

	
	$('#pogo').hover(function(){
		$("#pogo").attr("src", "/images/pogo-ani.gif");
	}, function() {
		$("#pogo").attr("src", "/images/pogo.gif");
	});
});

