var newWindow= null;

function openNewsletterWindow(URL){
	var xPos = (screen.width-500)/2;
	var yPos = (screen.height-375)/2;
	newWindow=window.open('/joinnewslet.html', 'pics', 'width=560,height=320,scrollbars=no');
	newWindow.moveTo(xPos,yPos);
	newWindow.resizeTo(560, 320);
	newWindow.focus();
}



$(document).ready(function() {

	/*
	 * If there is an elemented with the back_link class and the browser has 
	 * a history object then allow the user to click on that element and have 
	 * the click event take the user back one item in the history.
	 */	
	function createBackLink() {
		if (window.history && (window.history.length > 0)) {
			$('.back_link').addClass('linked');
			$('.back_link').click(function () {
				window.history.back();
			});
		}
	}
		
	createBackLink();
	
	/*
	 * For the product management full registration links instead of following
	 * the link, submit the surrounding form.  This is a hack to get around
	 * problems with the Berkeley's registration process.  The problem
	 * is that their vendor doesn't provide a URL to link to signup for the
	 * entire course.  The only way to reach such a page is through a POST.
	 */
	$("a.pm_full_reg").click(function(event) {
		event.preventDefault();
		$(this).parents("form").submit();
	});
	
	$("#menu_programs").hover(
		function () {
			$(this).find(".subnav").removeClass("hide_sub");
			$(this).find("a:first").addClass("show_hover");
		},
		function () {
			$(this).find(".subnav").addClass("hide_sub");
			$(this).find("a:first").removeClass("show_hover");
		}
	);
	$("#menu_clients").hover(
		function () {
			$(this).find(".subnav2").removeClass("hide_sub");
			$(this).find("a:first").addClass("show_hover2");
		},
		function () {
			$(this).find(".subnav2").addClass("hide_sub");
			$(this).find("a:first").removeClass("show_hover2");
		}
	);
	
	$("#newsletter_link").click( function() {
		openNewsletterWindow();
		return false;
	});	
});