// JavaScript Document - Home page
$(document).ready(function(){
		
		//Portfolio Section
		if ($('dl.portfolio dd.title').length){
		$('dd.title:first').removeClass('title').addClass('noBorder'); 
		}
		
		//Ramble Articles
		if($('#rambles article').length){
			$('#rambles article').each(function(index) {
				var addLast = index % 3;

 				if( addLast == 2 ) {
 					$(this).addClass('last');
 				}
 			}); //end of function
		}
		
		
		//Creat Mask Layer for Contact Module
  		$('body').append('<div id="mask"></div>');
  		$('a[id=contact]').click(function(e) {
  			
  			//Stop Default link action
  			e.preventDefault();
  			var id = $(this).attr('href');
  			
  			//Get screen height and width
  			var maskHeight = $(document).height();
  			var maskWidth = $(document).width();
  			
  			$('#mask').css({'width':maskWidth , 'height':maskHeight , 'opacity':0.3 });
  			$('#mask').fadeIn('slow');
  			$(id).fadeIn(200)
  		}); //End of Contact Module fuction
  		
  		//If click close button or mask Close contact Module
  		$('.close , #mask').click(function(e) {
  			e.preventDefault();
  			$('#mask, #contactBody').hide();
  		});
  		
  		//Scroll Script
  		$('.scroll').click(function(e){
  			e.preventDefault();
			$('html,body').mousewheel(function(){ return false;});
			$('html,body').stop().animate({
				scrollTop: "0"
			}, 2000, "easeInOutExpo", function(){ $(this).unbind("mousewheel");});
		}); // Scroll click
	
		//Hide Scroll bar
		$(window).scroll(function(){
			if ( $(window).scrollTop() < "100" ) {
			$('.scroll').fadeOut('fast');
			} else {
				$('.scroll').fadeIn('slow');
			}
		}); //end scroll bar hide 
  		
  		
		
}); //End document Ready 
