	// Web Design slider functions

(function($){
	webDesign = function() {
		  var currentPosition = 0;
		  var slideWidth = 591;
		  var slides = $('.slide');
		  var numberOfSlides = slides.length;
		
			
		  // Remove scrollbar in JS
		  $('#slidesContainer').css('overflow', 'hidden');
		
		  // Wrap all .slides with #slideInner div
		  slides
			.wrapAll('<div class="slideInner"></div>')
			// Float left to display horizontally, readjust .slides width
			.css({
			  'float' : 'left',
			  'width' : slideWidth
			});
		
		  // Set #slideInner width equal to total width of all slides
		  $('.slideInner').css('width', slideWidth * numberOfSlides);
		
		  // Insert controls in the DOM
		  $('#webContainer')
			.prepend('<a href="javascript:void(0);" class="control" id="leftControl">Clicking moves left</a>')
			.append('<a href="javascript:void(0);" class="control" id="rightControl">Clicking moves right</a>');
		
		  // Hide left arrow control on first load
		  manageControls(currentPosition);
		
		  // Create event listeners for .controls clicks
		  $('.control').bind('click', function(){
			// Determine new position
			currentPosition = ($(this).attr('id')=='rightControl') ? currentPosition+1 : currentPosition-1;
			// Hide / show controls
			manageControls(currentPosition);
			
			// Move slideInner using margin-left
			$('.slideInner').animate({
			  'marginLeft' : slideWidth*(-currentPosition)
			});
			
			// Film and Tv - and Help Tip
			if(currentPosition == 0) {
				$("#nawhCopy").fadeIn("slow");
				 
			} else {
				$("#nawhCopy").fadeOut("fast");
				$(".blink").hide();
			}
			
			// PA Schopen
			if(currentPosition == 1) {
				$("#schopenCopy").fadeIn("slow");
			} else {
				$("#schopenCopy").fadeOut("fast");
			}
			
			// Art Industries
			if(currentPosition == 2) {
				$("#artIndCopy").fadeIn("slow");
			} else {
				$("#artIndCopy").fadeOut("fast");
			}
			
			// Diana Berry
			if(currentPosition == 3) {
				$("#dianaCopy").fadeIn("slow");
			} else {
				$("#dianaCopy").fadeOut("fast");
			}
			
			// PipeFund
			if(currentPosition == 4) {
				$("#pipefundCopy").fadeIn("slow");
			} else {
				$("#pipefundCopy").fadeOut("fast");
			}
			
			// APV
			if(currentPosition == 5) {
				$("#apvCopy").fadeIn("slow");
			} else {
				$("#apvCopy").fadeOut("fast");
			}
			
			// ToneMaker
			if(currentPosition == 6) {
				$("#tonemakerCopy").fadeIn("slow");
			} else {
				$("#tonemakerCopy").fadeOut("fast");
			}
			
			// Maverick Jets
			if(currentPosition == 7) {
				$("#maverickjetsCopy").fadeIn("slow");
			} else {
				$("#maverickjetsCopy").fadeOut("fast");
			}
			
			// Victoria Hanks
			if(currentPosition == 8) {
				$("#victoriaCopy").fadeIn("slow");
			} else {
				$("#victoriaCopy").fadeOut("fast");
			}
		  });
		
		  // manageControls: Hides and Shows controls depending on currentPosition
		  function manageControls(position){
			// Hide left arrow if position is first slide
			if(position==0){ $('#leftControl').hide() } else{ $('#leftControl').show() }
			// Hide right arrow if position is last slide
			if(position==numberOfSlides-1){ $('#rightControl').hide() } else{ $('#rightControl').show() }
		  }	
  		
  	};
  })(jQuery);

