		var myWidth = 0, myHeight = 0;
		var menu_visible = true;
		var container_width = 996;

		// variables for titlebar.tag
		var titlebar_columns_number = 0;
		
		var content_col_text1;
		var content_col_text2;
		var content_col_text3;
		var content_col_text4;
		var content_col_text5;
		var content_col_text6;

		var content_col_fitToWidth1;
		var content_col_fitToWidth2;
		var content_col_fitToWidth3;
		var content_col_fitToWidth4;
		var content_col_fitToWidth5;
		var content_col_fitToWidth6;

		var content_col_width1;
		var content_col_width2;
		var content_col_width3;
		var content_col_width4;
		var content_col_width5;
		var content_col_width6;
		
		function showSidebar() {
			menu_visible = true;
			document.getElementById( "menuleft" ).style.display = "";
			document.getElementById( "menuleft_hidden" ).style.display = "none";
			updateWidth();
		}

		function hideSidebar() {
			menu_visible = false;
			document.getElementById( "menuleft" ).style.display = "none";
			document.getElementById( "menuleft_hidden" ).style.display = "";
			updateWidth();
		}

		function updateWidth() {
			var menuleft_width = 210;
			var titlebarMode = "default";
			if (!menu_visible) {
				menuleft_width = 40;
				titlebarMode = "wide";
			}
			document.getElementById("container").style.width = container_width + "px";
			document.getElementById("headerfill").style.width = (container_width - 984) + "px";
			document.getElementById("menubar").style.width = (container_width - 16) + "px";
		
			document.getElementById("contentMain").style.width = container_width + "px";
			document.getElementById("contentbody").style.width = container_width + "px";
			document.getElementById("siteright").style.width = (container_width - menuleft_width - 26) + "px";
			
			if (titlebar_columns_number >= 1) {
				var cc1 = document.getElementById("content-col-1");
				cc1.style.width = content_col_width1[titlebarMode] + "px";
				if (content_col_fitToWidth1){ 
					updateTextToElementWidth(cc1, content_col_text1);
				}
				$('.col1').css("width", content_col_width1[titlebarMode]+"px");
			}

			if (titlebar_columns_number >= 2) {
				var cc2 = document.getElementById("content-col-2");
				cc2.style.width = content_col_width2[titlebarMode] + "px";
				if (content_col_fitToWidth2){ 
					updateTextToElementWidth(cc2, content_col_text2);
				}
				$('.col2').css("width", content_col_width2[titlebarMode]+"px");
			}

			if (titlebar_columns_number >= 3) {
				var cc3 = document.getElementById("content-col-3");
				cc3.style.width = content_col_width3[titlebarMode] + "px";
				if (content_col_fitToWidth3){ 
					updateTextToElementWidth(cc3, content_col_text3);
				}
				$('.col3').css("width", content_col_width3[titlebarMode]+"px");
			}

			if (titlebar_columns_number >= 4) {
				var cc4 = document.getElementById("content-col-4");
				cc4.style.width = content_col_width4[titlebarMode] + "px";
				if (content_col_fitToWidth4){ 
					updateTextToElementWidth(cc4, content_col_text4);
				}
				$('.col4').css("width", content_col_width4[titlebarMode]+"px");
			}
			
			if (titlebar_columns_number >= 5) {
				var cc5 = document.getElementById("content-col-5");
				cc5.style.width = content_col_width5[titlebarMode] + "px";
				if (content_col_fitToWidth5){ 
					updateTextToElementWidth(cc5, content_col_text5);
				}
				$('.col5').css("width", content_col_width5[titlebarMode]+"px");
			}
			
			if (titlebar_columns_number >= 6) {
				var cc6 = document.getElementById("content-col-6");
				cc6.style.width = content_col_width6[titlebarMode] + "px";
				if (content_col_fitToWidth6){ 
					updateTextToElementWidth(cc6, content_col_text6);
				}
				$('.col6').css("width", content_col_width6[titlebarMode]+"px");
			}
			
			if (document.getElementById("footercenter") != null) {
				document.getElementById("footercenter").style.width = (container_width - 24) + "px";
			}

		}

		function updateTextToElementWidth(element, str) {
			var len = element.clientWidth;
			var newStr = fitStringToWidth(str, len, element.className);
			element.innerHTML = newStr;
		}
		
		// this is from the Internet and seems to be really OK
		function fitStringToWidth(str,width,className) {  
			// str    A string where html-entities are allowed but no tags.  
			// width  The maximum allowed width in pixels  
			// className  A CSS class name with the desired font-name and font-size. (optional)  
			// ----  
			// _escTag is a helper to escape 'less than' and 'greater than'  
			function _escTag(s){ 
				return s.replace("<","&lt;").replace(">","&gt;");
			}  
			//Create a span element that will be used to get the width  
			var span = document.createElement("span");  
			//Allow a classname to be set to get the right font-size.  
			if (className) 
				span.className=className;  
			span.style.display='inline';  
			span.style.visibility = 'hidden';  
			span.style.padding = '0px';  
			document.body.appendChild(span);  
			var result = _escTag(str); 
			// default to the whole string  
			span.innerHTML = result;
			// Check if the string will fit in the allowed width. NOTE: if the width
			// can't be determinated (offsetWidth==0) the whole string will be returned.  
			if (span.offsetWidth > width) {
				var posStart = 0, posMid, posEnd = str.length, posLength;
				// Calculate (posEnd - posStart) integer division by 2 and
				// assign it to posLength. Repeat until posLength is zero.    
				while (posLength = (posEnd - posStart) >> 1) {      
					posMid = posStart + posLength;
					//Get the string from the begining up to posMid;
					span.innerHTML = _escTag(str.substring(0,posMid)) + '&hellip;';      
					// Check if the current width is too wide (set new end)      
					// or too narrow (set new start)
					if ( span.offsetWidth > width ) 
						posEnd = posMid; 
					else 
						posStart=posMid;    
				}
				result = '<abbr title="' + str.replace("\"","&quot;") + '">' + _escTag(str.substring(0,posStart)) + '&hellip;<\/abbr>';  
			}  
			document.body.removeChild(span);  
			return result;
		}		
			
		function readWindowSize() {
			  if( typeof( window.innerWidth ) == 'number' ) {
			    //Non-IE
			    myWidth = window.innerWidth;
			    myHeight = window.innerHeight;
			  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			    //IE 6+ in 'standards compliant mode'
			    myWidth = document.documentElement.clientWidth;
			    myHeight = document.documentElement.clientHeight;
			  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			    //IE 4 compatible
			    myWidth = document.body.clientWidth;
			    myHeight = document.body.clientHeight;
			  }
		}

