
//Browser & Skriptmodell feststellen
var moz = (document.getElementById && !window.opera && !document.all)?1:0;
var ie6 = (document.getElementById && document.all)?1:0;
var ie = (document.all && !ie6)?1:0;
var nn4 = (document.layers)?1:0;
var opVer = navigator.userAgent.split("Opera");
opVer = parseFloat(opVer[opVer.length-1]);
var opMajor = (window.opera && opVer >= 5.1)?1:0;
var opMinor = (window.opera && opVer < 5.1)?1:0;

if(opMinor || nn4 || ((document.all && !document.getElementById) && navigator.appVersion.indexOf('MSIE 4')) )
                      document.location.href = 'wrongbrowser.php';
//gegen framesets
if( window.top != window ) window.top.location = window.location;

//bildchen für impressum-layer
var hlxImg = new Image;
hlxImg.src = 'techPics/x_hl.gif';
var xImg = new Image;
xImg.src = 'techPics/x.gif';



var GONF_INC = 16;
var GONF_DEC = 8;
var GONF_MAX_WIDTH = 109;
var GONF_MIN_WIDTH = 44;
var GONF_RET = 1; //millisec (min=1!)

var runningObjects = new Array();








function gonflerClass(obj, inc)
{
	var self = this;	
	this.obj = obj;
	this.bInc = inc;
  this.restart = function ()
  {
   	if(!this.bGonfIsRunning)
		{
			this.gonfInterval = window.setInterval(function(){ self.gonflerImg(); }, GONF_RET);
			this.bGonfIsRunning = true;
		}  
  };
	this.gonfInterval = window.setInterval(function(){ self.gonflerImg(); }, GONF_RET);
	this.bGonfIsRunning = true;
	
	this.gonflerImg = function()
	{	
		var i=0;
		while(this.obj.childNodes[i])
		{
			var o = this.obj.childNodes[i];
			// ie doesn't understand .getAttribute('class'), 
			// thus we need the 'name' - attribute
		 	if(o.name && o.name == 'linkPic')
			{
				var ostyle = o.style;
				//is there nothing? init with attribute value
				if(ostyle.width == '')
				 	ostyle.width = o.width.toString() + 'px';
	
				//compute new width, and test
				var width = parseInt(ostyle.width) + ((this.bInc)?GONF_INC:-GONF_DEC);	
				if(width>GONF_MAX_WIDTH || width<GONF_MIN_WIDTH)
				{
					// stop everything
					window.clearInterval(this.gonfInterval);
					this.bGonfIsRunning = false;
					self.switchText();
					return;
				}else{
					// apply new width
					ostyle.width = width + 'px';
				}
				//debug purpose
				//var t = document.createTextNode("+"+parseInt(obj.childNodes[i].style.width).toString());
	    	//document.getElementsByTagName("body")[0].firstChild.appendData(t.nodeValue);
		 	}
		 	i++;
		}		
	};
	
	this.switchText = function()
	{
		var j=0;
		while(this.obj.childNodes[j])
		{
			var o = this.obj.childNodes[j];
			if(o.nodeType!=1)//skip nodes that are not elements (e.g. text nodes)
			{
				j++;
				continue;
			}
			var nom = o.getAttribute('name');
			if(this.bInc)
			{
				//show _all_ elements
				if(nom && (nom == 'linkHeader' || nom == 'linkText'))
				{
					o.style.display = 'block';
				}
				else
				{
					o.style.display = 'inline';
				}
			}else{
				//hide text
				if(nom && nom == 'linkText')
				{
					o.style.display = 'none';
				}
			}
			j++;
		}
	};
}



function gonfler(obj, bGonfler)
{
	for(var i=0; i<runningObjects.length; i++)
	{
		if(runningObjects[i].obj == obj)
		{
			if(runningObjects[i].bInc == bGonfler)
			{
				return;
			}else{
				// change direction, let run
				runningObjects[i].bInc = bGonfler;
				runningObjects[i].restart();
				return;
			}			
		}
	}
	runningObjects.unshift(new gonflerClass(obj, bGonfler))
}



function showObject(id){
    document.getElementById(id).style.visibility = 'visible';
}

function hideObject(id){
    document.getElementById(id).style.visibility = 'hidden';
}

function hlight_x(id){
  if(ie6 || moz){
     document.getElementById(id).style.backgroundImage = 'url(\''+hlxImg.src+'\')';
  }
}
function restore_x(id){
  if(ie6 || moz){
     document.getElementById(id).style.backgroundImage = 'url(\''+xImg.src+'\')';
  }
}






