var msec = 5000;
var photoIndex = 0;
var maxIndex = 8;
var mytime;

function changePhoto() {
	photoIndex = (photoIndex == maxIndex) ? 1 : photoIndex + 1;
	document.getElementById('jspicture').src = 'img/slideshow/img' + photoIndex + '.jpg';
	mytime = setTimeout(changePhoto, msec); 
}

function showPromoVideo() {
	clearTimeout(mytime);

	var innerHTML = '<div id="promo_video"><p>To view this content the Adobe Flash Player must be installed.</p><p>Click on the icon below to download the latest player:</p><p><a href="http://www.adobe.com/go/getflashplayer" target="_blank"><img src="img/getflash.png" width="112" height="33" /></a></p></div>';
	$('#promo').css({'padding':'8px 0 0 8px', 'width':'395px', 'height':'316px'}).html(innerHTML);
	
	var flashvars = {};

	var params = {};
	params.scale = "noscale";
	params.wmode = "opaque";						

	var attributes = {};
	attributes.id = "flash";
			
	swfobject.embedSWF("promo-player.swf", "promo_video", "387", "308", "9.0.0", "", flashvars, params, attributes);
}

$(document).ready(function() {
	$('#jspicture').bind('click', function(){showPromoVideo();});
});

changePhoto();