/*
DOM manipulation stuff for Alexandtheweb.com
Version: 0.1
Author: Alex Goluszko
Author URI:  www.alexandtheweb.com
*/

	$(document).ready(function () {
		// Removes bottom border underline from linked images
		$("a:has(img)").addClass('borderless');  

		// WordPress tidy
		$("p:empty").remove(); 
		$("li:empty").remove(); 

		$(".scrollable a[href^=http://]").attr("target","_blank");

		if ($("nav li:not(.active)")) {
				$("#nav a").hover(
					function () { $(this).parent().addClass("hovered");},
					function () { $(this).parent().removeClass("hovered");}
				);
			} 

		$(".items .widerCol").append("<div class='layered'>&nbsp;</div>");

		// Portfolio floats
			
		$("ul.portfolioList li:first-child, ul.portfolioList li:nth-child(4n)").addClass("floatLeft");
		
		// Animated portfolio scrolling
		
		$('.portfolioList a, a.top').click(function() {
			   var elementClicked = $(this).attr("href");
			   var destination = $(elementClicked).offset().top;
			   $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination-20}, 1000 );
			   return false;
		});

		$('.portfolioList a').hover(
			  function() {$('span',this).animate({opacity: 0.9}, 500);
						 },
			  function() {$('span',this).animate({opacity: 0}, 500);}
		);												
		
		//var porthash = window.location.hash;
		//var arr = porthash.split('port');  // converts your string to an array, delimited by the '/' character
		//var myNumber = arr[arr.length-1];
		//$('.items').css('top',(myNumber - 1)*-680.75);

	});	

		

