$(document).ready(function() {		
	
	//Execute the slideShow, set 4 seconds for each images
	slideShow(10000);
});

$(document).ready(function() {		
	
	//Execute the slideShow, set 4 seconds for each images
	slideShow2(10000);

});

$(document).ready(function() {		
	
	//Execute the slideShow, set 4 seconds for each images
	slideShow3(10002);

});
$(document).ready(function() {		
	
	//Execute the slideShow, set 4 seconds for each images
	slideShow4(10003);

});


function slideShow(speed) {
    

	//append a LI item to the UL list for displaying caption
	$('ul.slideshow').append('<li id="slideshow-caption" class="caption"><div class="slideshow-caption-container"><h3></h3><p></p><h2></h2><h6 id="a1"></h6><h6 id="a2"></h6><h6 id="a3"></h6><h6 id="a4"></h6><h6 id="a5"></h6></div></li>');
	//Set the opacity of all images to 0
	$('ul.slideshow li').css({opacity: 0.0});
	//Get the first image and display it (set it to full opacity)
	$('ul.slideshow li:first').css({opacity: 1.0});
	
	//Get the caption of the first image from REL attribute and display it
	$('#slideshow-caption h3').html($('ul.slideshow a:first').find('img.bb1').attr('tit'));
	$('#slideshow-caption p').html($('ul.slideshow a:first').find('img.bb1').attr('alt'));  
  $('#slideshow-caption h2').html($('ul.slideshow a:first').find('img.bb1').attr('pris'));
  $('#slideshow-caption h6#a1').html($('ul.slideshow a:first').find('img.bb1').attr('zzz1')); 
   $('#slideshow-caption h6#a2').html($('ul.slideshow a:first').find('img.bb1').attr('zzz2'));
   $('#slideshow-caption h6#a3').html($('ul.slideshow a:first').find('img.bb1').attr('zzz3')); 
   $('#slideshow-caption h6#a4').html($('ul.slideshow a:first').find('img.bb1').attr('zzz4'));
   $('#slideshow-caption h6#a5').html($('ul.slideshow a:first').find('img.bb1').attr('zzz5'));  
		//Display the caption
	$('#slideshow-caption').css({opacity: 0.6, bottom:0});
	$('ul.slideshow h5').css({opacity: 0.7});
	$('ul.slideshow h4').css({opacity: 0.7});


	
	//Call the gallery function to run the slideshow	

	var timer = setInterval('gallery()',speed);   
	
	//pause the slideshow on mouse over
    $('#slideshow-caption h3').click(function(){
    	var current = ($('ul.slideshow li.show')?  $('ul.slideshow li.show') : $('#ul.slideshow li:first'));
	        window.location=current.find('a').attr('href'); return false;
    });
    
    $('ul.slideshow h6#a1').click(function(){
    clearInterval(timer);
      var current = ($('ul.slideshow li#s1')); 
        current.css({opacity: 0.5}).addClass('show').animate({opacity: 1.0}, 1000);	
    $('ul.slideshow li').css({opacity: 0.0});
	//Get the first image and display it (set it to full opacity)
	$('ul.slideshow li#s1').css({opacity: 1.0});
	    
  var tit = current.find('img.bb1').attr('tit');	
	var desc = current.find('img.bb1').attr('alt');
  var dc = current.find('img.bb1').attr('pris');
  var zz1 = current.find('img.bb1').attr('zzz1');
    var zz2 = current.find('img.bb1').attr('zzz2');
     var zz3 = current.find('img.bb1').attr('zzz3');
    var zz4 = current.find('img.bb1').attr('zzz4');
    var zz5 = current.find('img.bb1').attr('zzz5'); 
	
    $('#slideshow-caption').slideToggle(300, function () { 
		$('#slideshow-caption h3').html(tit); 
	 		$('#slideshow-caption p').html(desc);
    	$('#slideshow-caption h2').html(dc);
      $('#slideshow-caption h6#a1').html(zz1); 
      $('#slideshow-caption h6#a2').html(zz2);
      $('#slideshow-caption h6#a3').html(zz3); 
      $('#slideshow-caption h6#a4').html(zz4); 
      $('#slideshow-caption h6#a5').html(zz5);  
       
    $('#slideshow-caption').slideToggle(500); 
  
    });

  
   
		//Display the caption 
	$('#slideshow-caption').css({opacity: 0.6, bottom:0});
	//$('ul.slideshow h5').css({opacity: 0.7});
  //$('ul.slideshow h4').css({opacity: 0.7}); 
   $('#slideshow-caption h3').click(function(){
    	//var current = ($('ul.slideshow li.show')?  $('ul.slideshow li.show') : $('#ul.slideshow li:first'));
	        window.location=current.find('a').attr('href'); return false;
    });
    }, 	
		function () {
		      
    
			timer = setInterval('gallery()',speed);	return false;		
		});
    	   // a2
     $('ul.slideshow h6#a2').click(function(){
    clearInterval(timer);
    
      var current = ($('ul.slideshow li#s2'));
       	  current.css({opacity: 0.5}).addClass('show').animate({opacity: 1.0}, 1000);	
    	  $('ul.slideshow li').css({opacity: 0.0});
	//Get the first image and display it (set it to full opacity)
	$('ul.slideshow li#s2').css({opacity: 1.0});
	   
  var tit = current.find('img.bb1').attr('tit');	
	var desc = current.find('img.bb1').attr('alt');
  var dc = current.find('img.bb1').attr('pris');
  var zz1 = current.find('img.bb1').attr('zzz1');
    var zz2 = current.find('img.bb1').attr('zzz2');
     var zz3 = current.find('img.bb1').attr('zzz3');
    var zz4 = current.find('img.bb1').attr('zzz4');
    var zz5 = current.find('img.bb1').attr('zzz5');
 
	
    $('#slideshow-caption').slideToggle(300, function () { 
		$('#slideshow-caption h3').html(tit); 
	
		$('#slideshow-caption p').html(desc);
    	$('#slideshow-caption h2').html(dc);
      $('#slideshow-caption h6#a1').html(zz1); 
      $('#slideshow-caption h6#a2').html(zz2);
      $('#slideshow-caption h6#a3').html(zz3); 
      $('#slideshow-caption h6#a4').html(zz4); 
      $('#slideshow-caption h6#a5').html(zz5);  
       
    $('#slideshow-caption').slideToggle(500); 
    
    }); 
 
  
   
		//Display the caption 
	$('#slideshow-caption').css({opacity: 0.6, bottom:0});
	//$('ul.slideshow h5').css({opacity: 0.7});
  //$('ul.slideshow h4').css({opacity: 0.7}); 
     $('#slideshow-caption h3').click(function(){
    	//var current = ($('ul.slideshow li.show')?  $('ul.slideshow li.show') : $('#ul.slideshow li:first'));
	        window.location=current.find('a').attr('href'); return false;
    });
    }, 	
		function () {
			timer = setInterval('gallery()',speed);return false;			
		} 
    	   ); 
    	   
    	               // a3
     $('ul.slideshow h6#a3').click(function(){
    clearInterval(timer);
      var current = ($('ul.slideshow li#s3')); 
           	  current.css({opacity: 0.5}).addClass('show').animate({opacity: 1.0}, 1000);
    	  $('ul.slideshow li').css({opacity: 0.0});
	//Get the first image and display it (set it to full opacity)
	$('ul.slideshow li#s3').css({opacity: 1.0});
	
	var tit = current.find('img.bb1').attr('tit');	
	var desc = current.find('img.bb1').attr('alt');
  var dc = current.find('img.bb1').attr('pris');
	var zz1 = current.find('img.bb1').attr('zzz1');
    var zz2 = current.find('img.bb1').attr('zzz2');
     var zz3 = current.find('img.bb1').attr('zzz3');
    var zz4 = current.find('img.bb1').attr('zzz4');
    var zz5 = current.find('img.bb1').attr('zzz5');
    
    $('#slideshow-caption').slideToggle(300, function () { 
		$('#slideshow-caption h3').html(tit); 
	
		$('#slideshow-caption p').html(desc);
    	$('#slideshow-caption h2').html(dc);
      $('#slideshow-caption h6#a1').html(zz1); 
      $('#slideshow-caption h6#a2').html(zz2);
      $('#slideshow-caption h6#a3').html(zz3); 
      $('#slideshow-caption h6#a4').html(zz4); 
      $('#slideshow-caption h6#a5').html(zz5);  
       
    $('#slideshow-caption').slideToggle(500); 
    
    }); 
 
  

   
		//Display the caption
	$('#slideshow-caption').css({opacity: 0.6, bottom:0});
	//$('ul.slideshow h5').css({opacity: 0.7}); 
	//$('ul.slideshow h4').css({opacity: 0.7});
    $('#slideshow-caption h3').click(function(){
    	//var current = ($('ul.slideshow li.show')?  $('ul.slideshow li.show') : $('#ul.slideshow li:first'));
	        window.location=current.find('a').attr('href'); return false;
    });
    }, 	
		function () {
			timer = setInterval('gallery()',speed);	return false;		
		}
    	   );
         

              // a4
     $('ul.slideshow h6#a4').click(function(){
    clearInterval(timer);
      var current = ($('ul.slideshow li#s4')); 
           	  current.css({opacity: 0.5}).addClass('show').animate({opacity: 1.0}, 1000);
    	  $('ul.slideshow li').css({opacity: 0.0});
	//Get the first image and display it (set it to full opacity)
	$('ul.slideshow li#s4').css({opacity: 1.0});
	
	var tit = current.find('img.bb1').attr('tit');	
	var desc = current.find('img.bb1').attr('alt');
  var dc = current.find('img.bb1').attr('pris');
	var zz1 = current.find('img.bb1').attr('zzz1');
    var zz2 = current.find('img.bb1').attr('zzz2');
     var zz3 = current.find('img.bb1').attr('zzz3');
    var zz4 = current.find('img.bb1').attr('zzz4');
    var zz5 = current.find('img.bb1').attr('zzz5');
    
    $('#slideshow-caption').slideToggle(300, function () { 
		$('#slideshow-caption h3').html(tit); 
	
		$('#slideshow-caption p').html(desc);
    	$('#slideshow-caption h2').html(dc);
      $('#slideshow-caption h6#a1').html(zz1); 
      $('#slideshow-caption h6#a2').html(zz2);
      $('#slideshow-caption h6#a3').html(zz3); 
      $('#slideshow-caption h6#a4').html(zz4); 
      $('#slideshow-caption h6#a5').html(zz5);  
       
    $('#slideshow-caption').slideToggle(500); 
    
    }); 
 
  

   
		//Display the caption
	$('#slideshow-caption').css({opacity: 0.6, bottom:0});
	//$('ul.slideshow h5').css({opacity: 0.7}); 
	//$('ul.slideshow h4').css({opacity: 0.7});
    $('#slideshow-caption h3').click(function(){
    	//var current = ($('ul.slideshow li.show')?  $('ul.slideshow li.show') : $('#ul.slideshow li:first'));
	        window.location=current.find('a').attr('href'); return false;
    });
    }, 	
		function () {
			timer = setInterval('gallery()',speed);	return false;		
		}
    	   );
              // a5
     $('ul.slideshow h6#a5').click(function(){
    clearInterval(timer);
        var current = ($('ul.slideshow li#s5')); 
         current.css({opacity: 0.5}).addClass('show').animate({opacity: 1.0}, 1000);        
    	   $('ul.slideshow li').css({opacity: 0.0});
	//Get the first image and display it (set it to full opacity)
	$('ul.slideshow li#s5').css({opacity: 1.0});
	    
  var tit = current.find('img.bb1').attr('tit');	
	var desc = current.find('img.bb1').attr('alt');
  var dc = current.find('img.bb1').attr('pris');
  var zz1 = current.find('img.bb1').attr('zzz1');
    var zz2 = current.find('img.bb1').attr('zzz2');
     var zz3 = current.find('img.bb1').attr('zzz3');
    var zz4 = current.find('img.bb1').attr('zzz4');
    var zz5 = current.find('img.bb1').attr('zzz5');
   
	
    $('#slideshow-caption').slideToggle(300, function () { 
		$('#slideshow-caption h3').html(tit); 
	
		$('#slideshow-caption p').html(desc);
    	$('#slideshow-caption h2').html(dc);
      $('#slideshow-caption h6#a1').html(zz1); 
      $('#slideshow-caption h6#a2').html(zz2);
      $('#slideshow-caption h6#a3').html(zz3); 
      $('#slideshow-caption h6#a4').html(zz4); 
      $('#slideshow-caption h6#a5').html(zz5);  
       
    $('#slideshow-caption').slideToggle(500); 
    
    }); 

    
		//Display the caption
	$('#slideshow-caption').css({opacity: 0.6, bottom:0});
	//$('ul.slideshow h5').css({opacity: 0.7});
  //$('ul.slideshow h4').css({opacity: 0.7}); 
     $('#slideshow-caption h3').click(function(){
    	//var current = ($('ul.slideshow li.show')?  $('ul.slideshow li.show') : $('#ul.slideshow li:first'));
	        window.location=current.find('a').attr('href'); return false;
    });
    }, 	
		function () {
			timer = setInterval('gallery()',speed);	return false;		
		}
    	   );     	 	   
  	
}  

    

