/*=================================================================================================================================
Title:				Javascript - lewro.com
Type:					Global
File:					global.js
JS version:		1.0
Author:				Roman Leinwather
E-mail:				roman.leinwather@gmail.com
Website:			http://www.lewro.com
Copyright:		Copyright (c) 2006 - 2011 Roman Leinwather
Updated:			10th Jan 2010
==================================================================================================================================

TABLE OF CONTENT


I.		PORTFOLIO	


==================================================================================================================================
*/

/*		I. PORTFOLIO
=================================================================================================================================*/

$('.portfolio_item_primary img').hover(
  function() {
    $(this).stop().animate({
      'marginTop' : '-185'
    },500)
  }, 
  function (){
    $(this).animate({
      'marginTop' : '0'
    },300)
  } 
);


// Build the portfolio nav on the fly
$(function(){
  
  var portfolio_count =  $('.screenshot').length;
  $('<ul id="portfolio_nav"></ul><div class="clear"></div>').insertBefore('#portfolio_single');

  $('.screenshot').each(function () {
    var current_id = $(this).attr("id");
    var list = '<li>' + current_id + '</li>';
    $(list).appendTo('#portfolio_nav');
  }); 
  nav_highlight();
});

// Function handles hightlighting of the nav elements
function nav_highlight(){
  var first_element = $('#portfolio_nav li:first');
   first_element.addClass('active');

  $('#portfolio_nav li').click(function (){
    // highlight the nav
    $('#portfolio_nav li').removeClass('active');
    $(this).addClass('active');

    //display the image
    $('.screenshot').addClass('hide');
    var pic_id = '#' + $(this).html();
    $(pic_id).removeClass('hide');
  });
}




