//Portfolio - horizontal scrolling code
$(function(){
  //Get our elements for faster access and set overlay width
  var div = $('div.portfolioDisplay'),
               ul = $('ul.portfolioDisplay'),
               // unordered list's left margin
               ulPadding = 15;

  //Get menu width
  var divWidth = div.width();

  //Remove scrollbars
  div.css({overflow: 'hidden'});

  //Find last image container
  var lastLi = ul.find('li:last-child');

  //When user move mouse over menu
  div.mousemove(function(e){

    //As images are loaded ul width increases,
    //so we recalculate it each time
    var ulWidth = lastLi[0].offsetLeft + lastLi.outerWidth() + ulPadding;

    var left = (e.pageX - div.offset().left) * (ulWidth-divWidth) / divWidth;
    div.scrollLeft(left);
  });
});

//Portfolio Vertical Menu
			$(document).ready(function() {
				$('.navchild').hide();
				//$('.navgrandchild').hide();
				$('#navroot > li > a:link, .navchild > li > a:link, #navroot > li > a:visited, .navchild > li > a:visited').click(function() {
					var visibility = $(this).next('ul').css("display");
					if( visibility == "none" )
					{
						$(this).next('ul').show("normal");
						$(this).parent().siblings().children('ul:visible').hide("normal");
						//$('.navgrandchild').hide();
					}
					else { $(this).next('ul').hide("normal"); 
					}
				});
			});
//Home page slide show function		
$(document).ready(function() {
	$(function(){
		$('#slideshow img:gt(0)').hide();
		setInterval(function(){$('#slideshow :first-child').fadeOut(800).next('img').fadeIn(800).end().appendTo('#slideshow');}, 5000);
	});
});




