 try {
 document.execCommand('BackgroundImageCache', false, true);
 } catch(e) {}
function addNet(url,titel){if((typeof window.sidebar=="object") && (typeof window.sidebar.addPanel=="function")){window.sidebar.addPanel(titel,url,"");}else{alert("Sie Nutzen eine veralterte Netscape Version!\nLesezeichen hinzufügen ist nicht möglich!");}}
function addtobookmark(){var url=window.location.href,t=document.title,ap=navigator.appName;
if(ap=="Microsoft Internet Explorer"){window.external.AddFavorite(url,t);}else{
if(ap=="Netscape"){addNet(url,t);}else{alert("Mit ihren Browser ist kein Lesezeichen über Javascript möglich.\nBitte legen sie das Lesezeichnen manuel an.\nURL:"+url);};}};
function addLoadEvent(func) {
	  var oldonload = window.onload; 
	  if (typeof window.onload != 'function') 
	  { 
	    window.onload = func; 
	  } 
	  else
	  { 
	    window.onload = function() 
		{ 
	      if (oldonload) 
		  { 
	        oldonload(); 
	      } 
	      func(); 
	    } 
	  } 
} 

// Initialize the arrays containing our size info.

var pixelArray = new Array('62.5%','72.5%','82.5%','92.5%','102.5%'); // Possible font px sizes
var countOfPixels = pixelArray.length;
var initSize = 0; // Array position of inital px size
var cookiesitename = "demag-ag-report09-font-size";

function fontSizer(inc) {
	/*if (!document.getElementById) return;*/
	
	var size = readCookie(cookiesitename);
	size = parseInt(inc)+parseInt(size);
	if (size < 0 ) { size = 0; }	
	if (size > countOfPixels ) { size = countOfPixels-1; }
	
	doFontSizing(size);	
	
	createCookie(cookiesitename, size, 365);
}

function fontSizerOnLoad() {	
	/*if (!document.getElementById) return;*/
	
	var size = readCookie(cookiesitename);	
	if (size < 0 ) { size = initSize; }
	if (size > countOfPixels ) { size = countOfPixels; }	
	/*switchPic();*/
	doFontSizing(size);
}

function doFontSizing(theFontSize) {			
	// Bugfix: Elements inside table would not resize with only the code below, so we do them seperatly.
	// NOTE: This only resizes the font, nothing else.
	// Resize by ID does not work with this.
	//aTables = document.getElementsByTagName('table');
	//for(i = 0; i < aTables.length; i++){
	//		aTables[i].style.fontSize = pixelArray[theFontSize];
	//}
	
	// if you rather want to size an individual element by ID, use this:
	// resizeContainer = document.getElementById('nameOfConainingElement');	
	// and uncomment the if statements at the start of each function
	resizeContainer = document.getElementsByTagName('body')[0];
	if(resizeContainer.style.fontSize != pixelArray[theFontSize])		
	resizeContainer.style.fontSize = pixelArray[theFontSize];	
	
}

function normalSize() {
	/*if (!document.getElementById) return;*/
	
	var size = initSize;
	
	doFontSizing(size);	
	createCookie(cookiesitename, size, 365);
}

function normalSizePrint() {
	/*if (!document.getElementById) return;*/
	
	var size = initSize;
	
	doFontSizing(size);	
}

/*function switchPic(size){	
	theImage = document.getElementById('dIndexBanner').firstChild;		
	imagePath = theImage.src;
	
}*/

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "expires="+date.toGMTString();
	}
	else {
		expires = "";
	}
	document.cookie = name+'='+value+'; '+expires+'; path=/';
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' '){ 
			c = c.substring(1,c.length);
		}
		if (c.indexOf(nameEQ) == 0) {
			return c.substring(nameEQ.length,c.length);
		}
	}
	return initSize;
}

addLoadEvent( function (e) {
	fontSizerOnLoad(readCookie());
});

function addBackgroundImageForPrint()
{
  var as = $('content').getElementsByTagName("a","li");
  addImg(as);
}
addLoadEvent(addBackgroundImageForPrint);

function creatImg(src)
{
  var img = document.createElement("img");
	img.setAttribute('src',src);	
	img.setAttribute('class','forprint');	
	img.setAttribute('className','forprint');	
	return img;
}

