// Jonny slideshow and different date image show
//JTM - only show specific images on certain days 
var imlocation="banners/";

function ImageArray(n){this.length=n;for(var i=1;i<=n;i++){this[i]=" "}}image=new ImageArray(7);image[0]="sunday.jpg";image[1]="monday.jpg";image[2]="tuesday.jpg";image[3]="wednesday.jpg";image[4]="thursday.jpg";image[5]="friday.jpg";image[6]="saturday.jpg";var currentdate=new Date();var imagenumber=currentdate.getDay();

function slideSwitch(){
	var $active = $("#slideshow a.active");
	if($active.length == 0){
		$active = $("#slideshow a:last");
	}
	var $next = $active.next().length ? $active.next() : $("#slideshow a:first");
	$active.addClass("last-active");
	$next.css({opacity:0}).addClass("active").animate({opacity:1},1000,function(){ $active.removeClass("active last-active"); });
}	
	
	$(function(){
	
		var imgLength = $("#slideshow a").length;
		//console.log("imgLength "+imgLength);
		
		//if(imagenumber==1){
		
		if(imgLength === 1){	
			//$("#slideshow img:first").removeClass("active");
			//$("#slideshow .slideLink").prepend("<img class='active slide1' border='0' src='"+imlocation+image[imagenumber]+"'>");
			//setInterval("slideSwitch()",4000);
			console.log("true "+imgLength);
		}else if(imgLength > 1){
			setInterval("slideSwitch()",4000);
			//console.log("false "+imgLength);
		}
		//}else{	
			
			//
		//}
			
	});


/*<a href='javascript:;'></a>*/ /*var imlocation="banners/";function ImageArray(n){this.length=n;for(var i=1;i<=n;i++){this[i]=" "}}image=new ImageArray(7);image[0]="sunday.jpg";image[1]="monday.jpg";image[2]="tuesday.jpg";image[3]="wednesday.jpg";image[4]="thursday.jpg";image[5]="friday.jpg";image[6]="saturday.jpg";var currentdate=new Date();var imagenumber=currentdate.getDay();function slideSwitch(){var $active=$("#slideshow img.active");if($active.length==0){$active=$("#slideshow img:last")}var $next=$active.next().length?$active.next():$("#slideshow img:first");$active.addClass("last-active");$next.css({opacity:0}).addClass("active").animate({opacity:1},1000,function(){$active.removeClass("active last-active")})}$(function(){if(imagenumber==4){$("#slideshow img:first").removeClass("active");$("#slideshow").prepend("<a href="/sunbrella-highpoint.html"><img class='active slide1' border='0' src='"+imlocation+image[imagenumber]+"'></a>");setInterval("slideSwitch()",6000)}else{setInterval("slideSwitch()",6000)}});*/
