                                                                                                                                                                                                                                                                                                /**
 * @author Anthony
 */

$(window).load(function(){
	showSplash();

	function showSplash(){
		$("#splashBottom").css("opacity", "0");
		$("#splashBottom").css("top", "400px");
		$("#splashBottom").animate({ opacity: 1.0, top: "150px"}, animIn);
		
		$("#splashTop").css("opacity", "0");
		$("#splashTop").css("top", "10px");
		$("#splashTop").animate({ opacity: 1.0, top: "144px"}, animIn);
	}

	var myFile = document.location.toString();
	var duration = 250;
	var animIn = 750;
	var count = 0;
	$(document).pngFix(); 
});



$(document).ready(function(){
//$(window).load(function(){

		$("#splashBottom").css("opacity", "0");
		$("#splashTop").css("opacity", "0");

	
	/*$(".roots").click(
		function () {
			$(".text .strength").hide();
			$(".text .vista").hide();
			$(".text .vistaNational").hide();
		 	$("#splashTop").attr("src",  "/assets/root/images/splash_roots_header_over.png");
			$("#splashBottom").attr("src",  "/assets/root/images/splash_headers_base_bottom.png");
			if (count < 1) {
				$("#splashBottom").css("top", "150px");
				count++;
			}
			$("#splashBottom").animate({ 
		        top: (200 + $(".text .roots").height()).toString()  + "px"
		      }, duration, function(){
			  	$(".text .roots").fadeIn( duration);
			  });
		});
	
	$(".strength").click(
		function () {
			$(".text .roots").hide();
			$(".text .vista").hide();
			$(".text .vistaNational").hide();
		 	$("#splashTop").attr("src",  "/assets/root/images/splash_strength_header_over.png");
			$("#splashBottom").attr("src",  "/assets/root/images/splash_headers_base_bottom.png");
			if (count < 1) {
				$("#splashBottom").css("top", "150px");
				count++;
			}
			$("#splashBottom").animate({ 
		        top: (200 + $(".text .strength").height()).toString()  + "px"
		      }, duration, function(){
			  	$(".text .strength").fadeIn( duration);
			  });
		});
	
	$(".vista").click(
		function () {
			$(".text .roots").hide();
			$(".text .strength").hide();
			$(".text .vistaNational").hide();	
		 	$("#splashTop").attr("src",  "/assets/root/images/splash_vista_header_over.png");
			$("#splashBottom").attr("src",  "/assets/root/images/splash_headers_base_bottom.png");
			if (count < 1) {
				$("#splashBottom").css("top", "150px");
				count++;
			}
			$("#splashBottom").animate({ 
		        top: (200 + $(".text .vista").height()).toString()  + "px"
		      }, duration, function(){
			  	$(".text .vista").fadeIn( duration);
			});
	});
	
	$(".vistaNational").click(
		function () {
			$(".text .roots").hide();
			$(".text .strength").hide();
			$(".text .vista").hide();
			$("#splashTop").attr("src",  "/assets/root/images/splash_headers_base_top_off.png");
		 	$("#splashBottom").attr("src",  "/assets/root/images/splash_headers_base_bottom_over.png");
			$("#splashBottom").animate({ 
				top: "150px"
		      }, duration, function(){
			  	$(".text .vistaNational").fadeIn(duration);
			});
	});*/
	
	function resetImages(){
		$("#financial img").attr("src", "/assets/root/images/you_financial.gif");
		$("#humanResources img").attr("src", "/assets/root/images/you_human.gif");
		$("#employees img").attr("src", "/assets/root/images/you_employees.gif");
		$("#testimonials img").attr("src", "/assets/root/images/you_testimonials.gif");
                $("#services img").attr("src", "/assets/root/images/us_services.gif");
		$("#eventsEducation img").attr("src", "/assets/root/images/us_events_education.gif");
		$("#staff img").attr("src", "/assets/root/images/us_staff.gif");
	}
	
	$("#financial").click(
		function () {
			resetImages();
			$(".accordian .humanResources").hide();
			$(".accordian .employees").hide();
			$(".accordian .testimonials").hide();
			$(".accordian .financial").show();
                        $("#financial img").attr("src", "/assets/root/images/you_financial_over.gif");
                 });
	
	$("#humanResources").click(
		function () {
			resetImages();
			$(".accordian .employees").hide();
			$(".accordian .testimonials").hide();
			$(".accordian .financial").hide();
			$(".accordian .humanResources").show();
			$("#humanResources img").attr("src", "/assets/root/images/you_human_over.gif");
	});
	
	$("#employees").click(
		function () {
			resetImages();
			$(".accordian .humanResources").hide();
			$(".accordian .testimonials").hide();
			$(".accordian .financial").hide();
			$(".accordian .employees").show();
			$("#employees img").attr("src", "/assets/root/images/you_employees_over.gif");
	});
	
	$("#testimonials").click(
		function () {
			resetImages();
			$(".accordian .humanResources").hide();
			$(".accordian .employees").hide();
			$(".accordian .financial").hide();
			$(".accordian .testimonials").show();
			$("#testimonials img").attr("src", "/assets/root/images/you_testimonials_over.gif");
	});
	
	$("#services").click(
		function(){
			resetImages();
			$(".services div").hide();
			$(".accordian .staff").hide();
			$(".accordian .eventsEducation").hide();
			$(".accordian .services").show();
			$("#serviceLinks a").css("color", "#A9C12E");
			$("#services img").attr("src", "/assets/root/images/us_services_over.gif");
		
	});
	
	$("#eventsEducation").click(
		function(){
			resetImages();
			$(".accordian .staff").hide();
			$(".accordian .eventsEducation").show();
			$(".accordian .services").hide();
			$("#eventsEducation img").attr("src", "/assets/root/images/us_events_education_over.gif");
	});

	$("#staff").click(
		function(){
			resetImages();
			$(".accordian .staff").show();
			$(".accordian .eventsEducation").hide();
			$(".accordian .services").hide();
			$("#staff img").attr("src", "/assets/root/images/us_staff_over.gif");
	});
	
        $("a.right").toggle(
		function() {
			for(var i=0; i < $("a.right").length; i++){
				$(this).parent().parent().children(".fullImage").hide();
				$(this).parent().parent().children(".detail").hide();
			}
			$(this).css("background-image", "url(/assets/root/images/icon_open_bg.gif)");
			$(this).parent().css("background","#96ae71 url('/assets/root/images/bg_staff_header_tile_open.gif') repeat-x");
			$(this).parent().children().css("color","#ffffff");
			$(this).parent().children().children().css("color","#ffffff");
			$(this).parent().parent().children(".fullImage").show();
			$(this).parent().parent().children(".detail").show();
		},function() {
			for(var i=0; i < $("a.right").length; i++){
				$(this).parent().parent().children(".fullImage").hide();
				$(this).parent().parent().children(".detail").hide();
			}
			$(this).css("background-image", "url(/assets/root/images/icon_close_bg.gif)");
			$(this).parent().css("background","#edf2d4 url('/assets/root/images/bg_staff_header_tile.gif') repeat-x");
			$(this).parent().children().css("color","#416b11");
			$(this).parent().children().children().css("color","#416b11");
			$(this).parent().parent().children(".fullImage").hide();
			$(this).parent().parent().children(".detail").hide();
	});

	$("#serviceLinks a").click(function(){
		var link = ".services ." + $(this).attr("id");
		$(".services div").hide();
                $("#serviceLinks a").css("color", "#A9C12E");         
                $(this).css("color", "#416b11");
		$(link).show();
	});
	
	function checkURL(){ 
	        hideStaff();
 		myFile = document.location.toString();
 		myFile = document.location.toString();
		if (myFile.match('#')) { // the URL contains an anchor
			// click the navigation item corresponding to the anchor
			var myAnchor = myFile.split('#')[1];
			switch (myAnchor) {
                                case "Roots":
				$(".roots").click();
				break;
				case "Strength":
				$(".strength").click();
				break;
				case "Vista":
				$(".vista").click();
				break;
				case "VistaNational":
				$(".vistaNational").click();
				break;
				case "Financial":
				$("#financial").click();
				break;
				case "Human%20Resources":
				$("#humanResources").click();
				break;
                                case "Human Resources":
				$("#humanResources").click();
				break;
				case "Employees":
				$("#employees").click();
				break;
				case "Testimonials":
				$("#testimonials").click();
				break;

				case "ClientRecognition":
				$("#clientRecognition").click();
				break;
				case "Our%20Team":
				$("#staff").click();
				break;
                                case "Our Team":
				$("#staff").click();
				break;
				case "Events%20&%20Education":
				$("#eventsEducation").click();
				break;
                                case "Events & Education":
				$("#eventsEducation").click();
				break;
				case "Services":
				$("#services").click();
				break;
				case "Benefits%20Strategy":
				break;
				case "Benchmarking":
				break;
				case "Plan Renewal%20&%20Marketing":
				break;
				case "Financial Analysis%20&%20Modeling":
				break;
				case "Benefits%20Administration%20Support":
				$("#services").click();
                                $("#serviceLinks a#benefitsAdministration").click();				
				break;
                                case "Benefits Administration Support":
				$("#services").click();
                                $("#serviceLinks a#benefitsAdministration").click();				
				break;
				case "Benefits%20Education%20&%20Enrollment":
                                $("#services").click();
                                $("#serviceLinks a#benefitsEducation").click();
				break;
                                case "Benefits Education & Enrollment":
                                $("#services").click();
                                $("#serviceLinks a#benefitsEducation").click();
				break;
				case "Compliance%20Support":
				break;
				case "Wellness":
                                $("#services").click();
                                $("#serviceLinks a#wellness").click();
				break;
				case "Voluntary%20Benefits":
				break;
				case "Retirement":
				break;
			}
		}
		
		if(myFile.match('page=')){
			$("#staff").click();
		}
	}
	
        function hideStaff(){
                $("a.right").parent().parent().children(".fullImage").hide();
			 $("a.right").parent().parent().children(".detail").hide();
			 $("a.right").css("background-image", "url(/assets/root/images/icon_close_bg.gif)");
			 $("a.right").parent().css("background","#edf2d4 url('/assets/root/images/bg_staff_header_tile.gif') repeat-x");
			 $("a.right").parent().children().css("color","#416b11");
                         $("a.right").parent().children().children().css("color","#416b11");
			 $("a.right").parent().parent().children(".fullImage").hide();
			 $("a.right").parent().parent().children(".detail").hide();
	}
      
	checkURL();
	
	$('#footer .row a').click(function(){
                checkURL();
                $(".accordian .item").hide();
                try{ 
	                $(".accordian ." + $(this).attr("rel")).show();
                }catch(err){}
	});
	
	try{
		var hiddenNav = $(".hiddenNav").attr("id");
		$("#sub-nav li a[rel="+hiddenNav+"]").addClass("selected");
	}
	catch(err){}

});

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    