//this function switches adverts and provides a nice animation effect
function slideSwitch(name,hide) {
var $active = $(name+' span.active');
//if we don't have an active class make the last in sequence active
if ( $active.length == 0 ) $active = $(name+' span:last');
//find out what the next one is and save it into the $next jquery object (if we don't have one then the first will be next
var $next =  $active.next().length ? $active.next() : $(name+' span:first');
//now change the active one to the last active one
$active.addClass('last-active')
if(hide)$active.hide();
//change the opacity of the next and add the active class, then remove from the currently active
$next.css({opacity: 0.0}).show().addClass('active').animate({opacity: 1.0}, 1000, function() {
$active.removeClass('active last-active');
var $next =  $active.next().length ? $active.next() : $(name+' span:first');

});
}
$(document).ready(function() {
$(function() {
//now set the interval
setInterval( "slideSwitch('#slideshow')", 5000 );
setInterval( "slideSwitch('#whyBuy',true)", 5000);
});
});
$(document).ready(function() {
							//hide all
							$('#whyBuy span').hide();
							//show the first para
							$('#whyBuy span:first').show();
							$('#whyBuy span:first').addClass('active');
							//add the rollover to the dds within bestbuys
							$('.marketingAnimation').mouseenter(function(e){
																	//force the others to dissappear
																	$(e.target).siblings().children('.withoutpic').removeClass("hide");																	
																	$(e.target).siblings().children('.withoutpic').show();
																	$(e.target).siblings().children('.withPic').hide();													
																	
																	//move on
																	$(e.target).children(".withPic").removeClass("hide");
																	$(e.target).children(".withPic").show();
																	$(e.target).children(".withoutpic").hide();
																	
																	return false;
																	});
							
						   });


