function slide() {
	
	pixels = 20;
	oldCurrentWidth = oldCurrentWidth - pixels;
	newCurrentWidth = newCurrentWidth + pixels;
	
	clearInt = false;
	if (oldCurrentWidth <= oldShortWidth) {
		clearInt = true;
		oldCurrentWidth = oldShortWidth;
		newCurrentWidth = newFullWidth;
	}
	if (newCurrentWidth >= newFullWidth) {
		clearInt = true;
		newCurrentWidth = newFullWidth;
		oldCurrentWidth = oldShortWidth;
	}

	$(newOne).css("width", newCurrentWidth+"px");
	$(oldOne).css("width", oldCurrentWidth+"px");
	if (clearInt == true) {
		clearInterval(slideIntervalId);
		$(oldOne).removeClass("active");
		action = false;
	}
}
var action;
action = false;
$(document).ready(function(){
	$("#slider h3").mouseover(function(){
		if (action == false) {
			if (!$(this).parent().parent().hasClass('active')) {
				oldOne = $("#slider li.active");
				newOne = $(this).parent().parent();
				
				oldFullWidth = $(oldOne).attr("full-width")*1;
				newFullWidth = $(newOne).attr("full-width")*1;
				oldShortWidth = $(oldOne).attr("short-width")*1;
				newShortWidth = $(newOne).attr("short-width")*1;
				
				oldCurrentWidth = $(oldOne).attr("full-width")*1;
				newCurrentWidth = $(newOne).attr("short-width")*1;
				
				$(newOne).addClass("active");
				$(newOne).css("width", newShortWidth+"px");
				$(oldOne).css("width", oldFullWidth+"px");
				i = 0;
				slideIntervalId = setInterval( "slide()", 1);
				action = true;
			}
			else {
				$(this).parent().parent().addClass('active');
			}
		}
	});
	$('.video-lightbox').show();
	
	var myManyPlayers = VideoJS.setup("All");
	
	$('.video-lightbox').prepend('<div class="shadow"></div><span class="close"></span>');
	$('.video-conteiner').prepend('<span class="watermark"></span>');
	$('.video-conteiner-small').prepend('<span class="watermark"></span>');
	$('.video-box').prepend('<div class="shadow"></div>');
	$('.video-lightbox').hide();
	
	$(".vjs-fullscreen-control").click(function(){
		if ($('.shadow').css('display') == 'block') {
			$('.shadow').hide();
		}
		else {
			$('.shadow').show();
			$('html').css('overflow', 'auto');
		}
	});
	
	$("span.close").click(function(){
		row = $(this).parent().parent().parent().index();
		col = $(this).parent().parent().index();
		videoIndex = col + (3*row);
		//alert(videoIndex);
		if ($('.project-inner').size())
			videoIndex++;
		myManyPlayers[videoIndex].pause();
		$(".video-lightbox").hide();
		$('.shadow').hide();
	});
	
	$('.shadow').height($('body').height()+'px');
	
	$(".video-link").click(function(){
		videoBox = $(this).parent().find('.video-lightbox');
		$(videoBox).show();
		$('.shadow').show();
		$('.shadow').height($('body').height()+'px');
		
		wHeight = $(window).height();
		sHeight = window.scrollY;
		
		$(".video-conteiner", videoBox).css('top', Math.round(sHeight + wHeight/2) + 'px');
		$('.video-conteiner').css('width', '640px');
		$('.video-conteiner video').css('width', '640px');
		$('.video-conteiner').css('height', '360px');
		$('.video-conteiner video').css('height', '360px');
		
		$("span.close", videoBox).css('top', Math.round(sHeight + wHeight/2) + 'px');
		
		return false;
	});
});
