$(document).ready(function (){setupVideoSpots();setupImageFrames();});function setupVideoSpots(){$('a.videospot').each(function (){if ($(this).children('img').length == 1){var location = $(this).offset();var caption = $(this).children('img').attr('title');var href = $(this).attr('href');$(this).prepend('<div class="videospot_frame" style=""><div class="playbutton"></div><div class="videospot_caption">' + caption + '</div></div>');}});}function setupImageFrames(){$('img.framed').each(function (){if ($(this).width() < 176) $(this).width(176);if ($(this).parent('a').length == 1){var href = $(this).parent('a').attr('href');$(this).parent('a').css('cursor','pointer');var attrs = 'style="cursor:pointer;" onclick="document.location.href=\'' + href + '\';"';}else var attrs = '';$(this).wrap('<div class="imageframe_wrapper"></div>').parent().before('<div class="imageframe" ' + attrs + '></div>');});}
$(document).ready(function(){if ($("#mainfeature")){setupMainfeature();slideShowize();}});var autospeed = 7000;var transitionspeed = 2000;var clicktransitionspeed = 0;var transitioning = false;var autoslidepaused = false;var asInt = '';function setupMainfeature(){$("#mainfeature").before('<div id="mainfeature_frame"><div id="mainfeature_link"></div><div id="mainfeature_bottombar"><div id="mainfeature_bottombar_caption"></div><div id="mainfeature_bottombar_nav"></div></div>').css({top:'-244px',marginBottom:'-244px'});var firstimg = $("div#mainfeature img:first");var caption = $(firstimg).attr('title');$("div#mainfeature_bottombar_caption").html(caption);setAutonext();$('div#mainfeature_frame').hover(function(){clearInterval(asInt);},function(){setAutonext();});}function setAutonext(){asInt = setInterval("ssNext(transitionspeed);",autospeed);}function slideShowize(){$('div#mainfeature img').hide();$('div#mainfeature').children('br').remove();var x = 0;var mfwidth = $('div#mainfeature_frame').outerWidth();var total = $('div#mainfeature img').length;$('div#mainfeature img').each(function(){$(this).addClass('mfimg'+x);$(this).attr('alt','mfimg'+x);$('div#mainfeature_bottombar_nav').prepend('<a href="#" onclick="this.blur();if (transitioning == false){animateTrans($(\'.mfimg'+x+'\'),undefined,clicktransitionspeed);}return false;" id="mfimg'+x+'">'+(x+1)+'</a>');if (x == 0){$(this).css('position','static').show();var link = $(this).parent('a').attr('href');$('div#mainfeature_link').wrap('<a id="mflink" href="'+link+'"></a>');$('div#mainfeature_bottombar_nav a').removeClass('active');var thisbutton = $(this).attr('alt');$('a#mfimg'+x).addClass('active');}else{$(this).hide();$(this).css({position:'absolute'});}x++;});var x = 0;}function ssNext(speed){if (transitioning == true) return false;if (speed == undefined || speed == '') speed = transitionspeed;var total = $('div#mainfeature img').length;var imnumber = 1;var current = $('div#mainfeature img:first');var x = 1;$('div#mainfeature img').each(function(){if ($(this).css('display') != 'none' && $(this).css('opacity') == 1){current = $(this);imnumber = x;}x++;});if ($(current).parent('a').next('a').children('img').length > 0){var next = $(current).parent('a').next('a').children('img');imnumber++;}else{var next = $('div#mainfeature img:first');imnumber = 1;}animateTrans(next,current,speed);}function animateTrans(next,current,speed){if ($(next).css('display') != 'none') return false;if (transitioning == true) return false;transitioning = true;if (current == undefined) $('div#mainfeature img').each(function(){if ($(this).css('display') != 'none') current = $(this);});if (speed == undefined) speed = transitionspeed;var nh = $(next).height();var nw = $(next).width();var ch = $(current).height();var cw = $(current).width();var navh = $(current).siblings('.nav').height();$(current).css({zIndex:6,position:'absolute',opacity:1});$(next).css({zIndex:3,opacity:1}).show();$('div#mainfeature_bottombar_nav a').removeClass('active');var nextbutton = $(next).attr('alt');$('a#'+nextbutton).addClass('active');var caption = $(next).attr('title');if (caption == undefined) caption = '';$("div#mainfeature_bottombar_caption").fadeTo(speed / 3,0,function(){$(this).html(caption).fadeTo(speed / 3,1);});var nextlink = $(next).parent('a').attr('href');if (nextlink != undefined){if ($('a#mflink').length == 0) $('div#mainfeature_link').wrap('<a id="mflink" href="'+nextlink+'"></a>');else $('a#mflink').attr('href',nextlink);}else if ($('a#mflink').length > 0) $('a#mflink').attr('href','');if (speed > 0) $(current).animate({opacity:0},speed,function(){transitioning = false;setTimeout("transitioning = false;",2000);$(this).hide().css({opacity:1,marginTop:'0px'});$(next).css({position:'static'});});else{transitioning = false;$(current).css({opacity:0});$(current).hide().css({opacity:1});$(next).css({position:'static'});transitioning = false;}}

