﻿var Abl = {};

$(function() {
	
	// Manage menu effects
	var $menuItems = $("div#menu a");
	
	// Set the active tab
	var activeUrl = location.pathname.toLowerCase();
	$menuItems.each(function() {
		var $menuItem = $(this);
		this.img = $menuItem.children("img")[0];
		var menuLink = AblWindow.stripLocation(this.href).toLowerCase();
		if (menuLink === activeUrl) {
			$menuItem.addClass("active");
			this.img.src = this.img.src.replace(".png", "Active.png");
		}
		this.defaultSrc = this.img.src;
	});
	

	
	// Provide roll-over effects to the non-active tabs
	$menuItems.filter(":not(.active)").hover(function() {
		this.img.src = this.img.src.replace(".png", "Hover.png");
	}, function() {
		this.img.src = this.defaultSrc;
	});
	


	// Add rollover effects to image links
	$("a.rollover img").hover(function() {
		this.src = this.src.replace("_50t_", "_100t_");
	}, function() {
		this.src = this.src.replace("_100t_", "_50t_");
	});

	
	// Clean-up on exit
	$(window).unload(function() {
		$menuItems.unbind().each(function() {
			this.img = null;
			this.defaultSrc = null;
		});
	});
	
	
});