function gallery() {
    

	//if no IMGs have the show class, grab the first image
	var current = ($('ul.slideshow li.show')?  $('ul.slideshow li.show') : $('#ul.slideshow li:first'));
	//Get next image, if it reached the end of the slideshow, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().attr('id') == 'slideshow-caption')? $('ul.slideshow li:first') :current.next()) : $('ul.slideshow li:first'));
 
	//Get next image caption
	var tit = next.find('img.bb1').attr('tit');	
	var desc = next.find('img.bb1').attr('alt');
  var dc = next.find('img.bb1').attr('pris');   
   var zz1 = next.find('img.bb1').attr('zzz1');
    var zz2 = next.find('img.bb1').attr('zzz2');
     var zz3 = next.find('img.bb1').attr('zzz3');
    var zz4 = next.find('img.bb1').attr('zzz4');
    var zz5 = next.find('img.bb1').attr('zzz5');
 	//Set the fade in effect for the next image, show class has higher z-index
	next.css({opacity: 0.0}).addClass('show').animate({opacity: 1.0}, 1000);
	//Hide the caption first, and then set and display the caption
	$('#slideshow-caption').slideToggle(300, function () { 
		$('#slideshow-caption h3').html(tit); 
	 		$('#slideshow-caption p').html(desc);
    	$('#slideshow-caption h2').html(dc); 
      $('#slideshow-caption h6#a1').html(zz1); 
      $('#slideshow-caption h6#a2').html(zz2);
      $('#slideshow-caption h6#a3').html(zz3); 
      $('#slideshow-caption h6#a4').html(zz4); 
      $('#slideshow-caption h6#a5').html(zz5);  
    
      $('#slideshow-caption').slideToggle(500); 
		

	});		
   
	//Hide the current image
	current.animate({opacity: 0.0}, 1000).removeClass('show');
 
}  

