(function($) {

	function timedRedirect(url) {
		setTimeout(function() {
			window.location.href = url;
		},5000);
	}

	$(document).ready(function(){
		
		var $redirectlinks = $("a.timedredirect");

		if ($redirectlinks.length > 0) {
			var $rlink = $redirectlinks.eq(0);
			var url = $rlink.attr("href");
			timedRedirect(url);
		}


		$('.producttable .thumb')
				.attr('title','&nbsp;')
				.tooltip({
					onBeforeShow: function(){
						var $trigger = $(this.getTrigger()),
							$title = $trigger.next(),
							$subtitle = $title.next(),
							$description = $subtitle.next().find('.product-description'),
							$tip = $(this.getTip()),
							content = '<div class="large-product-image"><img src="'+$('a', $trigger).attr('href')+'" alt="" /></div>';

						content = content+'<div class="product-info"><b>'+$title.text()+'</b><br />'+$subtitle.text()+'<br /><br />'+$description.text()+'</div>';

						$tip.html(content);
					},
					effect: 'slide'
				})
				.dynamic({ bottom: { direction: 'down', bounce: true } })
				.click(function(e){e.preventDefault()});
	});
})(jQuery);
