$(document).ready(function() {
	$("#featured .view-featuredblocks  .views-row").click(function() {
		//alert($(this).find(".views-field-field-link-value a").attr('href'));
		var linkElement = $(this).find(".views-field-field-link-value a");
		var hrefElement = linkElement.attr('href');
		//linkElement.trigger('click');
		location.href = hrefElement;
		//Drupal.settings.basePath + 
	});
	if ($(window).width() < 1014) {
		$("#slideshow .view-slideshow").width(1003);
		$("#slideshow .view-slideshow .view-content ul li").width(1003);
		$("#slideshow .view-slideshow .view-content .views-row .views-field-body").css('left', '10px');
		$("#block-views-featured_news-block_1").css('left', '10px');
	}
	$("div.view-slideshow div.view-content div.item-list").carousel({ 
		pagination: true, 
		autoSlide: true,
		autoSlideInterval: 5000
	});
	$("div.view-slideshow div.view-content div.item-list li").each(function(index) {
		$(this).css('background', 'url(' + $(this).find("img").attr("src") + ') center no-repeat');
	});
	
	$('.view-featured-news .view-content .views-row:gt(0)').hide();
	setInterval(function() {
  		$('.view-featured-news .view-content :first').fadeOut(2000)
     		.next('.views-row').fadeIn(2000)
     		.end().appendTo('.view-featured-news .view-content');
  	}, 5000);
});
