$(document).ready(function(){
  
  /***** GALLERY LAUNCH ****/
  $('a.launch-gallery').click(function() {
    var whichGallery = '#gallery-' + $(this).attr('id');
    
    coverThePage('no');
    
    $(whichGallery).show();
    
    return false;
  });
  /***********************/
  
  
  /***** LABEL FORM ****/
  $('form.uselabels input, form.uselabels select').focus(function() {
    $(this).parent('label').children('b').hide();
  });
  
  $('form.uselabels input, form.uselabels select').blur(function() {
    var labelTxt = $(this).parent('label').children('b').html();
    if($(this).val() == "") {
      $(this).parent('label').children('b').show();
    }
  });
  /***********************/
  
  
  /***** COVER PAGE ****/
  function coverThePage(useAJAXLayer) {
  	
  	$('<div id="coverpage"></div>').appendTo('body');
  	
  	if(useAJAXLayer == 'yes') {
  	  $('<div id="layer-over"></div>').appendTo('body');
  	}
  	
  	var cssObj = {
      "z-index": "1000"
    }
  	
  	$("#coverpage").css(cssObj);
  	$("#coverpage").fadeTo("fast", 0.60);
  	
  	var getFooterTop = $("#footer").position();
  	var setCoverHeight = getFooterTop.top + $("#footer").height();
  	
  	if (setCoverHeight < $('body').height()) {
  		setCoverHeight = $('body').height() + 100 + 'px';
  		$("#coverpage").height(setCoverHeight);
  	} else{
  		$("#coverpage").height($('body').height());
  	}
  }
  /***********************/
  
});
