$(document).ready(function () {
		
		// determine the section we're in based on the url
		var url_section = location.pathname.substr(base_path.length).replace(/^([^\/]+)(.*)$/, "$1");
		
		var current_section_img_jq = $('img#nav-'+url_section);
		if (current_section_img_jq.length) {
			var current_section_img = current_section_img_jq.get(0);
			current_section_img.src = current_section_img.src.replace(/\.(gif|jpg)/, '-over.$1');
			current_section_img_jq.addClass('current');
		}
		
		// preload images for and set hover events for top and main nav
		$('div#top-nav div a img, div#main-nav div div a img')
			.each(function() {
				// preload rollover images
				(new Image).src = this.src.replace(/\.(gif|jpg)/, '-over.$1');
			})
			.hover(
				function() {
					if (this.className.indexOf('current') == -1) {
						this.src = this.src.replace(/\.(gif|jpg)/, '-over.$1');
					}
				},
				function() {
					if (this.className.indexOf('current') == -1) {
						this.src = this.src.replace('-over', '');
					}
				}
			);
		
		// find the div with info about the banner image
		var info = $('#banner-image-info');
		
		// intercept clicks on the info area of the image map, but only if there is info
		if (info.length) {
			$('#banner-info-area').click(function(event) {
					event.preventDefault();
					$('body').append('<div class="banner-info-popup">'+info.html()+'</div')
						.find('.banner-info-popup')
						.css({
							'top': event.pageY-5+'px'
						})
						.click(function() {
								$(this).remove()
						});
			});
			
			// hide the image info
			$('#banner-image-info').hide();
		}
		
		$('#newsletter-email').focus(function() { 
			$(this).val('')
			$(this).css('color','#000000')
		})
});

