// JavaScript Document

function add_shadows_to_container(container_id)
{
  // Adds some HTML markup to a defined DIV container or all DIV items classed as 'container'
  // so that a shadow can be added via CSS
  
  // The HTML markup that contains the shadows
  var html_shadow = '<div class="bg tl">&nbsp;</div><div class="bg tr">&nbsp;</div><div class="bg br">&nbsp;</div><div class="bg bl">&nbsp;</div>';
  var html_before = '<div class="content clearfix">';
  var html_after  = '</div>'+html_shadow;
  var subsite = false;
  
  if(typeof(container_id)=='undefined')
  {
    // if there is no defined HTML element, than add the shadow to all 'container-classed' elements
    elements = document.getElementsByTagName('div');
      
    for(i=0; i<elements.length; i++)
    {
      // check all DIV elements
      if(typeof(elements[i])=='object')
      {
        if(!subsite)
        {
          // if this DIV element is an object, get its classname
          classname = elements[i].className;
        
          if(typeof(classname)!='undefined')
          {
            if(classname.indexOf('container')>-1)
            {
              // if the classname is 'container', add the HTML markup
              elements[i].innerHTML = html_before + elements[i].innerHTML + html_after;
            }
          }
        }
      }
    }
  }
  else if(typeof(document.getElementById(container_id))=='object')
  {
    // if an ID was given and there exists a HTML element with the given ID, add the HTML markup
    document.getElementById(container_id).innerHTML = html_before + document.getElementById(container_id) + html_after;
  }
}

function openWin(url,winname,width,height,posx,posy,scrollbars) {
  /* Oeffnet ein neues PopUp-Fenster mit den entsprechenden Parametern. Falls jene nicht
     gesetzt sind, werden sie mit Standardwerten belegt. */
  if((typeof winname)=='undefined') winname='merkmalPopup';
  if((typeof width)=='undefined') width=660;
  if((typeof height)=='undefined') height=500;
  if((typeof posx)=='undefined') posx=screen.availWidth/2-width/2;
  if((typeof posy)=='undefined') posy=screen.availHeight/2-height/2;

  if(navigator.platform.toLowerCase().indexOf("win")>-1) {
    objekt = window.open('', winname); // objekt.close();
  }
  
  if(url) {
    if((typeof objekt) != 'undefined') {
      /* Falls das Fenster schon geoeffnet ist, wird es geschlossen */
      if(!objekt.closed) objekt.close();
    }

    objekt = window.open(url,winname,'width='+width+',height='+height+',left='+posx+',top='+posy+',dependent=yes,hotkeys=no,location=no,menubar=no,resizable=yes,status=yes,scrollbars=auto,toolbar=no');

    objekt.focus
  } else {
    alert('Fehler openwin.1 - Keine URL fuer das PopUp uebergeben!');
    return false;
  }
}