function slideShow2(speed) {


	//append a LI item to the UL list for displaying caption
	$('ul.slideshow2').append('<li id="slideshow-caption2" class="caption"><div class="slideshow-caption-container"><h3></h3><p></p><h2></h2></div></li>');
	//Set the opacity of all images to 0
	$('ul.slideshow2 li').css({opacity: 0.0});
	//Get the first image and display it (set it to full opacity)
	$('ul.slideshow2 li:first').css({opacity: 1.0});
	//Get the caption of the first image from REL attribute and display it
	$('#slideshow-caption2 h3').html($('ul.slideshow2 a:first').find('img.bb1').attr('tit'));
	$('#slideshow-caption2 p').html($('ul.slideshow2 a:first').find('img.bb1').attr('alt'));  
  $('#slideshow-caption2 h2').html($('ul.slideshow2 a:first').find('img.bb1').attr('pris'));   
		//Display the caption
	$('#slideshow-caption2').css({opacity: 0.6, bottom:0});
	
//Call the gallery function to run the slideshow	

	var timer = setInterval('gallery2()',speed);   
	
	//pause the slideshow on mouse over
    $('#slideshow-caption2 h3').click(function(){
    	var current = ($('ul.slideshow2 li.show')?  $('ul.slideshow2 li.show') : $('#ul.slideshow2 li:first'));
	        window.location=current.find('a').attr('href'); return false;
    });

	
		
}




