$(document).ready(function(){
	
	$("table.striped tr:odd").addClass("odd");
	
	$("#headerShortcuts").buttonset();
	
	$("#topNav li:has(ul)").hover(function(){
		$("*").stop(true, true);
		$(this).find(">ul").slideDown("fast");
	}, function(){
		$("*").stop(true, true);
		$(this).find(">ul").slideUp("fast");
	})
	.find("a:first").append("<div class='arrow'></div>");
	
	$(".overlay").css("opacity", "0.6").click(function(){
		closePopupWindow();
	});
	
	
});

function closePopupWindow() {
	$(".overlay, .popupWindow").hide();
}

function loadPopupWindow(filename) {
	$(".overlay").show();
	$(".popupWindow .inner").load("popups/" + filename, function(){
		var left = 500;
		var top = 500;
		centerPopupWindow();
		$(this).parent().show();
	});
}

function centerPopupWindow(){  
	var windowWidth = document.documentElement.clientWidth;  
	var windowHeight = document.documentElement.clientHeight;  
	var popupHeight = $(".popupWindow").height() + 16;  
	var popupWidth = $(".popupWindow").width();  
	$(".popupWindow").css({  
		"position": "fixed",  
		"top": windowHeight/2 - popupHeight/2,  
		"left": windowWidth/2 - popupWidth/2  
	}); 
}


