$(document).ready(function(){
  //preload images
  //$(['../images/bg-home.jpg','../images/bg-wedding.jpg','../images/bg-people.jpg','../images/bg-nav.jpg']).preload();

  //fix png images
  $(document).pngFix();
  
  // nav animations
  $('.container .nav ul li a').hover($(this).nav_hover_on, $(this).nav_hover_off);//nav hover functions
  
  //nav click functions (opens galleries view)
  //$('.container .nav ul li a').click($(this).nav_click);
  
  //galleries close button
  $('.container .galleries .x_button').click(function(){
    $('.galleries').animate({ height: '0px'}, 500, function(){$('.galleries').css('display', 'none');});
  });

});//ready function


//*********************************************************
//***************************** FUNCTIONS *****************
//*********************************************************
//preload images
$.fn.preload = function(){
  this.each(function(){
    $('<img/>')[0].src = this;
  });
}//preload

//hover functions
$.fn.nav_hover_on = function(){
  $(this).animate({ paddingLeft: '15px' }, 200);
  $(this).animate({ paddingLeft: '8px' }, 100);
  $(this).css('color', '#DAC012');
}//hover_on   
  
$.fn.nav_hover_off = function(){
    $(this).animate({ paddingLeft: '0px'}, 200);
	$(this).css('color', '#FFFFFF');
}//hover_off


//nav click function
$.fn.nav_click = function(){
  var src;
  $('.container .galleries').css('display', 'block');
  $('.container .galleries').animate({ height: '459px'}, 1000);
  //choose source and attributes of iframe
  switch($(this).attr('id')){
    case 'weddings':
    case 'people':
	  src = 'http://www.justinevansphotography.com';
      break;
  }//switch
  return false;
}//nav click
