              function getOpacity(element) {
                if(navigator.appName.indexOf("Microsoft") != -1) {
                  filterStr = document.getElementById(element).style.filter;
                  start = filterStr.indexOf("opacity=")+8;
                  end = filterStr.length-1;
                  return (filterStr.substring(start,end));
                } else {
                  return (document.getElementById(element).style.MozOpacity*100);
                }
              }

function loadScript(url) {
  var script = document.createElement('script');
  script.type = 'text/javascript';
  script.src = '../content/scripts/'+url;
  document.getElementsByTagName('head')[0].appendChild(script);
}
function getHeight() {
  var y;
  if (self.innerHeight) // all except Explorer
  {
	y = self.innerHeight;
  }
  else if (document.documentElement && document.documentElement.clientHeight)
	// Explorer 6 Strict Mode
  {
	y = document.documentElement.clientHeight;
  }
  else if (document.body) // other Explorers
  {
	y = document.body.clientHeight;
  } 
  return y;
}

function makeContentVisible() {
	if(navigator.appName.indexOf("Microsoft") != -1) {
          document.getElementById('VIewport').style.filter="Alpha(opacity=100)";
          document.getElementById('Sidebar').style.filter="Alpha(opacity=100)";
        } else { 
          document.getElementById('Viewport').style.MozOpacity=1;
          document.getElementById('Sidebar').style.MozOpacity=1;
        }

}

function showPage() {
  if (xmlHttp.readyState == 4) {
    document.getElementById('Viewport1').innerHTML = xmlHttp.responseText;
    xmlHttp.open('GET','../content/sidebars/'+pageToOpen, true);
    xmlHttp.onreadystatechange = showSidebar;
    xmlHttp.send(null);
  }
}
function showSidebar() {
  if (xmlHttp.readyState == 4) {
    document.getElementById('Sidebar').innerHTML = xmlHttp.responseText;
    pageRequestRunning = 0;
    grayin('Viewport');
  }
}
var pageToOpen = null;
var pageRequestRunning = 0;

function sendPageRequest(page) {
	if(!pageRequestRunning) {
		
		if (xmlHttp) {
			pageRequestRunning = 1;
    pageToOpen = page;
    grayout('Viewport');
  }
  }
}
function sendSidebarRequest(page) {
	
  if (xmlHttp) {
    pageToOpen = page;
    grayout('Sidebar');
  }
}
var xmlHttp;
if (typeof XMLHttpRequest != 'undefined') {
  xmlHttp = new XMLHttpRequest();
}
if (!xmlHttp) {
 // Internet Explorer 6 und ä
  try {
    xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP");
  } catch(e) {
    try {
      xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP");
    } catch(e) {
      xmlHttp  = null;
    }
  }
}
function heller(element) {
	//currOP = document.getElementById(element).style.MozOpacity;
	currOP = getOpacity(element)/100;
        currOP=currOP-0.0+0.1;
        if(currOP > 1) currOP = 1;
	if(navigator.appName.indexOf("Microsoft") != -1) {
          document.getElementById(element).style.filter="Alpha(opacity="+(currOP*100)+")";
        } else { 
          document.getElementById(element).style.MozOpacity=currOP;
        }
	//document.getElementById(element).style.MozOpacity=currOP;
      }
      function dunkler(element) {
	currOP = getOpacity(element)/100;
        currOP=currOP-0.1;
        if(currOP < 0) currOP = 0;
        if(navigator.appName.indexOf("Microsoft") != -1) {
          document.getElementById(element).style.filter="Alpha(opacity="+(currOP*100)+")";
        } else { 
          document.getElementById(element).style.MozOpacity=currOP;
        }
      }
      function grayout(element) {
        grayoutLoop(element);
      }
      function grayoutLoop(element) {
          //currOP = document.getElementById('Viewport').style.MozOpacity;
	   currOP = getOpacity(element)/100;
		  if(element != 'Viewport') {		  
		  }
          if(currOP > 0) {
             dunkler(element);
             window.setTimeout('grayoutLoop(\''+element+'\')',20);
	  } else {
		  if(element == 'Viewport') {		 
			 grayout('Sidebar'); 
		  } else {
    xmlHttp.open('GET','../content/pages/'+pageToOpen, true);
    xmlHttp.onreadystatechange = showPage;
    xmlHttp.send(null);
            }
          }
      }
      function grayin(element) {
        grayinLoop(element);
      }
      function grayinLoop(element) {
        //currOP = document.getElementById(element).style.MozOpacity;
	currOP = getOpacity(element)/100;
        if(currOP < 1) {
           heller(element);
           window.setTimeout('grayinLoop(\''+element+'\')',100);
	} else { 
		if(element == 'Viewport')
		{
			grayin('Sidebar');
		}
       }
      }
      function grayinBody() {
        if(navigator.appName.indexOf("Microsoft") == -1) {
	document.getElementById('Viewport').style.position="relative";
        }
	currOP = getBodyOpacity()/100;
        if(currOP < 1) {
           hellerBody();
           window.setTimeout('grayinBody()',100);
        }

      }
function hellerBody() {
	//currOP = document.getElementById(element).style.MozOpacity;
	currOP = getBodyOpacity()/100;
        currOP=currOP-0.0+0.1;
        if(currOP > 1) currOP = 1;
	if(navigator.appName.indexOf("Microsoft") != -1) {
          document.body.style.filter="Alpha(opacity="+(currOP*100)+")";
        } else { 
          document.body.style.MozOpacity=currOP;
        }
      }