function gallery2() {


	//if no IMGs have the show class, grab the first image
	var current = ($('ul.slideshow2 li.show')?  $('ul.slideshow2 li.show') : $('#ul.slideshow2 li:first'));
	//Get next image, if it reached the end of the slideshow, rotate it back to the first image
	//var next = ((current.next().length) ? ((current.next().attr('id') == 'slideshow-caption2')? $('ul.slideshow2 li:first') :current.next()) : $('ul.slideshow2 li:first'));

	//Get next image caption
	var tit = current.find('img.bb1').attr('tit');	
	var desc = current.find('img.bb1').attr('alt');
  var dc = current.find('img.bb1').attr('pris');	 
 	//Set the fade in effect for the next image, show class has higher z-index
	//current.css({opacity: 0.0}).addClass('show').animate({opacity: 1.0}, 1000);
	//Hide the caption first, and then set and display the caption
	//$('#slideshow-caption2').slideToggle(300, function () { 
		$('#slideshow-caption2 h3').html(tit); 
		$('#slideshow-caption2 p').html(desc);
    	$('#slideshow-caption2 h2').html(dc);  
    //$('#slideshow-caption2').slideToggle(500); 
		
//	});		

	//Hide the current image
	//current.animate({opacity: 0.0}, 1000).removeClass('show');

}

