$(document).ready(function(){
	
	$('.hide').hide();
	
	//Hover State for Main Nav
	$("#main_nav ul li").not('.active').mouseenter(function() {
		var pos = $(this).position(); 
		var hover_width = $(".hover_state").width();
		var li_width = $(this).width();
		var width = hover_width/2 - li_width/2;
		$(".hover_state").css( { "left": (pos.left + 28 - width) + "px", "top":pos.top + "px" } );
		$(".hover_state").show();
	});
	
	$("#main_nav ul li").mouseleave(function() {
		$(".hover_state").hide();
	});
		
	//Fix black outline on carousel fade in IE
	//$('#carousel').pngFix();
		
	/*
// Carousels
	$('#carousel').cycle({ 
	    fx: 'fade',
	    timeout:  5000,
		prev:    '#prev',
        next:    '#next',
        pager:  '.carousel_nav',
		cleartype:  true,
	    cleartypeNoBg:  true
	});
*/
	
	$('#latest_news, #upcoming_events').jcarousel({
    	'scroll': 3,
    	'vertical': true
    });
	
	// Fancybox
	$("a.enlarge").fancybox();
	
	// Contact Links Hover
	$('a.contact_link').hover(function(){
		$(this).find('div.arrow_btn').toggleClass('arrow_btn_hover');
	});
	
	// Enticers Hover for IE6
	$('div.ent1').hover(function(){
		$(this).toggleClass('ent1_hover');
	});
	
	$('div.ent2').hover(function(){
		$(this).toggleClass('ent2_hover');
	});	
	
	$('div.ent3').hover(function(){
		$(this).toggleClass('ent3_hover');
	});
	
	$('div.ent4').hover(function(){
		$(this).toggleClass('ent4_hover');
	});	
	
	//Second Nav fix for IE6
	$('li.first.last').addClass('first_last');	
	
	$('.row label, .search label').click(function() { 
		$(this).next("input").focus();
		$(this).next("textarea").focus();

	}), (function() {
		$(this).next("input").blur();
		$(this).next("textarea").blur();
	});
	
	// JOBS MODULE STUFF


	 //hide 'x' initially
	$(".search .clear_button").hide();

	//show 'x', hide title when clicking title
   	$('.search .clear_button').click(function(){
    	$('.search label').hide();
    	$('input.search').focus();
    });
    
    //hide/show title/ 'x' when clicking input
    $('.search input').blur(function() { 
	if( $('.search input').val() == '' ) {
    	$('.search label').show();
    	$(".search .clear_button").hide();
	}
	}).focus(function() {
    	$('.search label').hide();
    	$(".search .clear_button").show();
	});
    
    //hide 'x', show title when clicking 'x', reset filter
    $(".search .clear_button").click(function(){
    	$('.search input').val('');
    	$('.search label').fadeIn();
    	$(".search .clear_button").hide();
    
	});
	
});

