$(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;
	  		}
	 	}
	});


	$('textarea').focus(function() {
		if($(this).attr("value") == "Message") { $(this).attr("value",""); }
	});
	$('textarea').blur(function() {
		if($(this).attr("value") == "") { $(this).attr("value","Message"); }
	});
	
	$('input#name').focus(function() {
		if($(this).attr("value") == "Name") { $(this).attr("value",""); }
	});
	$('input#name').blur(function() {
		if($(this).attr("value") == "") { $(this).attr("value","Name"); }
	});
	
	$('input#email').focus(function() {
		if($(this).attr("value") == "Email") { $(this).attr("value",""); }
	});
	$('input#email').blur(function() {
		if($(this).attr("value") == "") { $(this).attr("value","Email"); }
	});



	// These first three lines of code compensate for Javascript being turned on and off. 
	// It simply changes the submit input field from a type of "submit" to a type of "button".
	


});