function getRef(obj, lay)
{
    if (isNAV && lay)
    {
		if (typeof lay == "string")
		{
		layRef = lay + ".document.";
		}
		else
		{
		layRef = lay.id + ".document.";
		}
    }

  	var objRef;
	    if(typeof obj == "string")
		{
		objRef = eval("document." + layRef + obj + styRef);
		}
	    else //obj enthält bereits Referenz
		{
		  if (!isNAV)
		  {
		    objRef = eval("document." + layRef + obj.id + styRef);
		  }
		  else 
		  {
		    objRef = obj;
		  }
	   	}
	return objRef;    //Referenz zurückliefern
}

function getref(obj, lay)
{
    if (isNAV)
    {
		if (lay)
		{
		layRef = lay.id + '.document.';
		}
		else
		{
		layRef = "";
		}
    }
  	var objRef;
		if(typeof obj == "string")
		{
		  objRef = eval("document." + layRef + obj + obRef);
		}
		else 
		{ 
		  objRef = obj; //obj enthält bereits Referenz
	   	}

	return objRef;   //Referenz zurückliefern
}


function getLeft(obj)		// x-Koordinate des Objektes
{
	if (isNAV || isNS6){
		return parseInt(getRef(obj).left);
			   }
	else {
		return getRef(obj).pixelLeft;
		 }
}

function getTop(obj)		//y-Koordinate des Objektes
{
		if (isNAV || isNS6){
			return parseInt(getRef(obj).top);
				  }
		else {

			return getRef(obj).pixelTop;
			 }
}

function moveObjTo(obj, x, y, step)	//Objekt verschieben
{	
	var a = getLeft(obj);

	var b = getTop(obj); 

	if (a < x)
	{
		moveRight(obj, x - a, step);
	}
	
	if (a > x)
	{
		moveLeft(obj, a - x, step);
	}
	if (b < y)
	{
		moveDown(obj, y - b, step);
	}

	if (b > y)
	{
		moveUp(obj, b - y, step);
	}
	else
    {
		return;
    }
}

function moveobjTo(obj, x, y)	//Objekt direkt verschieben
{
	if (isNAV)
	{
			  //alert(obj);
			getref(obj).moveTo(x, y);
	}
	else 
	{
		if (isIE || isOP)
		{  
		getRef(obj).pixelLeft = x;
		getRef(obj).pixelTop = y;
	    }
		else if(isNS6)
        {
        getRef(obj).left = x;
		getRef(obj).top = y;
		}
	}
}

function zeig(obj)
{
  getRef(obj).visibility = "visible";
}

function versteck(obj)
{

  getRef(obj).visibility = "hidden";

}

function get_screenWidth()
{
  if (isIE)
  {
	    var xMax = document.body.clientWidth;		
  }

  if (isNAV)
  {
        var xMax = window.innerWidth;

  }

  if (isNS6 || isOP)
  {
        var xMax = window.innerWidth;
  }
  return xMax;
}

function get_screenHeight()
{
  if (isIE)
  {
	    var yMax = document.body.clientHeight;		
  }

  if (isNAV)
  {
        var yMax = window.innerHeight;
  }
  if (isNS6 || isOP)
  {
        var yMax = window.innerHeight;	   
  }

  return yMax;
}

function get_LayerWidth(obj)
{
	if (isNAV)
    {
	  x = getRef(obj).clip.width;
	}
	if(isIE)
	{
	  x = getRef(obj).pixelWidth;
	  if (x == 0)
	  {
  	   x = getref(obj).clientWidth;
	  }
	}
	if (isNS6)
	{
		x = getref(obj).offsetWidth;
	}
	if (isOP)
	{
		x = getRef(obj).pixelWidth;
		if (x == 0)
		{
		x = getref(obj).clientWidth;
		}
	}
  return x;
}

function get_LayerHeight(obj)
{
	if (isNAV)
	{
	  y = getRef(obj).clip.height;
	}
	if (isIE)
	{
	  y = getRef(obj).pixelHeight; 
	  if (y == 0)
	  {
  	  y = getref(obj).clientHeight;
	  }
	}
	if (isNS6)
	{
		y = getref(obj).offsetHeight;
	}
	if (isOP)
	{
		y = getRef(obj).pixelHeight;
		if (y == 0)
		{
		y = getref(obj).clientHeight;
		}
	}
  return y;
}

function set_LayerWidth(obj, xdim)
{
  	if (isNAV)
	{
	  obj.clip.width = xdim;
	}
	if (isIE)
	{
	  obj.style.pixelWidth = xdim + 4; 
	}
	if (isNS6)
	{
	  obj.style.width = xdim;
	}
	if (isOP)
	{
	  obj.style.pixelWidth = xdim;
	}
}

