function theRotator() {
	//Set the opacity of all images to 0
	$('#rightCol .pods .partners li').css({opacity: 0.0});
	
	//Get the first image and display it (gets set to full opacity)
	$('#rightCol .pods .partners li:first').css({opacity: 1.0});
		
	//Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds
	setInterval('rotate()',6000);
	
}

function rotate() {	
	//Get the first image
	var current = ($('#rightCol .pods .partners li.show')?  $('#rightCol .pods .partners li.show') : $('#rightCol .pods .partners li:first'));

	//Get next image, when it reaches the end, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('#rightCol .pods .partners li:first') :current.next()) : $('#rightCol .pods .partners li:first'));	
	
	//Set the fade in effect for the next image, the show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);

	//Hide the current image
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');
	
};

$(document).ready(function(){
						   
	Cufon.replace('h1.chunk', { fontFamily: 'ChunkFive' });
	Cufon.replace('h2.chunk', { fontFamily: 'ChunkFive' });
	
	theRotator();
	$(document).pngFix();
	
	var arrLis = $("#mycarousel li a")
	var selectedIndex;
	
	arrLis.each(
	function(intIndex){
		
		var el = arrLis[intIndex];
		
		if ($(el).hasClass("selected")){
				selectedIndex = intIndex+1;
		}
		
	});
	
	carousel()
	function carousel(){
		$('#mycarousel').jcarousel({
		vertical: true,
		scroll:12,
		start: selectedIndex
		});
	}

	$('.productList .tipTrigger').tooltip({
		relative: 'true',
		position: 'bottom right',
		offset: [-107, 0]
	});

	$('.mainProduct .winePromise').tooltip({
		relative: 'true',
		position: 'bottom right',
		offset: [-35, 0]
	});

	$('.mainProduct .storeClearance').tooltip({
		relative: 'true',
		position: 'bottom right',
		offset: [-35, -310]
	});

	$('.mainProduct .tipTrigger').tooltip({
		relative: 'true',
		position: 'bottom right',
		offset: [-200, 0]
	});
	
	
    if ($('#curiouswines')) {      
        //      $('curiouswinessubmit').addEvent('load', function(evt) {
        //          new Event(evt).stop();
                $('#curiouswines').submit();
        //     });
    }
	
/*	if($("tag")){
		var flash = new FlashObject("/_images/flash/tag.swf?Price=59.99&wasPrice=99.99", "tag", "184", "82", "9", "#ffffff");
		flash.addParam("WMODE","transparent");
		flash.addParam("menu","false");
		flash.addParam("quality","high");
		flash.addParam("movie", "tag.swf?Price=59.99&wasPrice=99.99");
		flash.write("tag");
	}

	if($("price")){
		var flash = new FlashObject("/_images/flash/price.swf?Price=250.50", "price", "130", "45", "9", "#ffffff");
		flash.addParam("WMODE","transparent");
		flash.addParam("menu","false");
		flash.addParam("quality","high");
		flash.addParam("movie", "price.swf?Price=250.50")
		flash.write("price");
	} */

});