<!--
$(document).ready(function() {
	$('div.cycle img').each(function() {
		getImgSize($(this).attr('src'), $(this), 400, 266);
	});
	$('div.cycle').cycle({
		fx: 'fade',
		speed: 500,
		timeout: 5000,
		next: '#next',
		prev: '#prev',
		pause: 1,
		before: onBefore,
		after: onAfter
	});
	$('#pause').toggle(function() {
			$('div.cycle').cycle('pause');
			$(this).find('img').attr('src','/IMAGES/control-icons/play.gif').attr('alt','resume');
	},function() {
		$('div.cycle').cycle('resume');
		$(this).find('img').attr('src','/IMAGES/control-icons/pause.gif').attr('alt','pause');
	});
	$('#play').cycle('resume');
	$('div.cycle img').show();
	$('div.cycle img').click(function() {
		window.location = $(this).attr('alt');
		return false;
	});
});
function onBefore() { 
    $('#rotatorCaption').hide();
}
function onAfter() { 
    $('#rotatorCaption').html('<h3><a href="' + this.alt + '">' + this.title + '</a></h3>').fadeIn('500');
}
function getImgSize(imgSrc, imgObj, w, h) {
  var newImg = new Image();
  newImg.name = imgSrc;
  newImg.src = imgSrc;
  if (newImg.complete) {
    resize(newImg, w, h, imgObj);
  }
  else {
    newImg.onload = function() {
      resize(newImg, w, h, imgObj);
    }
  }
}
var resize = function(img, maxw, maxh, imgObj) {
  var ratio = maxh / maxw;
  if (img.height / img.width > ratio) {
    // height is the problem
    if (img.height > maxh) {
      img.width = Math.round(img.width * (maxh / img.height));
      img.height = maxh;
    }
  } else {
    // width is the problem
    if (img.width > maxh) {
      img.height = Math.round(img.height * (maxw / img.width));
      img.width = maxw;
    }
  }
  imgObj.attr('width', img.width);
  imgObj.attr('height', img.height);
  imgObj.css({'width':img.width,'height':img.height,'max-width':img.width,'max-height':img.height}); //2011-12-22 Set max/width/height for attempt at IE fix
};
-->
