$(document).ready(function(){


    $(".sel-year select").change(function() {
      zz = $("select option:selected").attr('value');
      window.location.href = zz;
    });
  

	//borrowed from jQuery easing plugin
	//http://gsgd.co.uk/sandbox/jquery.easing.php
	$.easing.easeInOutQuad = function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t + b;
		return -c/2 * ((--t)*(t-2) - 1) + b;
	}

  if ($('.carousel').length > 0)
  {
		$.scrollTo.defaults.axis = 'x';
    var $paneTarget = $('.carousel');

    $(".prev").click(function(){
  		$paneTarget.stop().scrollTo( '-=362px', 1000, { easing:'easeInOutQuad' });
  		return false;
  	});
    $(".next").click(function(){
  		$paneTarget.stop().scrollTo( '+=362px', 1000, { easing:'easeInOutQuad' });
  		return false;
  	});
  }

  if ($('.print_ad').length > 0)
  {
    $('.print_ad div a').lightBox();
  }

  if ($('.gallery').length > 0)
  {
    $('.gallery a').lightBox();
  }

  if ($('#listyear').length > 0)
  {
		$('#listyear').accordion({
    	active: true,
      header: '.head',
    	autoheight: false,
    	navigation: true
		});
  }

  if ($('#flow').length > 0)
  {
		/* CONFIG */
			xOffset = 10;
			yOffset = 20;
			// these 2 variable determine popup's distance from the cursor
			// you might want to adjust to get the right result
		/* END CONFIG */
		$("area").hover(function(e){
			this.t = this.title;
			this.title = "";
			$("body").append("<p id='tooltip'>"+ this.t +"</p>");
			$("#tooltip")
				.css("top",(e.pageY - xOffset) + "px")
				.css("left",(e.pageX + yOffset) + "px")
				.fadeIn("fast");
		  },
		function(){
			this.title = this.t;
			$("#tooltip").remove();
		  }).click(function(){return false});

		$("a.tooltip").mousemove(function(e){
			$("#tooltip")
				.css("top",(e.pageY - xOffset) + "px")
				.css("left",(e.pageX + yOffset) + "px");
		});
	}
})
