// Allow HTML5 tags to be styled in IEs
document.createElement('header');
document.createElement('nav');
document.createElement('section');
document.createElement('article');
document.createElement('aside');
document.createElement('footer');

var minLocation = 360;

var pageHeight;

/* JQuery on load function */
$(document).ready(function(){
	pageHeight = $('body').height();
	fixBG();
	$(window).resize(function() {
		fixBG();
	});
});

function fixBG() {
	var scnHeight = getHeight();		
	var scnWidth = getWidth();		
	var desLoc = ((scnWidth - 960)/2) - minLocation;
	if (desLoc < 0) {
		$('.bg-image-wrap').css('background-position',desLoc + 'px 0');
	} else {
		$('.bg-image-wrap').css('background-position','0px 0px');
	}

	if (scnHeight>pageHeight) {
		$('.bg-image-wrap').height(scnHeight);
	} else {
		$('.bg-image-wrap').height(pageHeight);
	}
}

function getHeight() {
	var scnHei;
	if (self.innerHeight) {
		scnHei = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		scnHei = document.documentElement.clientHeight;
	} else if (document.body) {
		scnHei = document.body.clientHeight;
	}
	return scnHei;
}

function getWidth() {
	var scnWid;
	if (self.innerWidth) {
		scnWid = self.innerWidth;
	} else if (document.documentElement && document.documentElement.clientWidth) {
		scnWid = document.documentElement.clientWidth;
	} else if (document.body) {
		scnWid = document.body.clientWidth;
	}
	return scnWid;
}
/* Home Page Slider */
/*
$(document).ready(function(){
    lastBlock = $("#p1");
    maxWidth = 737;
    minWidth = 69;	

    $("#fan-panel li").mouseover(
      function(){
				activepanel = $(this).attr('id');
				
				for(var i=1; i<5; i++) {
					if ('p' + i != activepanel) {
						//fanW += $('#p' + i).width();
						
						$('#p' + i).animate({width: minWidth+"px"}, { queue:false, duration:400, step:step });
					}
				}
        //$(lastBlock).animate({width: minWidth+"px"}, { queue:false, duration:400, step: step });
				//$(this).animate({width: maxWidth+"px"}, { queue:false, duration:400 });
				
      }
    );
});

function step() {
		var fanW = 0;
		for(var i=1; i<5; i++) {
			if ('p' + i != activepanel) {
				fanW += $('#p' + i).width();
			}
		}
		$('#' + activepanel).width(947 - fanW);
		$('#temp').html(fanW);
}

*/