function IEHoverPseudo() {
 
	var navItems = document.getElementById("nav").getElementsByTagName("li");
	
	for (var i=0; i<navItems.length; i++) {
		if(navItems[i].className == "menuparent") {
			navItems[i].onmouseover=function() { this.className += " over"; }
			navItems[i].onmouseout=function() { this.className = "menuparent"; }
		}
		else if(navItems[i].className == "menu") {
			navItems[i].onmouseover=function() { this.className += " over"; }
			navItems[i].onmouseout=function() { this.className = "menu"; }
		}

	}
 
}
window.onload = IEHoverPseudo;

var $j = jQuery.noConflict(); 

/* Newsteaser */

function activate_teaser(obj) {
	  
	  var inactiveClassName = 'TeaserSmall';
	  var activeClassName = 'TeaserBig';
	  
	  if(obj.className == activeClassName)
	    return;
	    
	  var allElems = obj.parentNode.childNodes;
	  obj.className = activeClassName;
	  
	  for(var i=0; i<allElems.length; i++) {
	    
	    if( allElems[i] !=  obj && allElems[i].className == activeClassName) {
	      allElems[i].className = inactiveClassName;
	    }
	  
	  }
	  
	}

// 1. Teasereintrag aktivieren
function activate_first_teaser()
{
	var teaser = $j("div.TeaserRollover");
	//console.log(teaser);
	//console.log(teaser.children()[0]);
	activate_teaser(teaser.children()[0]);
}

/* Pinwand MA 30.12.2009 */
/*
function PinwandScroller(id, speed, delay)
{
	this._width=700; //parseInt($j('#Lheader-pinwand').css('width')); //700;
	this._height=35;//parseInt($j('#Lheader-pinwand').css('height')); //35;
	this._speed=speed;
	this._delay=delay;
	this._id=id;
	this.pause=false;
	// this.isMouseOver=false;
	
	this.scroller = $j('#' + this._id);
	this.scroller.css('position','relative');
	this.scroller.css('overflow','hidden');
	this.scroller.wrapInner('<div id="' + this._id + '_inner"></div>');

	//$j('#scroll-pinwand').css('height','100%');

	this.inner = $j('#' + this._id + '_inner');
	this.inner.css('position','absolute');
	this.inner.css('left', this._width + "px");
	this.inner.css('top', this._height + "px");				
	this.inner.css('left', "0px");
	this.inner.css('width', this._width + "px");
	this.limit = $j('div.pinwanditem').length * this._height;
	
	this.ScrollHelper = function() {
		nextTick = this._speed;

		if (!this.pause || this.pause == false)
		{
			if (parseInt(this.inner.css('top')) <= -this.limit)
			{
				this.inner.css('top',this._height+"px");
			}
			else
			{
				this.inner.css('top', (parseInt(this.inner.css('top'))-1) + "px");
			}
			
			// *** Bigger delay on item found
			// Skips borders to make transition without delays on loop
			if (!(parseInt(this.inner.css('top')) == this._height) &&
				!(parseInt(this.inner.css('top')) == -this.limit) &&
				(parseInt(this.inner.css('top')) % this._height) == 0)
			{
				nextTick = this._delay;
			}	
		}
		
		// *** Tick!
		{  
			var _me=this; 
			setTimeout( function(){ _me.ScrollHelper()}, nextTick, _me );  
		}
	};
	
	this.ShowContent = function (id) {
		$j('div.pinwandheader').hide();
		this.top = this.inner.css('top');
		this.inner.css('top',0);
		this.inner.css('position','relative');
		//$j('#scroll-pinwand').css('height','100%');
	
		var item = $j('#c'+id);
		//item.css('height',this._height+'px');
		item.css('height','100%');
		item.show();

/*
		item.animate({ 
      		height: "300px"
		}, 1500, "linear",
		function ()
		{
			$j("#_MO").removeClass("on");
		});	*** /		
	}

	this.HideContent = function (id) {

		this.inner.css('top', this.top);
		this.inner.css('position', 'absolute');	
		
		var item = $j('#c'+id);
		//$j('#scroll-pinwand').css('height',this._height+"px");
		//item.css('height', this._height+"px");
		item.hide();
		$j('div.pinwandheader').show();

/*		
		item.animate({ 
      		height: this._height+"px"
		}, 1500, "linear",
		function () {
			console.log(this.id, $j('#'+this.id).css('height'));
			$j('#scroll-pinwand').css('height',$j('#'+this.id).css('height'));
			item.hide();			
			$j('div.pinwandheader').show();
			console.log('xxx');
		});	*** /	
	}
    
	this.MouseOver = function(thisObj,id) {
		//console.log('over',id);
		//***$j("#_MO").addClass("on");
		//console.log($j("#_MO").hasClass("on"));
		
		thisObj.pause=true;			
		this.ShowContent(id);
	}
	
	this.MouseOut = function(thisObj,id) {		
		//console.log('out',id, $j("#_MO").hasClass("on"));
		
		//*** if ($j("#_MO").hasClass("on")) return;
		
		thisObj.pause = false;
		this.HideContent(id);
	}
	
	// Eventhandler Mouseover/out anbinden
	//$('#Lheader-pinwand').mouseover(this.MouseOver(this)).mouseout(this.MouseOut(this));
	//$('#Lheader-pinwand').mouseover(alert('x'));
	//$('div#Lheader-pinwand').mouseenter(console.log('x'));
	//this.scroller.mouseenter(console.log('y'));
	//this.scroller.mouseleave(console.log('z'));
	//$('div.feldueberschrift').mouseenter(console.log('x'));

	// Execute
	{  
		var _me=this; 
		setTimeout( function(){ _me.ScrollHelper()}, this._speed, _me );  
	}
}
*/

