
var $vpw;
var $vph;

if (typeof window.innerWidth != 'undefined') {
	$vpw = window.innerWidth,
	$vph = window.innerHeight
}
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) {
	$vpw = document.documentElement.clientWidth,
	$vph = document.documentElement.clientHeight
}
// older versions of IE
else {
	$vpw = document.getElementsByTagName('body')[0].clientWidth,
	$vph = document.getElementsByTagName('body')[0].clientHeight
}

if( $vph-150 > 600 ) {
	var $gbh = 600;
}
else {
	var $gbh = $vph-150;	
}

var $gbw = Math.round(($gbh)*(1200/600));
var $gblm = Math.round( ($vpw-$gbw-100)/2 );

function setCover() {
	$('#show_box img.active').fadeIn();
	
}
function nextImage() {
	var $activeSlide = $('#show_box img.active');
	var $nextSlide = ($('#show_box img.active').next().length > 0) ? $('#show_box img.active').next() : $('#show_box img:first');
	$activeSlide.fadeOut(700,function() {
		$(this).removeClass('active');
		$nextSlide.addClass('active');
		setCover();
	},function() {
		$nextSlide.fadeIn(700);	
	});
}

$().ready(function() {

	var gBox = '<div style="width:' + $gbw + 'px;height:' + $gbh + 'px;">';
		gBox += '<div id="show_box_wrapper" style="position:absolute;width:' + $gbw + 'px;height:' + $gbh + 'px;padding:0px;margin:0px 0px 0px ' + $gblm + 'px;overflow:hidden;">';
			gBox += '<img id="overlay" src="/images/lg_logo_overlay2.png" style="position:absolute;width:' + $gbw + 'px;height:' + $gbh + 'px;z-index:100;" />';
			gBox += '<div id="show_box" style="position:absolute;width:' + $gbw + 'px;height:' + $gbh + 'px;padding:0px;margin:0px;text-align:center;"></div>';
		gBox += '</div>';
	gBox += '</div>';

	$('#page_content').prepend(gBox);
	$('img.frontCover').css({
		'position':'absolute'
	}).appendTo($('#show_box'));

	$('img.frontCover').css({
		'display':'none',
		'position':'relative',
		'z-index':'90',
		'height':'600px'
	});
	$('img.frontCover:first').addClass('active');
	setCover();
	setInterval('nextImage()',4500);
	
});
