// JavaScript Document


function Calculate_The_Content_Dependent_Heights()
{ 
   var The_Minimum_Height = 410; //pixels
//   var The_Top_Padding    = 1; //pixels
//   var The_Space_Between_Links_Modules = 5; //pixels
   var The_Space_Between_Image_And_Text = 4; // pixels
   var The_Bottom_Padding = 12; //pixels
   var The_Secondary_Module_Padding_Offset = 4;
   
   var The_Image_Height =
          document.getElementById( "Live_Page:Body_Content_Image_Wrapper_ID" ).offsetHeight;
		  
   var The_Footer_Links_Module_Height = 0; //pixels
   var The_Footer_Links_Module_Node =
          document.getElementById( "Live_Page:Body_Content_Footer_Links_Wrapper_ID" );
   if( The_Footer_Links_Module_Node != null )
   {
      The_Footer_Links_Module_Height = The_Footer_Links_Module_Node.offsetHeight;
   };
		  
		  
   var The_Text_Height =
          document.getElementById( "Live_Page:Body_Content_Main_Text_Wrapper_ID" ).offsetHeight;
		  
   var The_Navigation_Wrapper_Height =
          document.getElementById( "Live_Page:Navigation_Wrapper_ID" ).offsetHeight;
		  
   var The_Family_Tree_Height =
          document.getElementById( "Live_Page:Family_Tree_Wrapper_ID" ).offsetHeight;
		  
   var The_Immediate_Family_Height =
          document.getElementById( "Live_Page:Immediate_Family_Wrapper_ID" ).offsetHeight;
		  
   var The_Links_Module_Wrapper_Height =
          document.getElementById( "Live_Page:Links_Module_Wrapper_ID" ).offsetHeight + The_Secondary_Module_Padding_Offset;
		  
   var The_Primary_Links_Module_Height =
          document.getElementById( "Live_Page:Primary_Module_Wrapper_ID" ).offsetHeight;
		  
   var The_Secondary_Links_Module_Height =
          document.getElementById( "Live_Page:Secondary_Module_Wrapper_ID" ).offsetHeight;
		  
//   alert( The_Image_Height + ", " +
//		  The_Footer_Links_Module_Height + ", " +
//		  The_Text_Height + ", " +
//		  The_Navigation_Wrapper_Height + ", " +
//		  The_Family_Tree_Height + ", " +
//		  The_Immediate_Family_Height + ", " +
//		  The_Links_Module_Wrapper_Height + ", " +
//		  The_Primary_Links_Module_Height + ", " +
//		  The_Secondary_Links_Module_Height );
   
   var The_Center_Column_Height = The_Image_Height + The_Space_Between_Image_And_Text + The_Text_Height;
   
   var The_Content_Height = Math.max( The_Links_Module_Wrapper_Height,
									  Math.max( The_Navigation_Wrapper_Height,
											    The_Center_Column_Height       ) );
	
	//alert("The_Content_Height = " + The_Content_Height);
		  
   var The_Body_Content_Positioning_Context_Height =
           Math.max( The_Minimum_Height, The_Family_Tree_Height +
                                         The_Content_Height +
										 The_Bottom_Padding        );
                                                    
		  
//   alert( The_Links_Module_Wrapper_Height + ", " +
//		  The_Navigation_Wrapper_Height + ", " +
//		  The_Center_Column_Height + ", " +
//		  The_Body_Content_Positioning_Context_Height );
   

   var The_Secondary_Links_Module_Vertical_Offset =
          document.getElementById( "Live_Page:Secondary_Module_Wrapper_ID" ).offsetTop;

   var The_Text_Vertical_Offset =
          document.getElementById( "Live_Page:Body_Content_Main_Text_Wrapper_ID" ).offsetTop;

//   alert( The_Text_Vertical_Offset + ", " +
//		  The_Secondary_Links_Module_Vertical_Offset );

//   alert( "Height=" +
//		  document.getElementById( "Live_Page:Body_Content_Positioning_Context_ID" ).offsetHeight +
//		  "<br/>" +
//		  "New Height=" +
//		  The_Body_Content_Positioning_Context_Height +
//		  "<br/>"
//		  );
   
   document.getElementById( "Live_Page:Body_Content_Positioning_Context_ID" ).style.height =
      The_Body_Content_Positioning_Context_Height + "px";  
	  
   document.getElementById( "Live_Page:Navigation_Wrapper_ID" ).style.height =
      ( The_Content_Height + The_Secondary_Module_Padding_Offset ) + "px";  
	  
   document.getElementById( "Live_Page:Secondary_Module_Wrapper_ID" ).style.height =
      ( The_Content_Height - The_Secondary_Links_Module_Vertical_Offset ) + "px";  
	  
   document.getElementById( "Live_Page:Body_Content_Main_Text_Wrapper_ID" ).style.height =
      ( The_Content_Height - ( The_Image_Height + The_Space_Between_Image_And_Text + 2 ) + The_Secondary_Module_Padding_Offset ) + "px";  
	  
//   alert( "Height=" +
//		  document.getElementById( "Live_Page:Body_Content_Positioning_Context_ID" ).offsetHeight +
//		  "<br/>" +
//		  "New Height=" +
//		  The_Body_Content_Positioning_Context_Height +
//		  "<br/>"
//		  );
   
}

