

$(document).ready(function(){
	
$("#hide").hide();
$("#headerbox").hide();
$("#logo").hide();

$(".splash").hide();
	$(".fade").hide(function(){
$("#homeimage").fadeIn("slow",function(){
		$("#headerbox").slideDown("slow",function(){
			$("#logo").fadeIn("slow", function(){
						$(".fade").fadeIn("normal");
		});
		});
		});
		});
		
		
	$(".navone").addClass("selected");
	
	
		  $('a#slick-slidetoggle').click(function() {
   
	$('a#slick-slidetoggle').fadeOut("slow",function() {
     $('#toggle-search').show();
 });
	  return false;
  });
	
		$(".navone a").click(function(){
			window.location.hash = "home";
			$("#map").hide();
			$(".flicker").fadeOut("fast");
			$(".navone").addClass("selected");
			$(".splash").fadeOut("slow")
			$("#homeimage").fadeIn("slow");
			
			$("#navtwo").removeClass("selected");
			$("#navthree").removeClass("selected");
			$("#navfour").removeClass("selected");

						$("#contentwrapper").slideUp("normal", function(){				
				$("#contentwrapper").load("index.php #contenth", function(){		
				$("#contentwrapper").slideDown("normal", function(){
						  $('a#slick-slidetoggle').click(function() {
   
	$('a#slick-slidetoggle').fadeOut("slow",function() {
     $('#toggle-search').show();
 });
	  return false;
  });
});
				});			
				});	
	return false;
		});	
		
		
		$("#navtwo a").click(function(){
			window.location.hash = "experiences";
			
			$("#map").hide();
			
			$(".flicker").fadeOut("fast");
			$("#right").fadeOut("fast");
			$("#navtwo").addClass("selected");
			$(".splash").fadeOut("slow");
			$("#experiencesimage").fadeIn("slow");
			
			$(".navone").removeClass("selected");
			$("#navthree").removeClass("selected");
			$("#navfour").removeClass("selected");
			
			$("#contentwrapper").slideUp("normal", function(){				
				$("#contentwrapper").load("experiences.php #contente", function(){	
					$(".cat").hide();
					$(".imgdiv").hide();
					$(".preload").hide();
				$("#contentwrapper").slideDown("normal", function() {
					
					//Initialize the Lighboxes on Experiences Page
					$(function() { 	$('a.onebox').lightBox(); });
					$(function() { 	$('a.twobox').lightBox(); });
					$(function() { 	$('a.threebox').lightBox(); });
					$(function() { 	$('a.fourbox').lightBox(); });
					$(function() { 	$('a.fivebox').lightBox(); });
					$(function() { 	$('a.sixbox').lightBox(); });
					
					//Load the Experiences Boxes gracefully	
					$("#one").fadeIn("normal", function(){
					$("#two").fadeIn("normal", function(){
					$("#three").fadeIn("normal", function(){
					$("#four").fadeIn("normal", function(){
					$("#five").fadeIn("normal", function(){
					$("#six").fadeIn("normal", function(){						
						});
						});
						});
						});
						});
						});

						
						$(function(){
						$("#one").hover(function(){
						$("#onefade").fadeIn('fast'); 
						},function(){
						$("#onefade").fadeOut('fast'); 
						});
 						});
 
  						$("#two").hover(function(){
						$("#twofade").fadeIn('fast'); 
						},function(){
						$("#twofade").fadeOut('fast'); 
						});

						$("#three").hover(function(){
						$("#threefade").fadeIn('fast'); 
						},function(){
						$("#threefade").fadeOut('fast'); 
						});

 
						$("#four").hover(function(){
						$("#fourfade").fadeIn('fast'); 
						},function(){
						$("#fourfade").fadeOut('fast'); 
						});

 
						$("#five").hover(function(){
						$("#fivefade").fadeIn('fast'); 
						},function(){
						$("#fivefade").fadeOut('fast'); 
						});
 
 
						$("#six").hover(function(){
						$("#sixfade").fadeIn('fast'); 
						},function(){
						$("#sixfade").fadeOut('fast'); 
						});

 
 
					
					});
				});
				});
				return false;
					
		
		});	
		
		
		
		$("#navthree a").click(function(){
		window.location.hash = "clients";
		$("#map").hide();
		$(".flicker").fadeOut("fast");
		$("#navthree").addClass("selected");
		$(".splash").fadeOut("slow");
		$("#clientsimage").fadeIn("slow");
		
		$("#navtwo").removeClass("selected");
		$(".navone").removeClass("selected");
		$("#navfour").removeClass("selected");
		
			$("#contentwrapper").slideUp("normal", function(){				
				$("#contentwrapper").load("clients.php #contentc", function(){	
				$("#contentwrapper").slideDown("normal");
				});
				});
			return false;
		});
	
		
		
		
		
		$("#navfour a").click(function(){
			window.location.hash = "contact";
			$("#map").hide();
		$("#navfour").addClass("selected");
		$(".splash").fadeOut("slow");
		$("#contactimage").fadeIn("slow");
		
		$("#navtwo").removeClass("selected");
		$("#navthree").removeClass("selected");
		$(".navone").removeClass("selected");
			
			$("#contentwrapper").slideUp("normal", function(){				
				$("#contentwrapper").load("contact.php #contentp", function(){
				$("#map2").hide();
				$("#contentwrapper").slideDown("normal", function(){

				});	
				});
				});		
		
		
		return false;
	
		});

		


	// JQuery scroll to anchor (Back to top) 
	 
	$(function(){

    $('a[href*=#]').click(function() {
    
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') 
        && location.hostname == this.hostname) {
        
            var $target = $(this.hash);
            
            $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
            
            if ($target.length) {
            
                var targetOffset = $target.offset().top;
                
                $('html,body').animate({scrollTop: targetOffset}, 1000);
                    
                return false;
                
            }
            
        }
        
    });
    
});


function goToAnchor() {
  location.href = "homepage.html#home";
} 


		
			

	});

	//This code is repeated here for when people click on a link to butterflyknights.com/experiences.php
	
	$(function() {
		
		$(".preload").hide();
			//Initialize the Lighboxes on Experiences Page
					$(function() { 	$('a.onebox').lightBox(); });
					$(function() { 	$('a.twobox').lightBox(); });
					$(function() { 	$('a.threebox').lightBox(); });
					$(function() { 	$('a.fourbox').lightBox(); });
					$(function() { 	$('a.fivebox').lightBox(); });
					$(function() { 	$('a.sixbox').lightBox(); });
					
					//Load the Experiences Boxes gracefully	
					$("#one").fadeIn("normal", function(){
					$("#two").fadeIn("normal", function(){
					$("#three").fadeIn("normal", function(){
					$("#four").fadeIn("normal", function(){
					$("#five").fadeIn("normal", function(){
					$("#six").fadeIn("normal", function(){						
						});
						});
						});
						});
						});
						});

						
						$(function(){
						$("#one").hover(function(){
						$("#onefade").fadeIn('fast'); 
						},function(){
						$("#onefade").fadeOut('fast'); 
						});
 						});
 
  						$("#two").hover(function(){
						$("#twofade").fadeIn('fast'); 
						},function(){
						$("#twofade").fadeOut('fast'); 
						});

						$("#three").hover(function(){
						$("#threefade").fadeIn('fast'); 
						},function(){
						$("#threefade").fadeOut('fast'); 
						});

 
						$("#four").hover(function(){
						$("#fourfade").fadeIn('fast'); 
						},function(){
						$("#fourfade").fadeOut('fast'); 
						});

 
						$("#five").hover(function(){
						$("#fivefade").fadeIn('fast'); 
						},function(){
						$("#fivefade").fadeOut('fast'); 
						});
 
 
						$("#six").hover(function(){
						$("#sixfade").fadeIn('fast'); 
						},function(){
						$("#sixfade").fadeOut('fast'); 
						});

		
		
		});