function slideShow3(speed) {


	//append a LI item to the UL list for displaying caption
	$('ul.slideshow3').append('<li id="slideshow-caption3" class="caption"><div class="slideshow-caption-container"><h3></h3><p></p><h2></h2></div></li>');
	//Set the opacity of all images to 0
	$('ul.slideshow3 li').css({opacity: 0.0});
	//Get the first image and display it (set it to full opacity)
	$('ul.slideshow3 li:first').css({opacity: 1.0});
	//Get the caption of the first image from REL attribute and display it
	$('#slideshow-caption3 h3').html($('ul.slideshow3 a:first').find('img.bb1').attr('tit'));
	$('#slideshow-caption3 p').html($('ul.slideshow3 a:first').find('img.bb1').attr('alt'));  
  $('#slideshow-caption3 h2').html($('ul.slideshow3 a:first').find('img.bb1').attr('pris'));   
		//Display the caption
	$('#slideshow-caption3').css({opacity: 0.6, bottom:0});
		
	//Call the gallery function to run the slideshow	
	var timer = setInterval('gallery3()',speed);
	
	//pause the slideshow on mouse over
	$('ul.slideshow3').hover(
		function () {
			clearInterval(timer);	
		}, 	
		function () {
			timer = setInterval('gallery3()',speed);			
		}
	);
	
		
}




