function PopupCenter(pageURL, title,w,h) {
	var left = (screen.width/2)-(w/2);
	var top = (screen.height/2)-(h/2);
	var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
}

jQuery(document).ready(function($) { 
	// fade out any flash messages we may have after 5 seconds
	// setTimeout('$("div.message[id$=Message]").fadeOut();', 5000);
	// remove first bullet from the top nav
	$('#wrapper .masthead .topMenu ul li:first-child').css('list-style-type', 'none');
	// remove last divider from sub nav
	$('#wrapper .menu ul li ul li:last-child').css('background-image', 'none');
	// indicate third level nav
	$('#wrapper .menu ul li ul li ul').parent('li').addClass('withChild');
	// popups for 3d configurator
	var threeDPopWidth = 960;
	var threeDPopHeight = 500;
	$('a.3-door-link').click(function() {
		PopupCenter(this.href, '3DConfigurator', threeDPopWidth, threeDPopHeight);
		return false;
	});
	$('a.4-door-link').click(function() {
		PopupCenter(this.href, '3DConfigurator', threeDPopWidth, threeDPopHeight);
		return false;
	});
	$('a.5-door-link').click(function() {
		PopupCenter(this.href, '3DConfigurator', threeDPopWidth, threeDPopHeight);
		return false;
	});
	$('a.6-door-link').click(function() {
		PopupCenter(this.href, '3DConfigurator', threeDPopWidth, threeDPopHeight);
		return false;
	});
	$('a.7-door-link').click(function() {
		PopupCenter(this.href, '3DConfigurator', threeDPopWidth, threeDPopHeight);
		return false;
	});
	$('a.8-door-link').click(function() {
		PopupCenter(this.href, '3DConfigurator', threeDPopWidth, threeDPopHeight);
		return false;
	});
	// colorbox init
	$('blockquote.brochureRack a').colorbox({width:1024, height:768, iframe:true});
	$('a[rel="lightbox"]').colorbox();
	$('a[rel="colorbox"]').colorbox();
	// ie hover fixes
	$('#wrapper .menu ul li').hover(
		function() {
			$(this).children('ul').css('display', 'block');
		},
		function() {
			$(this).children('ul').css('display', 'none');
		}
	);
	
});
