if(document.all && !document.getElementById) {
    document.getElementById = function(id) {
      return document.all[id];
    }
}

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//changes the visibility style of the span element on the Knoten-pages
showName = function() {
	
	var array = document.getElementById("layout-main-body").getElementsByTagName("li");
	
	
	for (var i=0; i<array.length; i++) {
		array[i].onmouseover=function() {
	
	this.getElementsByTagName("p")[0].style.visibility='visible';
		
		}
		array[i].onmouseout=function() {
	this.getElementsByTagName("p")[0].style.visibility='hidden';
		}
	}
}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

// toggles two images used on a checkbox checked>unchecked
var a_menu_items = new Array(1);

function changeimage(number)
{
if (document.images && g_bPreloadFlag)
{
imgName = 'menu' + number;
feld = 'feld' + number;
// loop through the menu items array
for ( i = 0; i < (a_menu_items.length ); i++ )
{
if ( number == i )
{
//pick the opposite state currently in the value
state = ( a_menu_items[i] == 0 )? 1 : 0;
// after assigning, switch the value to its opposite
( a_menu_items[i] == 0 )? a_menu_items[i] = 1 : a_menu_items[i] = 0;
break;
}
}
document.images[imgName].src = g_aMenu[0][state].src;
(state == 0)? document.all[feld].value='0':document.all[feld].value='1';// Andis hidden fields

}
}

var g_bPreloadFlag = false;
var g_aMenu = new Array(); 
function preloadimages()
{
if (document.images)
{
var aOffOn = new Array(1);
g_aMenu[0] = aOffOn;
g_aMenu[0][0] = new Image();
g_aMenu[0][0].src = '/images/box-no.gif';
g_aMenu[0][1] = new Image();
g_aMenu[0][1].src = '/images/box-yes.gif';
g_bPreloadFlag = true;
}
} 
function init(){
preloadimages();

}
//**************************************************************************/
function addEvents(id,tag) {
    var selector = document.getElementById(id);
    var items = selector.getElementsByTagName(tag);
    for (var i=0; i < items.length; i++) {
        var link = items[i];
        link.number = 'l' + i;
        link.onmouseover = showLocation;
       link.onmouseout = hideLocations;
    }
}

function showLocation() {
    hideLocations();
    var location = document.getElementById(this.number);
    location.style.display = 'block';
}

function hideLocations() {
    var items = document.getElementById('locations').getElementsByTagName('p');
    for (var i=0; i < items.length; i++) {
        var location = items[i];
        location.style.display = 'none';
    }
}
/**************************************************************************/
function changeIQBackground(){
	
	var rand= Math.ceil(Math.random()*6);
		
//	var c_array= new Array('#aec200','#06a3cb','#000000','#e20916','#32992b','#671464','#edce00');
	var top=document.getElementById('layout-body').getElementsByTagName('div');
	var iq = document.getElementById('layout-iq-system');

	var bottom=document.getElementById('layout-body-bottom');
	var body=document.getElementById('layout-body');
	
	var top_img='/images/iq-bg/layout-corners-main-top-'+ rand+ '.gif';
	var iq_img='/images/iq-bg/iq-bg-'+ rand+'.gif';

	var bottom_img='/images/iq-bg/layout-corners-main-bottom-'+ rand+ '.gif';
	var body_img='/images/iq-bg/layout-body-'+ rand+'.gif';
	top[0].style.background = 'transparent url('+top_img+') left top  no-repeat';
	iq.style.background = 'transparent url('+iq_img+') left top  no-repeat';
	body.style.background = 'transparent url('+body_img+') repeat-y';
	bottom.style.background = 'transparent url('+bottom_img+') left top no-repeat';
}

// open window    ******************************************************************************//

function openWindow(theURL,winName,features) {
   win=window.open(theURL,winName,features);
   win.focus();
}
// toggleTeaser(sting1,string2...)   *****************************************************************//
// preloads and toogles images on mouseover in id ='teamlist'
// param string1		path to onOut image 
// param string2		path to onOver image 
//
//
function toggleImages(){
	var c=toggleImages.arguments;
	var out=new Array();
	var over=new Array();
	var img_list=document.getElementById("teamlist").getElementsByTagName('img');
	for(i=0; i<c.length; i++){
		var img=new Image();
		img.src=c[i];
		if(i%2==0){
			out.push(img);
		}else{
			over.push(img);
		}
	}
	for(var i=0; i<img_list.length; i++){
	teaser=img_list[i];
	teaser.myi=i;
		teaser.onmouseover=function() {
			this.src=over[this.myi].src;
		}
		teaser.onmouseout=function() {
			this.src=out[this.myi].src;
		}
	}
}