function set_LayerHeight(obj, ydim, lay)
{
  	if (isNAV)
	{
	  obj.clip.height = ydim;
	}
	if(isIE)
	{
	  obj.style.pixelHeight = ydim; 
	}
	if (isNS6)
	{
	  obj.style.height = ydim;
	}
	if (isOP)
	{
	  obj.style.pixelHeight = ydim;
	}
}


function pageOffset(yexoff)
{

if (isNAV) {var yoff = window.pageYOffset + 30};
if (isIE)  {var yoff = document.body.scrollTop + 30};
   if (yoff == yexoff)
   {
      if (isNAV)
          {
                        if (document.layers['telemach'].pageY != yoff)
                        {
                        document.layers['telemach'].pageY = yoff;
                    }
      }
      else if (isIE)
          {
                if (document.all['telemach'].style.posTop != yoff)
                        {
            document.all['telemach'].style.posTop = document.body.scrollTop + 30;
                        }
          }
 }
          var yexoff = yoff;
     eval("setTimeout('pageOffset(" + yexoff + ")',500)");
}

var	fontnormal = 0;
var	fontpluseins = 0;
var	fontpluszwei = 0;
var	fontplusdrei = 0;
var	fontminuseins = 0;
var	fontminuszwei = 0;
function set_Font(xbildschirm){
if (getCookie() != ""){
	toSolve = getCookie();
	for (i = 0; i < toSolve.length; i++)
	{
		eval(toSolve[i]);
	}
	fontnormal = fontArr[0];
	fontpluseins = fontArr[1];
	fontpluszwei = fontArr[2];
	fontplusdrei = fontArr[3];
	fontminuseins = fontArr[4];
	fontminuszwei = fontArr[5];
}else{
	if (isNAV)
	{
		fontgr = 1;
	}
	else
	{
		fontgr = 0;	
	}

	if (xbildschirm <= 800)
	{
		fontnormal = 10 + fontgr;
		fontpluseins = 11;
		fontpluszwei = 12;
		fontplusdrei = 13;
		fontminuseins = 9 + fontgr;
		fontminuszwei = 9 + fontgr;
	}
	else if (xbildschirm > 800 && xbildschirm <= 1024)
	{
		fontnormal = 11 + fontgr;
		fontpluseins = 12;
		fontpluszwei = 13;
		fontplusdrei = 14;
		fontminuseins = 10 + fontgr;
		fontminuszwei = 9 + fontgr;
	}
	else if (xbildschirm > 1024 && xbildschirm <= 1260)
	{
		fontnormal = 12;
		fontpluseins = 13;
		fontpluszwei = 14;
		fontplusdrei = 16;
		fontminuseins = 11 + fontgr;
		fontminuszwei = 10 + fontgr;
	}
	else if (xbildschirm > 1260 && xbildschirm < 1400)
	{
		fontnormal = 13;
		fontpluseins = 14;
		fontpluszwei = 15;
		fontplusdrei = 16;
		fontminuseins = 12;
		fontminuszwei = 10 + fontgr;
	}
	else
	{
		fontnormal = 15;
		fontpluseins = 16;
		fontpluszwei = 17;
		fontplusdrei = 18;
		fontminuseins = 13;
		fontminuszwei = 12;
	}
}
	preArr = [fontnormal, fontpluseins, fontpluszwei, fontplusdrei, fontminuseins, fontminuszwei];
	csstext = '<STYLE TYPE="text/css">\n';
	classArray = returnArray(preArr);
	for (i = 0; i < classArray[0].length; i+=2)
	{
		csstext += classArray[0][i] + ' {font-size: ' + classArray[0][i + 1] + 'px}\n';
	}
	for (i = 0; i < classArray[1].length; i+=2)
	{
		csstext += classArray[1][i].toLowerCase() + ' {font-size: ' + classArray[1][i + 1] + 'px}\n';
	}
	csstext += '</STYLE>\n';
document.write(csstext);
}

function getCookie(){
if(!document.cookie){
	return "";
}else{
	var marker = unescape(document.cookie);
	reMarker = marker.split("; ");
	return reMarker;
}
}

function StatusMess(message){
window.status = message;
return true;
}



var n   = 0;

function findInPage(str) {
	if(parent.framer){
		var win = parent.framer; 
	}else{
	  var win = window; 
	}

  var txt, i, found;
  if (window.opera){
	alert("Ihr Browser unterstützt dieses Feature leider nicht");
	return false;
  }
  if (str == "")
    return false;
  if (!isIE) {
    if (!win.find(str))
      while(win.find(str, false, true))
        n++;
    else
      n++;
    if (n == 0)
      alert("Nichts gefunden.");
  }

  if (isIE) {
    txt = win.document.body.createTextRange();
    for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
      txt.moveStart("character", 1);
      txt.moveEnd("textedit");
    }
    if (found) {
      txt.moveStart("character", -1);
      txt.findText(str);
      txt.select();
      txt.scrollIntoView();
      n++;
    }
    else {
      if (n > 0) {
        n = 0;
        findInPage(str);
      }
      else
        alert("Nichts gefunden.");
    }
  }
  return false;
}

