// JavaScript Document

  	$(document).ready(function(){
						  
		/*
		add functionality for sidebar form
			override default submit
			add url to hidden url input
			submit form via ajax 
			submit page uses blank template
			replace form with ajax response	
			
			!!! - integrate with existing onSubmit form validation - !!!
		*/
		
		
		$("#general_inquiry_wrapper #url").val( window.location );
		
		$("#general_inquiry_wrapper form").bind("submit", function(event) {
			event.preventDefault();

			var response = $.ajax({ 
					url: "/general-inquiry", 
					type: "post",
					dataType: "html",
					context: $("#general_inquiry_wrapper"),
					data: $("#general_inquiry_wrapper form").serializeArray(),
					success: function(data, textStatus, XMLHttpRequest){
						
						$("#general_inquiry_wrapper").html( data );
					}
			}).responseText;			
			
			
		});
		
		
		
		/* end right sidebar form */
		
						  
		$('#rotating_images_list').innerfade({
			speed: 'slow',
			timeout: 4800,
			type: 'sequence',
			containerheight: '235px'
		});

		$(function() {
			$('#rotating_images_list li a').lightBox();
		});
		
		$(function() {
			$('.page_thumbnails a').lightBox();
		});

						  
		// change value of search box on focus - return if nothing is entered					  
		 swapValues = [];
		 $(".swap_value").each(function(i){
			  swapValues[i] = $(this).val();
			  $(this).focus(function(){			  
					if ($(this).val() == swapValues[i]) {
						 $(this).val("");
					}
			  }).blur(function(){
					if ($.trim($(this).val()) == "") {
						 $(this).val(swapValues[i]);
					}
			  });
		 });
    });



	// navigation drop down - needed for IE
	$(document).ready(function(){
		$("#nav_menu_one li").hover(
			function(){ $("ul", this).fadeIn("slow"); }, 
			function() { } 
		);
		if (document.all) {
			$("#nav_menu_one li").hoverClass ("sfHover");
		}
	});
  
	$.fn.hoverClass = function(c) {
		return this.each(function(){
			$(this).hover( 
				function() { $(this).addClass(c);  },
				function() { $(this).removeClass(c); }
			);
		});
	};	  
	// end navigation
