

function buildHomePage(){
		getProjectNode(1);
	   $('body, #footer').css('background-color','#161b1d');
	   $('#background').hide();
       $('.content-holder').attr('id', '');
       $('.content-holder').attr('id', 'home-page');
       $('#nav-dot-1').addClass('on');
  	 	var numPanels = $('.wrapper').find('.panel').length; 
  	 	
  	 	var navDotNum = 0;
		while (navDotNum<=(numPanels)) {
		  $('#nav-dot-'+navDotNum).show();
		  navDotNum++;
		  }
	
  	$('.wrapper').css('width', numPanels*1600);
      $('#prev').hide();
       var clickCt = 1;
       $('#next').click(function () {
			  $('.nav-button').hide();
               $('#expand-title').fadeOut();
               $('.wrapper').delay(50).animate({
                       'left': '-=1500px'
               }, {
                       queue: false,
                       duration: 500,
                       easing: "easeOutQuint",
                       complete: function(){
			               clickCt++;
			               clickCounter(clickCt);
			               getProjectNode(clickCt)
                       }
               });
       });
       $('#prev').click(function () {
       //  consoleLog(clickCt)
               $('.nav-button').hide();
               $('#expand-title').fadeOut();
               $('.wrapper').delay(50).animate({
                       'left': '+=1500px'
               }, {
                       queue: false,
                       duration: 500,
                       easing: "easeOutQuint",
                       complete: function(){
			               clickCt--;
			               clickCounter(clickCt);
			               getProjectNode(clickCt)
                       }
               });
       });
      
      
      function getProjectNode(cc){
      	var thisNodeNum = $('#panel-'+cc).attr('alt');
      	if (thisNodeNum == ''){ thisNodeNum = 1 }
      	$('#go-to-project').click(function(){
      			ProjectLoader(thisNodeNum);
      	});
      
      }
      
      
      
       function clickCounter(cc) {
               var eTitle = titleArray[cc];
               $('#expand-title').html(eTitle);
               $('.nav-dot').each(function(index){
               		$(this).removeClass('on');
               });
               $('#nav-dot-'+cc).addClass('on');
              
               if (cc < 2){
             //  	console.log('cc < 2');
               		$('#next').delay(1000).show();
                    $('#prev').hide();
               } else if (numPanels == cc){
               		$('#next').hide();
                    $('#prev').delay(1000).show();
               //     console.log('numPanels == cc');
               } else {
                     $('#next').delay(1000).show();
                     $('#prev').delay(1000).show();
                //     console.log('else');
               
               
               }
/*	
               if (cc == 1) {
                       $('#next').delay(1000).show();
                       $('#prev').hide();
               }
               if (cc == 2) {

                       $('#next').delay(1000).show();
                       $('#prev').delay(1000).show();

               }
               if (cc == 3) {
                       $('#next').hide();
                       $('#prev').delay(1000).show();
               }
*/
               $('#expand-title').fadeIn('slow');
       }
       $('#expand-top').fadeIn();
/*
       $('.image-player').animate({
               width: '950px'
       }, {
               duration: 1000,
               specialEasing: {
                       width: 'easeOutQuint'
               },
               complete: function () {
                       $('.image-player').animate({
                               height: '490px'
                       }, {
                               duration: 1500,
                               specialEasing: {
                                       height: 'easeOutQuint'
                               },
                               complete: function () {
                                       $('#expand-title').fadeIn();
                                       $('#expand-nav').fadeIn();
                                       $('#insight-title').fadeIn();
                                       $('#insight-block').fadeIn();
                                       $('#services-title').fadeIn();
                                       addServices();
                               }
                       });
               }
       });
*/
                                       $('#expand-title').fadeIn();
                                       $('#expand-nav').fadeIn();
                                       $('#insight-title').fadeIn();
                                       $('#insight-block').fadeIn();
                                       $('#services-title').fadeIn();
                                       addServices();
      
       function addServices() {
               $('#expander-grid .box').each(function (index) {
                       $(this).addClass('boxer' + index);
               });
               var i = 0;
               var tid = setTimeout(showBox, 500);
      
               function showBox() {
                       $('.boxer' + i).delay(50).fadeIn();
                       tid = setTimeout(showBox, 500);
                       if (i == 9) {
                               abortTimer();
                       }
                       i++;
               }
      
               function abortTimer() {
                       clearTimeout(tid);
                       InsightButtonRollover();
               }
       }
  
  
  		function InsightButtonRollover(){
  			$('#insight-click-to-load').fadeIn();
  			$('#insight-text, #insights-read-more, #insight-arrow').fadeIn();
  		/*
	$('#insights-panel, #insight-click-to-load').mouseover( function () {
  				$('#insights-panel').animate({height:'140px'})
  				$('#insight-text, #insights-read-more, #insight-arrow').fadeIn();

			 });
*/
/*
			 
			 $('#insights-panel').click( function () {
			 	$('#insight-text, #insights-read-more, #insight-arrow').fadeOut();
				$('#insights-panel').animate({height:'90px'})	
			 });
*/
  		}
  
  
  
/*
if (isiPad == false){
     $('#play-button').hover( function () {
         hoverOpen();   
     }, function () {
          hoverClose();
     });
} else {
    
     $('#play-button').click(function() {
       var pbHt = $(this).height();
       if (pbHt >= 400){
         hoverClose();
       } else {
         hoverOpen();
       }

     });
  
}
*/
  
  function hoverOpen(){
              $('#expand-top').delay(50).animate({
                       "height": "0px"
               }, {
                       queue: false,
                       duration: 300,
                       easing: "easeInOutQuad"
               });
               $('#expand-bottom').animate({
                       "height": "0px"
               }, {
                       queue: false,
                       duration: 150,
                       easing: "easeInOutQuad"
               });
               $('#play-button').animate({
                       "height": "490px",
                       "top": "0px",
               }, {
                       queue: false,
                       duration: 150,
                       easing: "easeOutQuint"
               });
    
  }
  
   function hoverClose(){
              $('#expand-top').delay(100).animate({
                       "height": "160px"
               }, {
                       queue: false,
                       duration: 300,
                       easing: "easeOutQuint"
               });
               $('#expand-bottom').animate({
                       "height": "140px"
               }, {
                       queue: false,
                       duration: 250,
                       easing: "easeOutQuint"
               });
               $('#play-button').animate({
                       "height": "190px",
                       "top": "160px",
               }, {
                       queue: false,
                       duration: 150,
                       easing: "easeOutQuint"
               });
     
   }
}
