
 
		
		if(	window.location.hash == "")
		{
			 window.location.hash = "#index";
			  
		};
	

		jQuery.event.add(window, "load", resizeFrame);
		jQuery.event.add(window, "resize", resizeFrame);
				function resizeFrame() 
					{
						$(document).ready(function()
						 {
        				    var h = $(window).height();
						    var w = $(window).width();

							//Fix height content
							var substract =	$("#menubar").height() + 50 + $("#header").height() + $("#footer").height();
							$("#content").css("height", $(window).height()-substract);
					
					
					
							//If height of text is larger, set that height as minimum
							if	( $("#contentright").height() < $("#contentlefttext").height())
							{
								var contentheight = $("#contentlefttext").height();	
							}
							
							if	( $("#contentright").height() > $("#contentlefttext").height())
							{
								var contentheight = $("#contentright").height();	
							}							
							
							
							if( contentheight > $("#content").height() )
							{
								$("#content").css("height",contentheight)	
							}
						
				
							var shadowheight = $("#header").height() + $("#footer").height() + 50	+ $("#content").height();
							//	alert(shadowheight+"  "+h+"   "+$(document).height());
							$("#shadowbox").css("height", shadowheight);
						 });
					};
							
							
							
				//Ajax content loader
				box1content = "";
				box2content = "";
				box3content = "";
				
				function CheckText(file, place, reg) 
				{	
					

						if(typeof place == "undefined")
						{
							
								
								InsertText(file, place, reg);
						
						}
						if(place == "box1")
						{
							if(box1content !== file)
							{
								InsertText(file, place, reg);
							}							
						}
						if(place == "box2")
						{
							if(box2content !== file)
							{
								InsertText(file, place, reg);
							}							
						}
						
						if(place == "box3")
						{
							if(box3content !== file)
							{
								InsertText(file, place, reg);
							}							
						}						
						
						
		
				}
				
				function InsertText(filename, place, reg) 
				{
					$(function() 
					{		
						$(".active").removeClass("active");
						
						if (typeof reg == 'undefined')
						{
							reg = "ja";
						}
						
					
						if ( reg !== "no")
						{
								filepath = "text/"+filename+".php";
								
						}else
						{
							filepath = filename;
						}			
						
						if (typeof place == 'undefined')
						{
							place = "#contentlefttext";
							maincontent = filename;
						}
						
						if (place == "box1")
						{
							place = "#contentrighttop";
							box1content = filename;
						}
						
						if (place == "box2")
						{
							place = "#contentrightbottom";
							box2content = filename;
						}
						
						if (place == "box3")
						{
							place = "#contentrightbottom2";
							box3content = filename;
						}						
						
									$(".active").removeClass("active");
									if(filename=="home"){filename = "index"};
									$("a#"+filename+"link").addClass("active");
									if(filename=="index"){filename = "home"};						
									
						$(place).fadeOut(0);
						$.ajax(
						{
							url : filepath,
							success : function (data) 
							{
								$(place).html(data);
								$(place).fadeIn(300);
								
									
									if(filename=="home"){filename = "index"};
									$("a#"+filename+"link").addClass("active");
									if(filename=="index"){filename = "home"};
									resizeFrame();
								
						
							}
						});
			
					});
				};

			//Menu buttons
			
		$(document).ready(function()
		 {	
		 	
			
			
			//EDIT MENU LINKS HERE
			//EDIT MENU LINKS HERE
			//EDIT MENU LINKS HERE
			//EDIT MENU LINKS HERE									
			function LoadActueel()
			{
				CheckText("actueel");

				CheckText("journeybox","box1");
				CheckText("creationbox","box2");
				CheckText("enneagrambox","box3");
			};
			
			function LoadIndex()
			{
				CheckText("home");				
				CheckText("contactbox","box1");
				CheckText("boekbox","box2");
				CheckText("","box3");	
			};
			
			function LoadNatuurgeneeskunde()
			{
				CheckText("natuurgeneeskunde");
				CheckText("fotobox","box1");
				CheckText("boekbox","box2");	
				CheckText("","box3");	
			};
			
			function LoadCoach()
			{
				CheckText("coach");
				CheckText("journeybox","box1");
				CheckText("creationbox","box2");
				CheckText("nvjtbox","box3");
			};
			
			function LoadOvermij()
			{
				CheckText("overmij");
				CheckText("fotobox","box1");
				CheckText("boekbox","box2");	
				CheckText("","box3");
			};
			
			function LoadContact()
			{
				CheckText("contact");
				CheckText("fotobox","box1");
				CheckText("boekbox","box2");	
				CheckText("","box3");
			};
			
			function LoadBoek()
			{
				CheckText("gelukopjepad");
				CheckText("contactbox","box1");
				CheckText("boekbox","box2");
				CheckText("","box3");	
			};		

			function LoadZielenpijn()
			{
				CheckText("zielenpijn");
				CheckText("fotobox","box1");
				CheckText("boekbox","box2");
				CheckText("","box3");	
			};			
							
			
			
			
			
			

			
			
						
			function onpageload(){
			//Fix page reload / back + forward buttons
			if(window.location.hash === "#actueel") {
				LoadActueel();
			}
			
			if(window.location.hash === "#index" ||  window.location.hash == '') {
				LoadIndex();	
			}			
			if(window.location.hash === "#natuurgeneeskunde") {
				LoadNatuurgeneeskunde();	
			}			
				
			if(window.location.hash === "#coaching") {
				LoadCoach();
			}							

			if(window.location.hash === "#overmij") {
				LoadOvermij();
			}			
			
			if(window.location.hash === "#contact") {
				LoadContact();	
			}	
			
			if(window.location.hash === "#gelukopjepad") {
				LoadBoek();	
			}
			
			if(window.location.hash === "#zielenpijn") {
				LoadZielenpijn();	
			}									

			};
		 
	 	//Make links load content	
			$("a#actueellink").click(function()
			{

				LoadActueel();	
				
			});
					
			$("a#indexlink").click(function()
			{
				LoadIndex();									
			});			
					
			$("a#natuurgeneeskundelink").click(function()
			{
				LoadNatuurgeneeskunde();								
			});			

			$("a#coachlink").click(function()
			{
				LoadCoach();										
			});			
					
			$("a#overmijlink").click(function()
			{
				LoadOvermij();										
			});			
					
			$("a#contactlink").click(function()
			{
				LoadContact();									
			});	
			
			
			//Incase of back / forward/ click
			$(window).bind('hashchange', function () {
				 onpageload();
			});
			
			$(window).ready(function(e) {
                onpageload();
            });
			

				
					
		});
		
