$(document).ready(
  function()
  {
    siteInitialized = true;
    $('#oliphant_keuze_prive').animate({
      top: '515px',
      left:'0px'
    }, 2000,'easeOutCirc', function() {
      // Animation complete.
      sectionButtonReady('prive');
    }).click(
      function(e)
      {
        openSite('prive');
      }
    );

    
    $('#oliphant_keuze_zakelijk').animate({
      top: '515px',
      left:'500px'
    }, 2000,'easeOutCirc', function() {
      // Animation complete.
      sectionButtonReady('zakelijk');
    }).click(
      function(e)
      {
        openSite('zakelijk');
      }
    );

    $('#oliphant_logo_div').animate({
      top: '20px'
    }, 2000,'easeOutCirc', function() {
      // Animation complete.
    });
  }
)
function sectionButtonReady(section)
{
  var jSectionButton = $('#oliphant_keuze_' + section);
  
  jSectionButton.hover(
    function()
    {
     // alert('hover in');
      showToelichting(section,true);     
    },
    function()
    {
     // alert('hover out');
      showToelichting(section,false);
    }
  )
}
function showToelichting(section,mustShow)
{
  var jSectionToelichting = $('#oliphant_toelichting_' + section + '_div');
  
  if(mustShow)
  {
    jSectionToelichting.animate({
      top: '0px'
    }, {duration:450,queue:true},'easeOutCirc', function() {
      // Animation complete.
      
    });
  }
  else
  {
    jSectionToelichting.animate({
      top: '170px'
    }, {duration:200,queue:true},'easeInCirc', function() {
      // Animation complete.
      
    });  
  }
}

function openSite(section)
{
  
  //first load the first page into the div
  $('div#oliphant_site_div').load('page.php?nested=1&section=' + section,null,
    function(e)
    {
      //alert('first page id: ' + firstPageID);
      initPage(true,firstPageID);
      //moveAwayFrontPageStuff();          
    }
  );
  
  //then move away all the others
  
}
function moveAwayFrontPageStuff()
{
  /*var jBackground = $('#oliphant_frontpage_div');
  var jPrive    = $('#oliphant_keuze_prive, .oliphant_toelichting_div #oliphant_toelichting_prive_div');
  var jZakelijk = $('#oliphant_keuze_zakelijk, .oliphant_toelichting_div #oliphant_toelichting_zakelijk_div');
  
  jPrive.animate({
    left: '-=' + (jPrive.width()+10) 
  }, 2000,'easeOutCirc', function() {
    // Animation complete.
    
  })
  
  jZakelijk.animate({
    left: '+=' + (jZakelijk.width()+10) 
  }, 2000,'easeOutCirc', function() {
    // Animation complete.
    
  })
  
  jBackground.animate({
    top: jBackground.height() 
  }, 2000,'easeOutCirc', function() {
    // Animation complete.
    
  })*/
  
  $('div#oliphant_portal_div').animate({
    top: '+=800' 
  }, 1000,'easeInSine', function() {
    // Animation complete.
    $(this).hide();
    //goPage('4bb3e087711a79_47079598');
  })
  
}