function Quadrat(Zahl)  {
var Ergebnis = document.Formular.Eingabe.value * document.Formular.Eingabe.value;
   alert("Das Quadrat von " + document.Formular.Eingabe.value + " = " + Ergebnis);
}

function getPageSize(){
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	}
	else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	}
	else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}

	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	}
	else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}

	// for small pages with total height less then height of the viewport
	if (yScroll < windowHeight) {
		pageHeight = windowHeight;
	}
	else {
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	pageWidth = (xScroll < windowWidth ? xScroll : windowWidth);

	arrayPageSize = new Array(pageWidth, pageHeight, windowWidth, windowHeight);
	return arrayPageSize;
}

function grayOut(vis, bild, options) {
  // Pass true to gray out screen, false to ungray
  // options are optional.  This is a JSON object with the following (optional) properties
  // opacity:0-100         // Lower number = less grayout higher = more of a blackout 
  // zindex: #             // HTML elements with a higher zindex appear on top of the gray out
  // bgcolor: (#xxxxxx)    // Standard RGB Hex color code
  // grayOut(true, {'zindex':'50', 'bgcolor':'#0000FF', 'opacity':'70'});
  // Because options is JSON opacity/zindex/bgcolor are all optional and can appear
  // in any order.  Pass only the properties you need to set.
  var options = options || {}; 
  var zindex = options.zindex || 50;
  var opacity = options.opacity || 70;
  var opaque = (opacity / 100);
  var bgcolor = options.bgcolor || '#000000';
  
  var dark=document.getElementById('darkenScreenObject');
  if (!dark) {
    // The dark layer doesn't exist, it's never been created.  So we'll
    // create it here and apply some basic styles.
    // If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917
    var tbody = document.getElementsByTagName("body")[0];
    var tnode = document.createElement('div');           // Create the layer.
        tnode.style.position='absolute';                 // Position absolutely
        tnode.style.top='0px';                           // In the top
        tnode.style.left='0px';                          // Left corner of the page
        tnode.style.overflow='hidden';                   // Try to avoid making scroll bars            
        tnode.style.display='none';                      // Start out Hidden
        tnode.id='darkenScreenObject';                   // Name it so we can find it later
    tbody.appendChild(tnode);                            // Add it to the web page
    dark=document.getElementById('darkenScreenObject');  // Get the object.
  }
 
  var pic=document.getElementById('picScreenObject');
  if (!pic) {
    var tbody = document.getElementsByTagName("body")[0];
    var tnode = document.createElement('img');           // Create the layer.
        tnode.style.overflow='hidden';                   // Try to avoid making scroll bars            
        tnode.style.display='none';                      // Start out Hidden
        tnode.id='picScreenObject';                   // Name it so we can find it later
    tbody.appendChild(tnode);                            // Add it to the web page
    pic=document.getElementById('picScreenObject');  // Get the object.
  }

var container=document.getElementById('containerScreenObject');
  if (!container) {
    var tbody = document.getElementsByTagName("body")[0];
    var tnode = document.createElement('div');           // Create the layer.
        tnode.style.overflow='hidden';                   // Try to avoid making scroll bars            
        tnode.style.display='none';                      // Start out Hidden
        tnode.id='containerScreenObject';                   // Name it so we can find it later
    tbody.appendChild(tnode);                            // Add it to the web page
    container=document.getElementById('containerScreenObject');  // Get the object.
  }
    
var verweis=document.getElementById('verweisScreenObject');
  if (!verweis) {
    var tbody = document.getElementById("containerScreenObject");
    var tnode = document.createElement('a');           // Create the layer.
        tnode.style.overflow='hidden';                   // Try to avoid making scroll bars            
        tnode.style.display='none';                      // Start out Hidden
        tnode.href="javascript:grayOut(false)";
        tnode.id='verweisScreenObject';                   // Name it so we can find it later
    tbody.appendChild(tnode);                            // Add it to the web page
    
		
		var tbody = document.getElementById("verweisScreenObject");
  	var tnode = document.createElement("img");
				tnode.src='../css/images/close.gif';
				tnode.style.marginLeft=2+'px';
				tnode.style.marginRight=2+'px';
				tnode.style.marginTop=2+'px';
				tnode.style.marginBottom=2+'px';	
		tbody.appendChild(tnode);
		
    verweis=document.getElementById('verweisScreenObject');  // Get the object.
  }


  
  if (vis) {
    var arrayPageSize = getPageSize();
		var pageWidth=arrayPageSize[0];
		var pageHeight=arrayPageSize[1];

   
    //set the shader to cover the entire page and make it visible.
    dark.style.opacity=opaque;                      
    dark.style.MozOpacity=opaque;                   
    dark.style.filter='alpha(opacity='+opacity+')'; 
    dark.style.zIndex=zindex;        
    dark.style.backgroundColor=bgcolor;  
    dark.style.width= pageWidth+'px';
    dark.style.height= pageHeight+'px';
    dark.style.display='block';

    pic.style.zIndex=zindex+1;        
    pic.style.border='solid white 5px';
    pic.style.position='absolute';                 // Position absolutely
    pic.style.top=162+'px';                           // In the top
    pic.style.left=(pageWidth/2)-200+'px';                          // Left corner of the page   
    pic.style.width= '400'+'px';
    pic.style.height= '300'+'px';
    pic.src = bild;
    pic.style.display='block';
    
    container.style.zIndex=zindex+1;
    container.style.position='absolute';                 // Position absolutely
    container.style.top=164-20+'px';                           // In the top
    container.style.left=(pageWidth/2)-200+'px';                          // Left corner of the page   
    container.style.backgroundColor='white';
    container.style.width=410+'px';
    container.style.textAlign='right';
    container.style.display='block';
    
    verweis.style.fontSize='80%'; 
    verweis.style.display='block';
                              
  } else {
  	
     dark.style.display='none';
     pic.style.display='none';
		 container.style.display='none';
		 verweis.style.display='none';
  }
}