/* Pinwand ohne Scrollen MA 07.02.2010 */

function Pinwand(id, delay)
{
	var _me=this; 
	
	//console.log(id,delay);
	
	this.delay = delay;
	this.pwarea = $j('#Lheader-pinwand');
	this.item = $j('#'+id);
	this.tmp = this.item.children("div.pinwanditem");
	this.header = this.item.children("div.pinwanditem").children("div.pinwandheader");
	this.content = this.item.children("div.pinwanditem").children("div.pinwandcontent");

	this.pwarea.css('height','100%');

	this.ShowContent = function() {
		//console.log(_me.isMouseOver);
		if (_me.isMouseOver)
		{
			var item = _me.content;
			item.animate({
				height: "show"
			}, 1000, "linear");			
		}
	}

	this.HideContent = function() {
		if (!_me.isMouseOver)
		{
			var item = _me.content;
			item.animate({
				height: "hide"
			}, 1000, "linear");
		}
	}
	
	this.Close = function() {
		var item = _me.content;
		item.hide();
	}
	
	MouseEnter =  function() {
		//console.log("enter", this, _me.delay);
		_me.isMouseOver = true;		
		setTimeout( function(){ _me.ShowContent() }, _me.delay, _me );  
	}

	MouseOut = function() {
		//console.log("leave", this);
		_me.isMouseOver = false;
		setTimeout( function(){ _me.HideContent() }, _me.delay, _me );  
    }
	
    
    this.pwarea.mouseover(MouseEnter);
    
    
    //this.header.mouseenter(MouseEnter);
    //this.content.mouseenter(MouseEnter);
    this.pwarea.mouseout(MouseOut);
    //this.header.mouseout(MouseOut);
    //this.content.mouseout(MouseOut);

    /*
    this.pwarea.mouseenter(function(){console.log("e",this);});
    this.tmp.mouseenter(function(){console.log("e",this);});
    this.header.mouseenter(function(){console.log("e",this);});
    this.content.mouseenter(function(){console.log("e",this);});

    this.pwarea.mouseout(function(){console.log("l",this);});
    this.tmp.mouseout(function(){console.log("l",this);});
    this.header.mouseout(function(){console.log("l",this);});
    this.content.mouseout(function(){console.log("l",this);});

    this.pwarea.mouseover(function(){console.log("*",this);});
    this.tmp.mouseover(function(){console.log("*",this);});
    this.header.mouseover(function(){console.log("*",this);});
    this.content.mouseover(function(){console.log("*",this);});*/

}

