var name = "#workNav";
var menuYloc = null;

$(document).ready(function(){
  
  /**** Return to top of page *****/
  $('.toTop').click(function(){
  
  	//scrolling('#work')
  })
  
   $('.smooth_scroll').click(function() {
  	
  	
  	//if($(this).attr('class') !== 'web_sort' && $(this).attr('class') !== 'graphic_sort' && $(this).attr('class') !== 'etc_sort' ){
	  	$('#workSort ul li').removeClass('active')
		$(this).parent().addClass('active')
	   // duration in ms
	   var duration=1000;
	
	   // easing values: swing | linear
	   var easing='swing';
	
	   // get / set parameters
	   var newHash=this.hash;
	   var target=$(this.hash).offset().top;
	   var oldLocation=window.location.href.replace(window.location.hash, '');
	   var newLocation=this;
	
	
		
	   // make sure it's the same location      
	   if(oldLocation+newHash==newLocation)
	   {
	      // animate to target and set the hash to the window.location after the animation
	      $('html:not(:animated),body:not(:animated)').animate({ scrollTop: target }, duration, easing, function() {
	
	         // add new hash to the browser location
	         window.location.href=newLocation;
	      });
	
	      // cancel default click action
	      return false;
	   }
	  

	//}
});


  
/**********************
-------Slideshow-------
**********************/

var counter = 1;
  $('#showcaseImages ul').cycle({
  	fx: 'fade',
  	pager: '#showcaseNav ul',
  	timeout: 4000,
  	speed: 700,
  	delay: 4000,
  	before: function(){
	    	 		$('#showcaseNav .active').removeClass('active')
					$('a#box-'+counter).addClass('active');

					
					
					if(counter == 4){
						counter = 1;
					}else{ counter++;}
					$('#slideshow').css('visibility', 'visible');
	    	 	} 
  
  });
  var easing='easeIn';
  var slide_count = 1;
  $('#showcaseNav ul a').each(function(){
  	$(this).attr('id', 'box-'+slide_count).addClass('control_box')
  	slide_count++;
  
  })

  $('a#box-1').addClass('active');
	var current_num = '';
	$('.control_box').click(function(){
		$('.active_slide').removeClass('active')
		$('#showcaseNav .active').removeClass('active')
		$(this).addClass('active')
		current_num = $(this).attr('id')
		current_num = current_num.split('-');
		counter = current_num[1];
		if(counter == 4){counter = 1;}else{ counter++;}
		//$('#slideshow_inner').cycle('stop')
	})	

  
  
});