function grayOuth(vis, bild, options) {
  // Pass true to gray out screen, false to ungray
  // options are optional.  This is a JSON object with the following (optional) properties
  // opacity:0-100         // Lower number = less grayout higher = more of a blackout 
  // zindex: #             // HTML elements with a higher zindex appear on top of the gray out
  // bgcolor: (#xxxxxx)    // Standard RGB Hex color code
  // grayOut(true, {'zindex':'50', 'bgcolor':'#0000FF', 'opacity':'70'});
  // Because options is JSON opacity/zindex/bgcolor are all optional and can appear
  // in any order.  Pass only the properties you need to set.
  var options = options || {}; 
  var zindex = options.zindex || 50;
  var opacity = options.opacity || 70;
  var opaque = (opacity / 100);
  var bgcolor = options.bgcolor || '#000000';
  
  var dark=document.getElementById('darkenScreenObject');
  if (!dark) {
    // The dark layer doesn't exist, it's never been created.  So we'll
    // create it here and apply some basic styles.
    // If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917
    var tbody = document.getElementsByTagName("body")[0];
    var tnode = document.createElement('div');           // Create the layer.
        tnode.style.position='absolute';                 // Position absolutely
        tnode.style.top='0px';                           // In the top
        tnode.style.left='0px';                          // Left corner of the page
        tnode.style.overflow='hidden';                   // Try to avoid making scroll bars            
        tnode.style.display='none';                      // Start out Hidden
        tnode.id='darkenScreenObject';                   // Name it so we can find it later
    tbody.appendChild(tnode);                            // Add it to the web page
    dark=document.getElementById('darkenScreenObject');  // Get the object.
  }
 
  var pic=document.getElementById('picScreenObject');
  if (!pic) {
    var tbody = document.getElementsByTagName("body")[0];
    var tnode = document.createElement('img');           // Create the layer.
        tnode.style.overflow='hidden';                   // Try to avoid making scroll bars            
        tnode.style.display='none';                      // Start out Hidden
        tnode.id='picScreenObject';                   // Name it so we can find it later
    tbody.appendChild(tnode);                            // Add it to the web page
    pic=document.getElementById('picScreenObject');  // Get the object.
  }

var container=document.getElementById('containerScreenObject');
  if (!container) {
    var tbody = document.getElementsByTagName("body")[0];
    var tnode = document.createElement('div');           // Create the layer.
        tnode.style.overflow='hidden';                   // Try to avoid making scroll bars            
        tnode.style.display='none';                      // Start out Hidden
        tnode.id='containerScreenObject';                   // Name it so we can find it later
    tbody.appendChild(tnode);                            // Add it to the web page
    container=document.getElementById('containerScreenObject');  // Get the object.
  }
    
var verweis=document.getElementById('verweisScreenObject');
  if (!verweis) {
    var tbody = document.getElementById("containerScreenObject");
    var tnode = document.createElement('a');           // Create the layer.
        tnode.style.overflow='hidden';                   // Try to avoid making scroll bars            
        tnode.style.display='none';                      // Start out Hidden
        tnode.href="javascript:grayOut(false)";
        tnode.id='verweisScreenObject';                   // Name it so we can find it later
    tbody.appendChild(tnode);                            // Add it to the web page
    
		
		var tbody = document.getElementById("verweisScreenObject");
  	var tnode = document.createElement("img");
				tnode.src='../css/images/close.gif';
				tnode.style.marginLeft=2+'px';
				tnode.style.marginRight=2+'px';
				tnode.style.marginTop=2+'px';
				tnode.style.marginBottom=2+'px';	
		tbody.appendChild(tnode);
		
    verweis=document.getElementById('verweisScreenObject');  // Get the object.
  }


  
  if (vis) {
    var arrayPageSize = getPageSize();
		var pageWidth=arrayPageSize[0];
		var pageHeight=arrayPageSize[1];

   
    //set the shader to cover the entire page and make it visible.
    dark.style.opacity=opaque;                      
    dark.style.MozOpacity=opaque;                   
    dark.style.filter='alpha(opacity='+opacity+')'; 
    dark.style.zIndex=zindex;        
    dark.style.backgroundColor=bgcolor;  
    dark.style.width= pageWidth+'px';
    dark.style.height= pageHeight+'px';
    dark.style.display='block';

    pic.style.zIndex=zindex+1;        
    pic.style.border='solid white 5px';
    pic.style.position='absolute';                 // Position absolutely
    pic.style.top=150+'px';                           // In the top
    pic.style.left=(pageWidth/2)-150+'px';                          // Left corner of the page   
    pic.style.width= '300'+'px';
    pic.style.height= '400'+'px';
    pic.src = bild;
    pic.style.display='block';
    
    container.style.zIndex=zindex+1;
    container.style.position='absolute';                 // Position absolutely
    container.style.top=150-20+'px';                           // In the top
    container.style.left=(pageWidth/2)-150+'px';                         // Left corner of the page   
    container.style.backgroundColor='white';
    container.style.width=310+'px';
    container.style.textAlign='right';
    container.style.display='block';
    
    verweis.style.fontSize='80%'; 
    verweis.style.display='block';
                              
  } else {
  	
     dark.style.display='none';
     pic.style.display='none';
		 container.style.display='none';
		 verweis.style.display='none';
  }
}