function addImg(arr)
{
  if(arr.length <= 0) return;
  for(var i=0; i<arr.length; i++)
  {    
    var ele = arr[i];
    if(ele == null) continue;
    var bgsrc = getStyle(ele,'backgroundImage');
    if(bgsrc == null || bgsrc =="none")
      return;
    
    var basehref = document.getElementsByTagName("base")[0].href;
    
    
    if(document.uniqueID){ 
      bgsrc = bgsrc.substring(5,bgsrc.length-2);
    }
    bgsrc = bgsrc.replace('url(', '').replace(')', '').replace(basehref,'');    
    var img = creatImg(bgsrc);
    new Insertion.Top(ele,img);
  }
}



function getStyle(elem, name)
{
  if (elem.style[name])
  {
    return elem.style[name];
  }
  else if (elem.currentStyle)
  {
    return elem.currentStyle[name];
  }
  else if (document.defaultView && document.defaultView.getComputedStyle)
  {
    name = name.replace(/([A-Z])/g,"-$1");
    name = name.toLowerCase();
  var s = document.defaultView.getComputedStyle(elem,"");
  return s && s.getPropertyValue(name);
  }
  else
  {
  return null;
  }
}


var tableWidth;
var tableExtNode;
var contentcolwidth = 53.2;
var pagecontentwidth = 98.9;
function showtable (obj)
{
	var btnshowtables = $$("p.showtable");
	for(i=0;i<btnshowtables.length;i++)
	{
		btnshowtables[i].style.display = "none";
	}
	var expandtables = $$("div.tx-kchtabletoexcel-pi1");
	var maxaddwidth = 0;
	for(j=0;j<expandtables.length;j++)
	{
			if($(expandtables[j].parentNode).hasClassName('expandtdwrap'))
			{
				expandtables[j].style.overflow = "visible";
				var tablelist = expandtables[j].getElementsByTagName("table");
				tableWidth = tablelist[0].offsetWidth;
				  if(tableWidth/10 > contentcolwidth)
				  {  
					var addWidth = tableWidth/10 - contentcolwidth;
					//set max
					//if(addWidth>80) addWidth = 80;
					expandtables[j].style.width = contentcolwidth + addWidth + 'em';
					if(maxaddwidth < addWidth) maxaddwidth = addWidth;
					
				  }
		  }
	}

	var btnhidetables = $$("p.hidetable");
	for(i=0;i<btnhidetables.length;i++)
	{
	btnhidetables[i].style.display = "block";
	}
	if(maxaddwidth)
	{
	    //hack for header
		if($$('div.headertop'))$$('div.headertop')[0].style.width = '93.8em';
	
		if($('container'))$('container').style.width = pagecontentwidth + maxaddwidth + 'em';
		if($('col2_content'))$('col2_content').style.width = contentcolwidth + maxaddwidth + 'em';
		if($$('div.footer_right'))$$('div.footer_right')[0].style.width = contentcolwidth + maxaddwidth + 'em';
	}

}

function hidetable (obj)
{

	var btnhidetables = $$("p.hidetable");
	for(i=0;i<btnhidetables.length;i++)
	{
		btnhidetables[i].style.display = "none";
	}
	
	var expandtables = $$("div.tx-kchtabletoexcel-pi1");
	for(j=0;j<expandtables.length;j++)
	{
			if($(expandtables[j].parentNode).hasClassName('expandtdwrap'))
			{
				expandtables[j].style.overflow = "hidden";
				var tablelist = expandtables[j].getElementsByTagName("table");
				tableWidth = tablelist[0].offsetWidth;	
				expandtables[j].style.width = contentcolwidth+'em';

		  }
	}
  
 	var btnshowtables = $$("p.showtable");
	for(i=0;i<btnshowtables.length;i++)
	{
		btnshowtables[i].style.display = "block";
	}
	   //hack for header
	if($$('div.headertop'))$$('div.headertop')[0].style.width = '';

    if($('container'))$('container').style.width = '';
    if($('col2_content'))$('col2_content').style.width = '';
    if($$('div.footer_right'))$$('div.footer_right')[0].style.width = '';
}

function resetAllTable ()
{
  hidetable();
}
addLoadEvent(resetAllTable);
/*
function setheigt100percent()
{

	$('wrapper').style.height = $('page').style.height = document.documentElement.scrollHeight > document.body.offsetHeight?"auto":"100%";

}
addLoadEvent(setheigt100percent);
*/