jQuery(function ($) {
	// Load the slides based on the current pathname
	var slidePath = '/slideshows/_html/' +
		window.location.pathname.slice(1).replace(/\/(?:default\.asp|index\.html?)?$/, '').replace(/\.(?:asp|html?)$/, '').replace(/\//g, '-') +
		'.html';

	
	$.ajax({
	    url: slidePath,
	    cache: false,
	    dataType: 'html',
	    success: function (html) {
	        $('#mini-main-slideshow').html(html);

			// Load slide images
			$('.slide').each(function () {
				var url = $(this).attr('data-image');
				$('<img src="' + url + '" width="869" height="252" alt="">').prependTo(this);
			});

			if ($.browser.msie) {
				$('.mini-main-slideshow').addClass('ie');

				$('.mini-main-slideshow .banner h2').each(function () {
					var h2 = $(this);

					if ($.browser.version < 8) { h2.find('a').append('<span class="arrow"></span>'); }

					h2.clone().html( h2.find('a').html() ).addClass('shadow').insertAfter(this);
					h2.siblings('h2').andSelf().wrapAll('<div class="headline">');

					if(h2.children('a:eq(0)').height() < h2.height() * .8 ) {
						h2.closest('div.headline').addClass('one-line');
					}
				});
			}


			$('.mini-main-slideshow').slideshow({
				slideSelector: '.slide',
				pager: '.mini-main-slideshow .pager',
				timeout: 6000,
				speed: 500,
				autoPlay: true,
				pauseOnHover: true
			});
	    }
	});
});