function gallery3() {


	//if no IMGs have the show class, grab the first image
	var current = ($('ul.slideshow3 li.show')?  $('ul.slideshow3 li.show') : $('#ul.slideshow3 li:first'));
	//Get next image, if it reached the end of the slideshow, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().attr('id') == 'slideshow-caption3')? $('ul.slideshow3 li:first') :current.next()) : $('ul.slideshow3 li:first'));

	//Get next image caption
	var tit = next.find('img.bb1').attr('tit');	
	var desc = next.find('img.bb1').attr('alt');
  var dc = next.find('img.bb1').attr('pris');	 
 	//Set the fade in effect for the next image, show class has higher z-index
	next.css({opacity: 0.0}).addClass('show').animate({opacity: 1.0}, 1000);
	//Hide the caption first, and then set and display the caption
	$('#slideshow-caption3').slideToggle(300, function () { 
		$('#slideshow-caption3 h3').html(tit); 
		$('#slideshow-caption3 p').html(desc);
    	$('#slideshow-caption3 h2').html(dc);  
    $('#slideshow-caption3').slideToggle(500); 
		

	});		

	//Hide the current image
	current.animate({opacity: 0.0}, 1000).removeClass('show');

}

function slideShow4(speed) {


	//append a LI item to the UL list for displaying caption
	$('ul.slideshow4').append('<li id="slideshow-caption4" class="caption"><div class="slideshow-caption-container"><h3></h3><p></p><h2></h2></div></li>');
	//Set the opacity of all images to 0
	$('ul.slideshow4 li').css({opacity: 0.0});
	//Get the first image and display it (set it to full opacity)
	$('ul.slideshow4 li:first').css({opacity: 1.0});
	//Get the caption of the first image from REL attribute and display it
	$('#slideshow-caption4 h3').html($('ul.slideshow4 a:first').find('img.bb1').attr('tit'));
	$('#slideshow-caption4 p').html($('ul.slideshow4 a:first').find('img.bb1').attr('alt'));  
  $('#slideshow-caption4 h2').html($('ul.slideshow4 a:first').find('img.bb1').attr('pris'));   
		//Display the caption
	$('#slideshow-caption4').css({opacity: 0.6, bottom:0});
	
	//Call the gallery function to run the slideshow	
	var timer = setInterval('gallery4()',speed);
	
	//pause the slideshow on mouse over
	$('ul.slideshow4').hover(
		function () {
			clearInterval(timer);	
		}, 	
		function () {
			timer = setInterval('gallery4()',speed);			
		}
	);
	
		
}




function gallery4() {


	//if no IMGs have the show class, grab the first image
	var current = ($('ul.slideshow4 li.show')?  $('ul.slideshow4 li.show') : $('#ul.slideshow4 li:first'));
	//Get next image, if it reached the end of the slideshow, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().attr('id') == 'slideshow-caption4')? $('ul.slideshow4 li:first') :current.next()) : $('ul.slideshow4 li:first'));

	//Get next image caption
	var tit = next.find('img.bb1').attr('tit');	
	var desc = next.find('img.bb1').attr('alt');
  var dc = next.find('img.bb1').attr('pris');	 
 	//Set the fade in effect for the next image, show class has higher z-index
	next.css({opacity: 0.0}).addClass('show').animate({opacity: 1.0}, 1000);
	//Hide the caption first, and then set and display the caption
	$('#slideshow-caption4').slideToggle(300, function () { 
		$('#slideshow-caption4 h3').html(tit); 
		$('#slideshow-caption4 p').html(desc);
    	$('#slideshow-caption4 h2').html(dc);  
    $('#slideshow-caption4').slideToggle(500); 
		

	});		

	//Hide the current image
	current.animate({opacity: 0.0}, 1000).removeClass('show');

}







