//##############################################################################
//##  DOM																	  ##
//##############################################################################
$(document).ready( externalLinks );
/*###########################################
##  Dropdown Menus						   ##
###########################################*/
/* Options */
var __global_menuObject = '.mainnav';
/* Controls */
$(document).ready(function() {
	var lis = $(__global_menuObject).children('li').get();
    $.each(lis, function(){
      $(this).hover(
	    function () { //on
	      $(this).addClass("sfhover")
	    }, 
	    function () { //off
	      $(this).removeClass("sfhover")
	    }
	  );
    });
});
/*###########################################
##  Rollover Image Preloader			   ##
###########################################*/
/* Options */
var _images = ['../public/images/nav1_on.jpg',
			   '../public/images/nav2_on.jpg',
			   '../public/images/nav3_on.jpg',
			   '../public/images/nav4_on.jpg',
			   '../public/images/nav5_on.jpg'
			  ];
/* Controls */
$(document).ready(function() {
  	$.each(_images,function(e) {
      $(new Image()).load().attr('src',this);
  	});
});
/*###########################################
##  Flash Version Detect				   ##
###########################################*/
$(document).ready(function() {
	var playerVersion = swfobject.getFlashPlayerVersion();
	if (playerVersion.major < 8) { if (confirm('Your version of Adobe Flash Player, which is required to render this website correctly, is very out of date.\n\nIt only takes a couple minutes to update, and we strongly reccomend that you do.\n\nWould you like to update now?')) { window.location="http://get.adobe.com/flashplayer"; } }
});
//##############################################################################
//##############################################################################
//##  User Handler Functions												  ##
//##############################################################################
function externalLinks() {
  var exs = $('a[rel=external]');
  $.each(exs, function() {
    if ($(this).attr('href')) { $(this).attr('target','_blank'); }
  });
}
//##############################################################################
//##############################################################################
//## Contact Form Functions													  ##
//##############################################################################
$(function() {
  $("#contact_submit").click(function() { // validate and process form
	  //get parent div & form info
	  parentInfo = $(this).findParents();
	  
	  //check required fields
	  if ($(this).checkRequired(parentInfo)) { return true; }
      return false;
	});
});
//##############################################################################
//##############################################################################
