
function subWrapperHeight() {
   
	var currHeight = 0;
	var maxHeight = 0;
	pageColumns = new Array('leftColumn', 'rightColumn', 'centerColumn', 'subWrapper');
	
	for (i = 0; i < pageColumns.length; i++) {
		if (document.getElementById(pageColumns[i])) {
			document.getElementById(pageColumns[i]).style.height = "";
			currHeight = document.getElementById(pageColumns[i]).offsetHeight;
			if (currHeight > maxHeight) {
				maxHeight = currHeight;
			}
		}
		
	}
	
	for (i = 0; i < pageColumns.length; i++) {
		if (document.getElementById(pageColumns[i])) {
			if (document.getElementById(pageColumns[i]).offsetHeight < maxHeight) {
				document.getElementById(pageColumns[i]).style.height = maxHeight+"px";
			}
		}
	}
}

// tabbed interface


	function getValue(varname) {
  		// First, we load the URL into a variable
 		 var url = window.location.href;

 		 // Next, split the url by the ?
 		 /* alert(url.indexOf("?")); */
  		if (url.indexOf("?") != -1) {
  			var qparts = url.split("?");
  		}
  		else {
  			return false;
  		}

  		// Check that there is a querystring, return "" if not
  		if (qparts.length == 0) {
   			return "";
  		}

  		// Then find the querystring, everything after the ?
 		 var query = qparts[1];

  		// Split the query string into variables (separates by &s)
  		var vars = query.split("&");

  		// Initialize the value with "" as default
  		var value = "";

  		// Iterate through vars, checking each one for varname
  		for (i=0;i<vars.length;i++) {
   			 // Split the variable by =, which splits name and value
   			 var parts = vars[i].split("=");
    
   			 // Check if the correct variable
   			 if (parts[0] == varname)
    			{
    			  // Load value into variable
    			  value = parts[1];

     			 // End the loop
      			break;
    			}
 			 }
  
  // Convert escape code
  value = unescape(value);

  // Convert "+"s to " "s
  value.replace(/\+/g," ");

  // Return the value
  return value;
}

     var selectedTab = null;

      function showSection(tab, name) {
      
      //alert(name);
      
      var detailSections = document.getElementById("tabRow").childNodes;
      /*alert(detailSections.length);*/
      
      
	  var whichTab = document.getElementById(tab)
        if (selectedTab) {
          selectedTab.className = 'tabbedInterfaceTabsInactive'
		}
		
        selectedTab = whichTab;
		selectedTab.className = 'tabbedInterfaceTabsActive'
        
        
		for(j = 0; j < detailSections.length+1; j++) {
          if (document.getElementById("section"+j)) {
          document.getElementById("section"+j).style.display = (name == "section"+j) ? 'block':'none';
        }
      }
      
      subWrapperHeight();
     }
     
     
     function showFirstSection() {
      	
      	var jumpToPanel = getValue("panel");
      	var jumpToAnchor = getValue("anchor");
      
      	if(jumpToPanel != '' && jumpToPanel != null) {
      		
      		viewTab = 'tab'+jumpToPanel;
      		viewSection = 'section'+jumpToPanel;
      	
      		showSection(viewTab, viewSection);
      
      		
     	 }
     	 else {
     	 	showSection('tab0', 'section0');
     	 }
     	 
     	 if(jumpToAnchor != '' && jumpToAnchor != null) {
      		
      		var url = window.location.href;
  			
      		window.location = url + '#' + jumpToAnchor;
      		
     	 }
     	 else {
     	 }
     	 
     	subWrapperHeight();
     }

