var scr = false;
	
	function doScroll(){
			
			if( parseInt($('#ccarousel ul').css('left')) <= -2000 ){ 
				$('#ccarousel ul').stop().css({left: 0}); 
				$('#ccarousel ul').animate( {left: '-=142'}, 1000 )
			}else{
				$('#ccarousel ul').animate( {left: '-=142'}, 1000 )
			}
			
			setTimeout( doScroll, 2000 );
		}
	  $(document).ready(function(){
	  
		$('#ccarousel ul').css({left: 0});
		$('#ccarousel ul').append( $('#ccarousel li:first').clone() );
		
		setTimeout( doScroll, 2000 );
	  
		$('.featured').jCarouselLite({
			btnNext: '#featured-next',
			btnPrev: '#featured-prev',
			visible: 4
		});
		
		//$('.clients li').css({width: 'auto'});
		
		$(function() {    
		
	if( !(navigator.userAgent.match(/iPhone/i)) && !(navigator.userAgent.match(/iPod/i)) ){ 	
     $(".watch-us-video a").click(function() {
        
			   $(".watch-us-video a").fancybox({
				  'content':'<div id="video" style="height:310px;width:500px;"></div>',
				  'hideOnContentClick': false,
				  'scrolling': false,
				  'titleShow': false,
				  'autoDimensions': false,
				  'width': '500', 
				  'height':'276',
				  'padding': '5',
				  'onComplete': function() {
					jwplayer('video').setup({
					  'flashplayer': 'http://www.reelsinmotion.net/i/jwplayer/player.swf',
					  'skin': 'http://www.reelsinmotion.net/i/jwplayer/simple/simple.zip',
					  'id': 'player1',
					  'width': '500', 
					  'height': '276',
					  'autostart': true,
					  'levels': [
						{ 'file': this.href }
					  ]
					});
				  },
				  'onCleanup': function() {
					jwplayer('video').remove();
				  }
				});
			  
			   return false;
			 });
		}
			 
			 $(".video-thumb-featured a").click(function() {
        
			   $(".video-thumb-featured a").fancybox({
				  'content':'<div id="video" style="height:310px;width:500px;"></div>',
				  'hideOnContentClick': false,
				  'scrolling': false,
				  'titleShow': false,
				  'autoDimensions': false,
				  'width': '500', 
				  'height':'276',
				  'padding': '5',
				  'onComplete': function() {
					jwplayer('video').setup({
					  'flashplayer': '<?=BASE;?>i/jwplayer/player.swf',
					  'skin': '<?=BASE;?>i/jwplayer/skin/stormtrooper.zip',
					  'id': 'player1',
					  'width': '500', 
					  'height': '276',
					  'autostart': true,
					  'file': this.href
					});
				  },
				  'onCleanup': function() {
					jwplayer('video').remove();
				  }
				});
			  
			   return false;
			 });
		   });
		   
		   $(".video-thumb-featured a, .video-thumb-featured-port a").mouseenter( function(){
				$(this).addClass('hovered');
			}).mouseleave( function(){
				$(this).removeClass('hovered');
			});
			
			$('.portfolio-item a').mouseenter( function(){
				$(this).find( 'div, span' ).fadeIn('fast');
			}).mouseleave( function(){
				$(this).find( 'div, span' ).fadeOut('fast');
			});
			
			$('.watch-us-video a').mouseenter( function(){
				$(this).find( 'span' ).fadeIn('fast');
				img = $(this).find('img').attr('src');
				$(this).css({background: 'url('+img+') no-repeat center bottom', height: '192px'});
				$(this).find('img').stop().animate({opacity: 0 }, 'fast');
			}).mouseleave( function(){
				$(this).find( 'span' ).fadeOut('fast');
				$(this).find('img').stop().animate({opacity: 1 }, 'fast');
			});
		
	  });
