


function loadVisual( theme ) {
   var loadVisual = '/visual-start.html';
   if(theme == 1) {
      loadVisual = '/visual-start.html';
   } else if(theme == 2) {
      loadVisual = '/visual-klima.html';
   } else if(theme == 3) {
      loadVisual = '/visual-grueneit.html';
   } else if(theme == 4) {
      loadVisual = '/visual-technologien.html';
   } else if(theme == 5) {
      loadVisual = '/visual-initiativen.html';
   } else if(theme == 6) {
      loadVisual = '/visual-termine.html';
   }

   new Ajax.Updater('visual_area', loadVisual, {asynchronous:true, encoding: 'UTF-8', evalScripts:true});

}

function loadInnerArticles( elementid, theme, subtheme, navelement, highlight )
{
	return loadInnerArticlesExec( elementid, theme, subtheme, navelement, highlight, 0 )
}

function loadInnerArticlesExec( elementid, theme, subtheme, navelement, highlight, subthemeid )
{

   document.getElementById(elementid).innerHTML = '<div style="text-align:center;height:150px;"><img style="margin-top:50px;" src="/bilder/ajax-loader.gif" /></div>';

	if(navelement != false)
	{
  	myelements = document.getElementsByClassName(navelement+'_sel');
  	for(i = 0; i < myelements.length; i++)
  	{
  	  myelements[i].className = navelement;
  	}
  	highlight.className = navelement+'_sel';
  }



  new Ajax.Updater(elementid, 'articles.php?theme=' + theme + '&subtheme=' + subtheme + '&subthemeid=' + subthemeid, {asynchronous:true, encoding: 'UTF-8', evalScripts:true});
//  new Ajax.Updater(elementid, 'articles.php?theme=' + theme + '&subtheme=' + subtheme, {onComplete:function(){ new Effect.Fade(elementid, {from:0.0, to:1.0}); },asynchronous:true, encoding: 'UTF-8', evalScripts:true});
  return false;
}


function updown()
{
  new Effect.SlideUp('cont1');
  new Effect.SlideUp('cont3');
//  new Effect.SlideUp('cont4');


  new Effect.SlideDown('maintext2', { queue: 'end'});

  return false;
}

var actualShown = 0;

function slideHome( openIdx )
{
   if(actualShown == 0) {
      if(document.getElementById('top_teaser')) new Effect.BlindUp('top_teaser');
   }

   if(actualShown != openIdx) {

      var totalHeight = 0;
      new Effect.BlindDown('cont'+openIdx+'_active', { queue: 'end'});
      //totalHeight += document.getElementById('cont'+openIdx+'_active').clientHeight;

//      for(i = 1; i < 5; i++) {
      for(i = 1; i < 5; i++) {
         if( actualShown == 0 ) {
            if(document.getElementById('cont'+i)) new Effect.BlindUp('cont'+i);
            new Effect.BlindDown('cont'+i+'_inactive');
         }

         //totalHeight += document.getElementById('cont'+i+'_inactive').clientHeight;
         document.getElementById('cont'+i+'_inactive').className = 'cont trans50';
         totalHeight += getElementsHeight(document.getElementById('cont'+i+'_inactive'));
      }

      document.getElementById('cont'+openIdx+'_inactive').className = 'cont trans75';


      if( actualShown > 0 ) {
         new Effect.BlindUp('cont'+actualShown+'_active');
      }

      actualShown = openIdx;



      totalHeight += getElementsHeight(document.getElementById('cont'+openIdx+'_active'));


   	//document.getElementById("content-schatten").style.height = totalHeight +"px";

      //document.getElementById("content-main").style.height = totalHeight +"px";
   }
   return false;
}

function setElementClasses( elementid, values ) {
   document.getElementById(elementid).className = values;

}

function getElementsHeight( element ) {
   var h;
   if (element.innerHeight) // all except Explorer
   {
   	h = self.innerHeight;
   }
   else
   {
   	h = element.clientHeight;
   }
   return h;
}

function highlightTitlebar( barid, toggle ) {
   if(toggle == 'on') {
      if( actualShown == 0 || barid != actualShown) {
         document.getElementById('cont'+barid+'_inactive').className = 'cont trans75';
      }
   } else {
      if( actualShown == 0 || barid != actualShown) {
         document.getElementById('cont'+barid+'_inactive').className = 'cont trans50';
      }
   }
}
