// NORMAL RULES

$(document).ready(function() {
							 
	// RESUME SUBMITAL FORM RULES							 
	if(typeof document.body.style.maxHeight === "undefined") {
		var is_ie6 = true;
	//	$.getScript('/scripts/validate_rules_ie6.js');
	}
	else {
		var is_ie6 = false;
	//	$.getScript('/scripts/validate_rules.js');
	}

	if($.browser.msie){
        $('#container').addClass('browser_IE');
        
        // Add the version number
        $('#container').addClass('browser_IE_' + $.browser.version.substring(0,1));
    }
	
	// GENERAL FORM RULES							 	
	if ($("#request_info_form").hasClass("body_form") || $("#resume_submittal_form").hasClass("body_form")){
		var count = 10;
		countdown = setInterval(function(){
		$("#timer").html("Please wait " + count + " seconds before you submit!");
		if (count == 0) {
			$('#timer').remove();
			$("#submit_container").html('<a href="#" class="submit_button "><span>Submit</span></a>');
			$(".submit_button").fadeIn('slow');
		}
		count--;
		}, 1000);
		$("a.submit_button").live('click', function() {
			$(this).parents("form").submit();
			return false;
		});
	}

	// DROPDOWN NAVIGATION RULES
	
	$("#navigation li a").hover(
		function () {
			$("#navigation li a").css("background-position","0px 0px");
			//$(this).css("background-position","0px -90px");
			$('.drop_down').hide();
			dd_name = $(this).attr("id");
			dd_name = dd_name.replace("_link","_dd");
			dd_selector = "#"+dd_name;
			$(dd_selector).show();
		}, 
		function () {}
	);

	$("#navigation_container").hover(
		function (){
		}, function (){
			//$("#navigation li a").css("background-position","0px 0px");
			$('.drop_down').hide();
		}
	);


	// HOME PAGE BODY TEXT FUNCTIONALITY

	if ($("#container_4").hasClass("home")){
		$("#body_text_container").css('height','0px');
		$("#header h1").hover( 
			function(){
				if (!$(this).hasClass("body_text_shown")) {
					$(this).addClass("body_text_shown");
					$("#body_text_container").animate({'height':'374'}, 600);
				}
			}
		);
	
		function close_body_text (){
			if ($("#header h1").hasClass("body_text_shown")) {
				$("#body_text_container").animate({'height':'0'}, 600);
				$("#header h1").removeClass("body_text_shown");
			}
		}
			
		$("#body_text_close_btn").click(function (){
			close_body_text();
			return false;
		});
		
	}

	// CYCLING TESTIMONIALS
	
	$('#testimonial_showcase').cycle({ 
		fx:    'fade', 
		speed:  800,
		timeout: 8000
	});
	
	// FADING NAV FUNCTION 
	if (!is_ie6 == true) {

	$("#navigation, #social_links").addClass("fading_nav");
	
	$(".fading_nav li a").hover(function (e) {	
		$(this).stop().animate({opacity: 1}, "slow");
		$(this).parents("ul").addClass("current_fading_list");
		$(".current_fading_list li a").not(this).stop().animate({opacity: .3}, "slow");
	});
	
	$(".fading_nav").mouseleave(function () {
		$(".fading_nav li a").stop().animate({opacity: 1}, "slow");
		$(this).removeClass("current_fading_list");
	});

	}


	// CONTENT ACCORDIAN

	$("#accordion div").hide()
	$("#accordion h3").live("click",function() {
		$(this).toggleClass("on");
			if($(this).hasClass("on")) {
				$(this).next().slideDown();
			} 
			else {
				$(this).next().slideUp();
			}
	});

});
