$(function() {

	pic1= new Image(16, 16); 
	pic1.src="/images/ajax-loader.gif";
	pic2= new Image(71,39); 
	pic2.src="/images/portfolioButtonHover.jpg";

	$('a.lightbox').lightBox();

	var numberOfPortfolioItems = $('ul.portfolioSlider li').size();
	var currentItem = 1;
	var newLocationTemp;
	var newLocation;
	
	$('.portfolioButtons a.right').click(function() {
		if(currentItem == numberOfPortfolioItems - 2) {
			currentItem = 1;
			$('.portfolioSlider').animate({"left":"0px"});
		} else {
			newLocationTemp = currentItem * 330;
			newLocation = newLocationTemp - newLocationTemp - newLocationTemp;
			$('.portfolioSlider').animate({"left":newLocation});
			currentItem++;
		}
			return false;
	});
	
	$('.portfolioButtons a.left').click(function() {
		if(currentItem == 1) {
			currentItem = 1;
			$('.portfolioSlider').animate({"left":"0px"});
		} else {
			newLocationTemp = currentItem * 330 - 660;
			newLocation = newLocationTemp - newLocationTemp - newLocationTemp;
			$('.portfolioSlider').animate({"left":newLocation});
			currentItem--;
		}
			return false;
	});
		
	
  	$('ul.nav a[href*=#]').click(function() {
	  $('ul.nav li').removeClass('active');
	  $(this).parent('li').addClass('active');
	 	if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
	  		var $target = $(this.hash);
	   		$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
	   		if ($target.length) {
	  			var targetOffset = $target.offset().top - 50;
	  			$('html,body').animate({scrollTop: targetOffset}, 1000);
	    		return false;
	  		}
	 	}
	});
	
	$('#banner a.bannerPortfolioLink').click(function() {
	  $('ul.nav li').removeClass('active');
	  $('ul.nav li a.myPortfolio').parent('li').addClass('active');
	 	if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
	  		var $target = $(this.hash);
	   		$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
	   		if ($target.length) {
	  			var targetOffset = $target.offset().top - 50;
	  			$('html,body').animate({scrollTop: targetOffset}, 1000);
	    		return false;
	  		}
	 	}
	});
		});