document.getElementsByTagName('html')[0].className += 'js-active';
(function($){	  

jQuery(function(){
	templateInit();
});

function templateInit(){
	$('#header').css({ position: 'absolute' });
	//bindWindowResize();
	bindWindowScroll();
}

function bindWindowResize(){
	// Window resize used to contact info position. When the window gets too
	// small, to prevent an overlap their position is adjusted.
	var footer = $('#footer');
	$(window).bind('resize', function(e){
		var winHeight = $(this).height();
		if( winHeight < 800 ){
			footer.css({ top: 720, bottom: 'auto' });
		} else {
			footer.css({ top: 'auto', bottom: 0 });
		}
		$(window).trigger('scroll');
	});
	// Trigger resize at load, in case the default window size it too small
	$(window).trigger('resize');
}

function bindWindowScroll(){
	var hd = $('#header');
    var ft = $('#footer');
	$(window).bind('scroll', function(e){
		var winLeft = $(this).scrollLeft();
		hd.css({ left: ('50%' + (winLeft * -1) + 0 )});
		ft.css({ left: ('50%' + (winLeft * -1) + 0 )});
	});
}

function preloadImages(images){
	$.each(images, function(i, image){
		var img = $('<img>').attr('src', image);		
	});
}

})(jQuery);
