// JavaScript Document
$(document).ready(function() {
  var cache = [];

  function preLoadImages() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  }
  $('.btnFront').each(function() {
	preLoadImages('/cms/wp-content/themes/thereef/images/' + $(this).attr('ref') + '_on.png', '/cms/wp-content/themes/thereef/images/' + $(this).attr('ref') + '_off.png');
  });


	$('.navButton').mouseover(function() {
		if ($(this).attr('class') != 'navActive') {
			$(this).attr('class','navOver');
		}		
	});
	$('.navButton').mouseout(function() {
		if ($(this).attr('class') != 'navActive') {
			$(this).attr('class','navButton');
		}
	});
	$('.navButton').click(function() {
		window.location.href = $(this).children('a').attr('href');
	});
	$('.btnFront').mouseover(function() {
		$(this).attr('src','/cms/wp-content/themes/thereef/images/' + $(this).attr('ref') + '_on.png');		
	});
	$('.btnFront').mouseout(function() {
		$(this).attr('src','/cms/wp-content/themes/thereef/images/' + $(this).attr('ref') + '_off.png');
	});
	$('#navDesignGuidelines').mouseover(function() {
		$('#subDesign').show();
	});
	$('#navDesignGuidelines').mouseout(function() {
		$('#subDesign').hide();
	});
	$('#subDesign').mouseover(function() {
		$('#navDesignGuidelines').css('background-color','#025975');
		$('#navDesignGuidelines').css('cursor','pointer');
		$('#subDesign').show();
	});
	$('#subDesign').mouseout(function() {
		$('#subDesign').hide();
		$('#navDesignGuidelines').css('background-color','transparent');	
		$('#navDesignGuidelines').css('cursor','');
	});
	$('.wpcf7-submit').mouseover(function() {
		$(this).css('background-image','url(/cms/wp-content/themes/thereef/images/submit_on.png)');
	});
	$('.wpcf7-submit').mouseout(function() {
		$(this).css('background-image','url(/cms/wp-content/themes/thereef/images/submit_off.png)');
	});
});
