function getStyleSheet(name)
 {
	 if(!name || !document.styleSheets) return null;

     var i = document.styleSheets.length;
     while(i--)
     {
         var rules = document.styleSheets[i].rules ? document.styleSheets[i].rules :
         document.styleSheets[i].cssRules;
        var j = rules.length;
        while(j--) { 
          if(rules[j].selectorText == name)
            {
            return rules[j];
            }
          }
    }
     return null;
}

function getAllStyles()
{
    if(!document.styleSheets) return null;
    var ret = new Array();

    for(var i = 0; i < document.styleSheets.length; i++)
    {
         var rules = document.styleSheets[i].rules ? document.styleSheets[i].rules :
         document.styleSheets[i].cssRules;
        for(var j = 0; j < rules.length; j++) 
        {
        ret[ret.length] = rules[j].selectorText;
        }
    }
    return ret;
}

function setStyle(name, attr, value)
{
    var rule = getStyleSheet(name);
    if(!rule) return null;
    if(value) rule.style[attr] = value;
    return rule.style[attr];
}

function Fensterweite()
{
	//alert(window.innerWidth);
 if (window.innerWidth) return window.innerWidth;
 else if ( document.documentElement && document.documentElement.offsetWidth ) return document.documentElement.offsetWidth;
 else if (document.body && document.body.offsetWidth) return document.body.offsetWidth;
 else return 0;
}

function Fensterhoehe()
{
 if (window.innerHeight) return window.innerHeight;
 else if ( document.documentElement && document.documentElement.offsetHeight ) return document.documentElement.offsetHeight;
 else if (document.body && document.body.offsetHeight) return document.body.offsetHeight;
 else return 0;
}


function neuAufbau()
{
 brauser = navigator.userAgent.toLowerCase();
 if (Weite != Fensterweite() || Hoehe != Fensterhoehe())
 {
  if (brauser.indexOf("firefox")>-1)
  {
 	location.href = location.href;  //nur fuer firefox, seit 1.5 wird bei laden aus der history nicht sauber aktualisiert
  }
  else
  {
	 window.history.go(0);
  }
 }
}


	 var fensterhoehe = 0, fensterweite = 0;
     if( typeof( window.innerWidth ) == 'number' ) {
     //Non-IE
       fensterweite = window.innerWidth;
       fensterhoehe = window.innerHeight;
     } else if( document.documentElement &&
      ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
      fensterweite = document.documentElement.clientWidth;
      fensterhoehe = document.documentElement.clientHeight;
     } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
      fensterweite = document.body.clientWidth;
      fensterhoehe = document.body.clientHeight;
    }
    //window.alert( 'Width = ' + fensterweite );
    //window.alert( 'Height = ' + fensterhoehe );

    var bottomhoehe = getStyleSheet('.horbarunten').style['height'];    //Höhe des Fußes
	//alert(bottomhoehe);
    var pos = bottomhoehe.indexOf("px");
    if (pos > -1)
         {
          bottomhoehe = bottomhoehe.substr(0,pos);
         }
    var contenthoehe = getStyleSheet('.seitenmitte').style['height'];       // Höhe des Contentbereichs
    //alert(contenthoehe);
	var pos = contenthoehe.indexOf("px");
    if (pos > -1)
         {
          contenthoehe = contenthoehe.substr(0,pos);
         }
    var kopfhoehe = 150;
    var designhoehe = kopfhoehe + parseInt(contenthoehe) + parseInt(bottomhoehe);  //Höhe des Gesamtdesigns, Annahme Kopf hat 100 Pixel
    var hoehediff = designhoehe - fensterhoehe;                              //Differenz zwischen Design und tatsächlicher Fenstergröße
    var contenthoehe = parseInt(contenthoehe) - hoehediff;                   //Content kleiner machen!
    var contenthoehe = contenthoehe + 'px';
	setStyle('.seitenmitte','height',contenthoehe);
    setStyle('.rechts','height',contenthoehe);
    setStyle('.autorechts','height',contenthoehe);
    setStyle('.foerderungrechts','height',contenthoehe);
    setStyle('.haendlerrechts','height',contenthoehe);
    setStyle('.tankstellenrechts','height',contenthoehe);
    setStyle('.linksrechts','height',contenthoehe);
	setStyle('.kontaktrechts','height',contenthoehe);
	setStyle('.berichterechts','height',contenthoehe);
	setStyle('.links','height',contenthoehe);
    setStyle('.content','height',contenthoehe);
 
 if(!window.Weite && 
	((window.innerWidth) || (document.body && document.body.offsetWidth) || 
	(document.documentElement && document.documentElement.offsetWidth)))
  {
   window.onresize = neuAufbau;
   Weite = Fensterweite();
   Hoehe = Fensterhoehe();
  }






