function showThumbs(videos){
	var thumbs = $('.vimeo-thumbs');
	
	for (var i = 0;i < 6;i++) {
		var thumbPath = videos[i].thumbnail_medium;
		var thumbURL = videos[i].id;
		thumbs.append('<a href="http://vimeo.com/channels/startlive#'+thumbURL+'"><img src="'+thumbPath+'" height="80" /></a>');
	}
}

function nextShowCountdown(){
	var dateOfShow = $('.countdown').find('p').html();
	var dateArray = dateOfShow.split('-');
	var showDay = parseInt(dateArray[0]);
	var showMonth = parseInt(dateArray[1]);
	var showYear = parseInt(dateArray[2]);	
	var currentdate = new Date();	
	var showdate = new Date(showYear,showMonth-1,showDay+1);	
	var difference = showdate.getTime() - currentdate.getTime();
	
    var daysDif = Math.floor(difference/1000/60/60/24);
    difference -= daysDif*1000*60*60*24
    var hoursDif = Math.floor(difference/1000/60/60);
    difference -= hoursDif*1000*60*60
    var minutesDif = Math.floor(difference/1000/60);
    difference -= minutesDif*1000*60
    var secondsDif = Math.floor(difference/1000);

	if(daysDif > 1){var dayOrDays = 'days';} else {var dayOrDays = 'day';}
	if(hoursDif > 1){var hourOrHours = 'hours';} else {var hourOrHours = 'hour';}
	if(minutesDif > 1){var minOrMins = 'minutes';} else {var minOrMins = 'minute';}

    $('.countdown').find('p').html('<span>'+daysDif+'</span> '+dayOrDays+', <span>'+(hoursDif-5)+'</span> '+hourOrHours+', <span>'+minutesDif+'</span> '+minOrMins+' until next Start live event');
}

function pictureViewer(){
	var pictureHolder = $('.our-work-page .right-col');
	var howMeny = pictureHolder.find('img').length;
	pictureHolder.find('img:first-child').css({'z-index':'20'});
	pictureHolder.append('<div class="thumbs"></div>');
	for(var i=0;howMeny > i;i++){
		var imgSrc = pictureHolder.find('img:nth-child('+(i+1)+')').attr('src');
		pictureHolder.find('.thumbs').append('<a href="#"><img width="69" height="51" src="'+imgSrc+'"/></a>');
	}
	pictureHolder.find('.thumbs a:last-child').addClass('last');
	
	var storeIndex;
	pictureHolder.find('.thumbs a').click(function(){
		var index = pictureHolder.find('.thumbs a').index(this);
		storeIndex = index;
		pictureHolder.find('img').css({'z-index':'0'});
		pictureHolder.find('.thumbs a').css({'opacity':'0.5'});
		pictureHolder.find('img:nth-child('+(index+1)+')').css({'z-index':'20'});
		$(this).css({'opacity':'1'});
		return false;
	}).hover(function(){
		$(this).css({'opacity':'1'});
	},
	function(){
		var thisIndex = pictureHolder.find('.thumbs a').index(this);
		if(storeIndex != thisIndex){
			$(this).css({'opacity':'0.5'});
		}
	});
	pictureHolder.find('.thumbs a:first-child').trigger('click');
}

$(document).ready(function(){
	//nextShowCountdown();
});