var rotate =
{
	currentItem: 0,
	url: new Array(),
	caption: new Array(),
	//paused: false,

	initialize: function() {
		rotate.url[0] = '/library/media/1033/windows/images/products/winfamily/windowshomeserver/soho/SlideShow01.jpg';
		rotate.url[1] = '/library/media/1033/windows/images/products/winfamily/windowshomeserver/soho/SlideShow02.jpg';
		rotate.url[2] = '/library/media/1033/windows/images/products/winfamily/windowshomeserver/soho/SlideShow03.jpg';
		rotate.url[3] = '/library/media/1033/windows/images/products/winfamily/windowshomeserver/soho/SlideShow04.jpg';

		rotate.caption[0] = 'Organize your digital media in a central location and easily share photos, videos, and more.';
		rotate.caption[1] = 'Store, share, and protect data for up to 10 computers.';
		rotate.caption[2] = 'Easily increase your data storage, by adding additional internal or external hard drives of any size.';
		rotate.caption[3] = 'Access important files in the office, or even on the road.';

		
		//preload images
		for (var i = 0; i < rotate.url.length; i++) {
			var loadImage = new Image();
			loadImage.src = rotate.url[i];
		}
		
		document.getElementById('imageRotation').src = rotate.url[rotate.currentItem];
		document.getElementById('imageRotationCaption').innerHTML = rotate.caption[rotate.currentItem];

		//$('#imageRotation')[0].attachEvent('onmouseover', rotate.pauseRotation);
		//$('#imageRotation')[0].attachEvent('onmouseout', rotate.startRotation);
	},

	/*pauseRotation: function() {
		rotate.paused = true;
	},
	
	startRotation: function() {
		rotate.paused = false;
	},*/
	
	changeImage: function() {
	//if (rotate.paused == false) {
		$('#imageRotation').animate({ opacity: 0.1 }, 'normal', function() {

			if (rotate.currentItem >= (rotate.url.length - 1))
				rotate.currentItem = 0;
			else
				rotate.currentItem = rotate.currentItem + 1;

			document.getElementById('imageRotation').src = rotate.url[rotate.currentItem];
			document.getElementById('imageRotationCaption').innerHTML = rotate.caption[rotate.currentItem];
			//document.getElementById('imageRotation').alt = rotate.caption[0];
			$('#imageRotation').animate({ opacity: 1 }, 'normal');
		});
		//}
	}
}

$(document).ready(function() {
	rotate.initialize();
	setInterval(rotate.changeImage, 6000);
});