/* News-Scroller MA 30.12.2009 */

function NewsScroller(id, speed, delay)
{
	this._width=parseInt($j('#Lheader-weltnachrichten').css('width')); 
	this._height=parseInt($j('#Lheader-weltnachrichten').css('height'));
	this._speed=speed;
	this._delay=delay;
	this._id=id;
	this.pause=false;
	
	this.scroller = $j('#' + this._id);
	var items = $j('div.tx-feedforward-pi1').html();
	this.scroller.html(items);
	this.scroller.css('position','relative');
	this.scroller.css('overflow','hidden');
	this.scroller.wrapInner('<div id="' + this._id + '_inner"></div>');	
	this.inner = $j('#' + this._id + '_inner');
	this.inner.css('position','absolute');
	this.inner.css('left', this._width + "px");
	this.inner.css('top', this._height + "px");				
	this.inner.css('left', "0px");
	this.inner.css('width', this._width + "px");
	this.limit = $j('div.newsitem').length * this._height;

	this.ScrollHelper = function() {
		nextTick = this._speed;

		if (!this.pause || this.pause == false)
		{
			if (parseInt(this.inner.css('top')) <= -this.limit)
			{
				this.inner.css('top',this._height+"px");
			}
			else
			{
				this.inner.css('top', (parseInt(this.inner.css('top'))-1) + "px");
			}
			
			// *** Bigger delay on item found
			// Skips borders to make transition without delays on loop
			if (!(parseInt(this.inner.css('top')) == this._height) &&
				!(parseInt(this.inner.css('top')) == -this.limit) &&
				(parseInt(this.inner.css('top')) % this._height) == 0)
			{
				nextTick = this._delay;
			}	
		}
		
		// *** Tick!
		{  
			var _me=this; 
			setTimeout( function(){ _me.ScrollHelper()}, nextTick, _me );  
		}
	};
    
	this.MouseOver = function(thisObj) {
		thisObj.pause=true;
	}
	
	this.MouseOut = function(thisObj) {
		thisObj.pause=false;
	}

	// Execute
	{  
		var _me=this; 
		setTimeout( function(){ _me.ScrollHelper()}, this._speed, _me );  
	}
}

/* Tab-Effekt MA 14.02.2010 */

function InitTabs(id,width)
{
	this.HideAll = function() {
		this.links.children().removeClass("selected");
		this.content.children().hide();	
	}
	
	this.ShowTab = function(id) {
		this.HideAll();
		this.links.children("#tab-link-"+id).addClass("selected");
		this.content.children("#tab-content-"+id).show();
	}

	this.tabs = $j('#' + id);
	this.tabs.css("width", width);
	
	this.links = this.tabs.children("#tab-links");
	this.content = this.tabs.children("#tab-content");
	//this.links.children().click(this.ClickTab());
	var _me=this;
	this.links.children().click(function() {
				var tabId = this.id;
				tabId = tabId.replace(/tab-link-/g, "");
				_me.ShowTab(tabId);
		    }); 
	
	// MA 14.04.2010 zufälligen Tab aktivieren
	var nr = Math.floor(Math.random()*(this.links.children().length));
	var firstTab = this.links.children()[nr].id;
	firstTab = firstTab.replace(/tab-link-/g, "");

	// Content ausblenden
	this.HideAll();
	// ersten Tab einblenden
	this.ShowTab(firstTab);
}