function showSub(item, itemPar, linker){
	if (isNAV){
		return;
	}else{
		if(!getref(item, itemPar).style.display){
			if(getref(linker).className == "subActive"){
				getref(item, itemPar).style.display = "block";
			}else{
				getref(item, itemPar).style.display = "none";
			}
		}
		
		getref(item, itemPar).style.display = (getref(item, itemPar).style.display == "block") ? "none" : "block";
		if(getref(linker).className == "subActive"){
			getref(linker).firstChild.src = (getref(linker).firstChild.src.indexOf("minus") > -1) ? "/images/symbols/plus_clicked.gif" : "/images/symbols/minus_clicked.gif";
		}else{
			getref(linker).innerHTML = (getref(item, itemPar).style.display == "block") ? '<IMG ALIGN="center" SRC="/images/symbols/minus.gif" WIDTH="12" HEIGHT="12" BORDER=0>' : '<IMG ALIGN="center" SRC="/images/symbols/plus.gif" WIDTH="12" HEIGHT="12" BORDER=0>';
		}
		
	}
}


function closeAll(){
	menueItems = document.getElementById('menueItem0').getElementsByTagName("DIV");
	reMenue = new Array();
	re = 0;
	for (i = 0; i < menueItems.length; i++){
		if(menueItems[i].id.indexOf('sub') > -1){
			reMenue[re] = menueItems[i];
			re++;
		}
	}

	for (i = 0; i < reMenue.length; i++){
		getref("sub" + i, "menueItem0").style.display = "none";
		getref("link" + i).innerHTML = '<IMG ALIGN="center" SRC="/images/symbols/plus.gif" WIDTH="13" HEIGHT="13" BORDER=0>';
	}
}

var printContent = "";
var winT = "";
function printWin(){
	if(!parent.framer){
		stripContenter = document.getElementById('contenter').cloneNode(true);
	}else{
		stripContenter = parent.framer.document.getElementsByTagName("body")[0];
	}
	printContent = "<P style='font-size: 11pt; font-weight: bold'>" + document.title + "</P>";
	printContent += stripContenter.innerHTML;
	printContent += '<P align="center"><IMG SRC="/images/logos/print_logo.gif" WIDTH="454" HEIGHT="37" BORDER=0 ALT=""></P>';
	winT = window.open("/vorlagen/print.php", "Voransicht", "width=700,height=500,scrollbars=yes");
	winT.focus();
}

function readyPrint(){

	winT.document.getElementById('corpus').innerHTML = printContent;
	stripContent = winT.document.getElementById('corpus').getElementsByTagName("td");
	for(i = 0; i < stripContent.length; i++){
		if(stripContent[i].style.backgroundColor){
			stripContent[i].style.backgroundColor = "#FFFFFF";
		}
	}
	/*linkContent = winT.document.getElementById('corpus').getElementsByTagName("a");
	for(i = 0; i < linkContent.length; i++){
		if(!linkContent[i].className && linkContent[i].href.indexOf("#") < 0){
			linkContent[i].innerHTML = linkContent[i].innerHTML + "<span style=' font-size: 7pt'> (s. a.: " + linkContent[i].href + ") </span>";
		}
	}*/
		
	winT.print();
}

function registerClick(tObj, sObj){
  getref(tObj).onmousedown = move;
  getref(tObj).toMove = getref(sObj);
  getref(tObj).onclick = new Function('return false;');
}


function move(evt){
if(document.all){
	xPos = window.event.clientX;
	yPos = window.event.clientY;
	
}else{
	xPos = evt.pageX;
	yPos = evt.pageY;
}
moveobjTo(this.toMove, xPos, yPos);
zeig(this.toMove);
}

var win
function openWindow(urlT, fWidth, fHeight){

	if(!win || win.closed){
		win = eval('window.open("' + urlT + '", "Beispiele", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width=' + fWidth + ',height=' + fHeight + '")'); 
	}else{
		win.location.href = urlT;
		win.resizeTo(fWidth, fHeight + 30);
		win.focus();
	}

}

var imgwin;
function img_open(imgurl){

	if(!imgwin || imgwin.closed){
	
		imgwin = window.open("/de/image.php?imgurl=" + imgurl, "Bild", "width=450,height=300,resizable=yes,scrollbars=no,menubar=no,statusbar=no");
	
	}else{

		imgwin.location.href = "/de/image.php?imgurl=" + imgurl;
		
		imgwin.focus();
	
	}

}



