function getEl(id)
{
  if (document.getElementById)
  {
    el = document.getElementById(id);
    return el;
  }
  if (document.layers)
  {
    return document.layers[element];
  }
  return document.all[element]
}


function hidediv(el) 
{
  getEl(el).style.visibility='hidden';
}


function showdiv(el) 
{
  getEl(el).style.visibility='visible';
}


function insertImage(el, imagesrc)
{
  x = imagesrc.replace(/##/g,'"');
  getEl(el).innerHTML = getEl(el).innerHTML.replace("IMAGEHERE", x);
}

function showBeschreibung(el, info_id)
{
  element = getEl(el);
  element.innerHTML = element.innerHTML.replace("BESCHREIBUNGEN", "<iframe src=\"ShowBeschreibung.aspx?id=" + info_id + "\">");
}


var switched = new Array();
var altalt = new Array();

function switchfav(el, changeto, info_id, newalt)
{
  if (switched[info_id])
  {
    switched[info_id] = false;
    changeto = 1-changeto;
    el.alt = altalt[info_id];
  }
  else
  {
    switched[info_id] = true;
    altalt[info_id] = el.alt;
    el.alt = newalt;
  }
  el.src = "switchfav.aspx?changeto=" + changeto + "&id=" + info_id;

}


var switched_c = new Array();
var altalt_c = new Array();

function switchcheck(el, changeto, info_id, newalt)
{
  if (switched_c[info_id])
  {
    switched_c[info_id] = false;
    changeto = 1-changeto;
    el.alt = altalt_c[info_id];
  }
  else
  {
    switched_c[info_id] = true;
    altalt_c[info_id] = el.alt;
    el.alt = newalt;
  }
  el.src = "switchclipboard.aspx?changeto=" + changeto + "&id=" + info_id + "&action=add&type_id=0";
  if (changeto==0)
    return;

  ctrl = document.getElementById('zwischenablage_control');
  if (ctrl)
    {
    ctrl.style.display="inline";
    }
}


var switched_za = {};
var altalt_za = {};

function switchza(el, changeto, element_id, type_id, newalt)
{
  // increase local clipboardversion so the changed session clipboardversion
  // does not cause a reload of the current clipboard (if we are changing clipboard state inside the clipboard window)
  clipboardversion = clipboardversion + 1;
  index = element_id + '-' + type_id;

  if (switched_za[index])
  {
    switched_za[index] = false;
    changeto = 1-changeto;
    el.alt = altalt_za[index];
  }
  else
  {
    switched_za[index] = true;
    altalt_za[index] = el.alt;
    el.alt = newalt;
  }
  el.src = "switchclipboard.aspx?changeto=" + changeto + "&id=" + element_id + "&type_id=" + type_id + "&action=mark";
}

function changecss(classname,element,newvalue) 
{
  var cssRules;
  var added = false;
  for (var S = 0; S < document.styleSheets.length; S++)
    {
    if (document.styleSheets[S]['rules']) 
      {
        cssRules = 'rules';
      } 
    else if (document.styleSheets[S]['cssRules']) 
      {
        cssRules = 'cssRules';
      } 
    
    for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) 
      {
        if (document.styleSheets[S][cssRules][R].selectorText == classname) 
          {
	    if(document.styleSheets[S][cssRules][R].style[element])
              {
                document.styleSheets[S][cssRules][R].style[element] = newvalue;
                added=true;
		return;
              }
          }
      }
    if(document.styleSheets[S].insertRule)
      {
        document.styleSheets[S].insertRule(classname+' { '+element+': '+newvalue+'; }',document.styleSheets[S][cssRules].length);
      }
    else if (document.styleSheets[S].addRule) 
      {
        document.styleSheets[S].addRule(classname,element+': '+newvalue+';');
      }
    }
}




