
function mail(adr)
{
	s = window.location;
	window.location='mailto:'+/* 0 */adr;
	window.location=s;
}

// Bilderwechsel
function chgimgnav(img) 
{
  for (var i=0; i<document.images.length;i++)
  {
  	var imgName = document.images[i].src;
    document.images[i].src = imgName.replace("hot_","def_");
  }
  var s = document.getElementById(img).src;
  document.getElementById(img).src = s.replace("def_","hot_");
}
function chgimg_(img) 
{
  pos_hot = document.images[img].src.indexOf("hot_");
  pos_def = document.images[img].src.indexOf("def_");
  if ((pos_hot == -1) && (pos_def != -1)) {
    new_src = document.images[img].src.substr(0,pos_def) + "hot_" + document.images[img].src.substr(pos_def+4,document.images[img].src.length);
    document.images[img].src = new_src;
  } else if ((pos_hot != -1) && (pos_def == -1)) {
    new_src = document.images[img].src.substr(0,pos_hot) + "def_" + document.images[img].src.substr(pos_hot+4,document.images[img].src.length);
    document.images[img].src = new_src;
  }
}
function chgimg(img) 
{
  pos_hot = document.images[img.name].src.indexOf("hot_");
	pos_def = document.images[img.name].src.indexOf("def_");
  if ((pos_hot == -1) && (pos_def != -1)) {
    new_src = document.images[img.name].src.substr(0,pos_def) + "hot_" + document.images[img.name].src.substr(pos_def+4,document.images[img.name].src.length);
    document.images[img.name].src = new_src;
  } else if ((pos_hot != -1) && (pos_def == -1)) {
    new_src = document.images[img.name].src.substr(0,pos_hot) + "def_" + document.images[img.name].src.substr(pos_hot+4,document.images[img.name].src.length);
    document.images[img.name].src = new_src;
  }
}
// Bilderwechsel in Input-Feld
function chgimg(field) 
{
  pos_hot = field.src.indexOf("hot_");
  pos_def = field.src.indexOf("def_");
  if ((pos_hot == -1) && (pos_def != -1)) {
    new_src = field.src.substr(0,pos_def) + "hot_" + field.src.substr(pos_def+4,field.src.length);
    field.src = new_src;
  } else if ((pos_hot != -1) && (pos_def == -1)) {
    new_src = field.src.substr(0,pos_hot) + "def_" + field.src.substr(pos_hot+4,field.src.length);
    field.src = new_src;
  }
}

var activeElement;

function chgclass(el) 
{
	if (!el.className)
	{
		e = document.getElementById(el.toString().slice(el.toString().lastIndexOf("el=")+3,el.toString().lastIndexOf("&")));
	}
	else
		e = el;

	if ((typeof activeElement) != "undefined")
		activeElement.className = '';
	if (el.className != 'aktuell')
	{
//		alert(document.location.href);
		activeElement = el;
		el.className = 'aktuell';
	}
}
function hideDiv(el) 
{
  if (document.all)
  {
	  document.getElementById(el).style.display = "none";
	  document.getElementById(el).style.height = "0px";
  }
  else
  {
	  document.getElementById(el).style.visibility = "collapse";
	  document.getElementById(el).style.height = "0px";
  }
}
function showDiv(el) 
{
  if (document.all)
  {
	  document.getElementById(el).style.display = "block";
	  document.getElementById(el).style.height = "auto";
  }
  else
  {
	  document.getElementById(el).style.visibility = "visible";
	  document.getElementById(el).style.height = "auto";
  }
}

function addSubNav(sm) 
{
	parent.nav.location.href = "nav_"+sm+".html";
}

function removeSubNav(el) 
{
	var pos = el.href.lastIndexOf("/");
	parent.nav.location.href = "nav.html?el="+el.href.slice(pos+1,el.href.lastIndexOf("."));
}

function getContext() {
	s = document.location.href;
	s = s.substr(0,s.lastIndexOf("content/"));
	return s
}

function checkDomain( pg ) {
	if (!pg)
		return false;
	if ( pg.indexOf('www.gesa-dresden.de') != -1)
		return true;
	if ( pg.indexOf('www.realraum-media.de') != -1)
		return true;
	if ( pg.indexOf('M:') != -1)
		return true;
	return false;
}

function loadToFrameset() {
  if (location.search) {
    seite2 = unescape(location.search.substring(1,location.search.length));
    adressen = seite2.split('&');
    seite = adressen[0];
    seite1 = adressen[1];
    selbst = top.location.href;
    adressen = selbst.split('?');
    selbst = adressen[0];
    if (checkDomain(seite) && selbst != seite)
      self.content.location.href = seite;
    if (checkDomain(seite1) && selbst != seite1)
      self.nav.location.href = seite1;
  }
}
