$(document).ready(function() {
	
	$("#hdr-img").cycle({
		fx:     'fade', 
		speed:  1000, 
		timeout: 10000, 
		pause:   1  
	});
	
	// Blue glassy hover animation, and dropdown fadeIn and Out
	$('#nav-container nav > ul > li > ul').css("display","none");
	$('#nav-container nav > ul > li').hoverIntent({
		interval:100,
		over:(function(){		
		var position = $(this).position();
		$('div#bluebox').stop().animate({
			"left": ""+position.left+""
			}, 1000, function() {});
			$(this).children("ul").fadeIn("fast");
			$(this).children("ul").addClass("over");
			}),timeout:1000,
		out:(function(){
			$(this).children("ul").fadeOut(500);
			})		
		});

		// Search box hover animation for the top nav
		$('ul#top-nav > li:nth-child(4)').hoverIntent({
			interval:100,
			over:(function(){
			$(this).children("ul").fadeIn("fast");
			$(this).children("ul").addClass("search");
			}),
			timeout:1000,
			out:(function(){				
				if($("input[type='text']").is(":focus")){
					$(this).children("ul").addClass("search");		
				}else{
				$('input[type=text]').closest("ul.search").fadeOut(500, function(){
						$("ul.search").removeClass("search");
					});	
				}
			})
			});		
			
			// When a tab link is clicked
		$("a.tab").click(function(e){	
			e.preventDefault();		
			// switch all tabs off
			$(".activetab").removeClass("activetab");
			// switch this tab on
			$(this).addClass("activetab");			
			// slide all content up
			//$(".tab-content").slideUp();	
			$(".activecontent").hide("slide", { direction: "left" }, 400).removeClass("activecontent");
			// slide this content down
			var content_show = $(this).attr("title");
			$("#"+content_show).show("slide", { direction: "right" }, 400).addClass("activecontent");
		});
		
	//Form Other Selection
	/*$('select[name="formBuilderForm[How_did_you_hear_about_us]"]').change(function() {
  		var test = $(this).val();

		if(test == 3){
			$("#formBuilderFieldOther").css("display","block");
			$("#fieldformBuilderFieldOther").focus();
			}else{$("#formBuilderFieldOther").css("display","none");}
	});*/
		
		
});
