$(window).ready(function(){
	// set the map to use thickbox, only if we have JavaScript enabled.
	$('#regions #map area, #regions a, #map_title a').addClass('thickbox');	
	
	// change the map urls if we have JavaScript enabled.
	$('#regions #map area, #regions #small-map area, #scroller .event_title a').each(function(){
		this.href = this.href.replace("-What-s-On-.html?regionID=", "spip.php?page=map&regionID=");
	});
	$('#regions a').each(function(){
		this.href = this.href.replace("-What-s-On-.html?stateID=", "spip.php?page=map&stateID=");
	});
	$('#map_title a').each(function(){
		this.href = this.href.replace("-What-s-On-.html", "spip.php?page=map");
	});
	$('#nav11').attr('href','spip.php?page=map').attr('rel','map').addClass('thickbox');
});

$(document).ready(function(){

  $('#scroller .event_title a').click(function(){
    return false;
  });
						   
	// IE6 PNG Fix
	$.ifixpng('IMG/pixel.gif');
	$('.fixpng').ifixpng();
						   
	// show the upcoming slider as we have JavaScript enabled.
	$('#upcoming, #latest-news').css('display','block');
	
	// change link colors on map rollover
	$('area').hover(
      function () {
        var $region = $(this).attr('alt');
		$('#regions a').each(function(){
			if($(this).attr('title') == $region) {
				$(this).addClass('on');
			}
		});
      }, 
      function () {
      	var $region = $(this).attr('alt');
		$('#regions a').each(function(){
			if($(this).attr('title') == $region) {
				$(this).removeClass('on');
			}
		});
      }
    );
	
	// Expanding Articles
	$('.expand_art').each(function(){
		var $this = $(this);
		var $hd = $('.art_title', $this);
		var $bd = $('.art_content', $this);
		
		$hd.click(function(){
			if ($this.hasClass('opener')) {
				$bd.slideUp();
			} else {
				$('.expand_art .art_content').slideUp();
				$('.expand_art').removeClass('opener');
				$bd.slideDown();
			}
			$this.toggleClass('opener');
		});
		$bd.hide();
		$('#art_content1').show();
		//$('#expand_art1').addClass('opener');
	});
	
	// Have all links to PDF downloads, open a new window
	$('a[href$=".pdf"], #col2 a[href$=".pdf"]').bind('click', function(){
		window.open($(this).attr('href'));
		return false; 
	});
	
});
