var version = "n3";
   function sover(id)
   {
   	if (! document.getElementById(id).className)
	    document.getElementById(id).style.backgroundColor='#dddddd';
   }
   function sout(id)
   {
   	if (! document.getElementById(id).className)
	   document.getElementById(id).style.backgroundColor='white';
   }

function getElementsByClassName(className, tag, elm){
	var testClass = new RegExp("(^|\\s)" + className + "(\\s|$)");
	var tag = tag || "*";
	var elm = elm || document;
	var elements = (tag == "*" && elm.all)? elm.all : elm.getElementsByTagName(tag);
	var returnElements = [];
	var current;
	var length = elements.length;
	for(var i=0; i<length; i++){
		current = elements[i];
		if(testClass.test(current.className)){
			returnElements.push(current);
		}	
	}
	return returnElements;
	
}
var expanded = false;
function expandColapse(mode) {
	menu1 = getElementsByClassName("level1","li", document.getElementById('top_menu'));
	menu2 =(menu1[0].getElementsByTagName('ul'));
	if (menu2[0].style.display != "") {	
		if (menu2[0].style.display == 'none') {
			mode = "expand";
		} else {
			mode= "colapse";
		}
	}
	document.getElementById('expand-image').src = 'fileadmin/images/'+mode+'.gif';
	for(i=0;i<menu1.length;i++) {
		menu2 =(menu1[i].getElementsByTagName('ul'));
		if (mode == "expand") {
			menu2[0].style.display = 'block';
			menu2[0].style.position = 'relative';
			menu2[0].style.top = '0px';
			menu2[0].style.left = '0px';
			expanded = true;
		} else {
			menu2[0].style.display = 'none';
			menu2[0].style.position = 'absolute';
			menu2[0].style.top = '40px';
			menu2[0].style.left = '2px';
			expanded = false;
		}
	}
}

function enableMenu(menu) {
	menu.firstChild.nextSibling.style.display="block";
}

function hideMenu(menu) {
	if ( menu.firstChild.nextSibling.style.position!="relative" && expanded==false)
		 menu.firstChild.nextSibling.style.display="none";
}


                           function setText(a, b)
                             {

//                          alert(a +"|"+b);
                                 x = document.getElementById(a);
                                 if (x) {
                                        x.innerHTML = b.options[b.selectedIndex].value;
                                        if (! x.innerHTML) {
                                                if (a=="text1") x.innerHTML = "'.htmlspecialchars($this->pi_getLL('sport')).'"
                                                if (a=="text2") x.innerHTML = "'.htmlspecialchars($this->pi_getLL('name')).'"
                                                if (a=="text3") x.innerHTML = "'.htmlspecialchars($this->pi_getLL('nation')).'"
                                                if (a=="text4") x.innerHTML = "'.htmlspecialchars($this->pi_getLL('sex')).'"
                                        }
                                }
                             }

function resizeFlashHeader(hght) {
	//alert(hght);

	flash = document.getElementById('flash_header');
	//alert(flash.style.height);
	if (hght == 0) {
		if (flash.firstChild.height == '306') flash.style.height = '237px';
		if (flash.firstChild.height == '305') flash.style.height = '237px';
	} else {
		flash.style.height = hght+"px";
	}

	//alert(flash.style.height);
	//alert(height +' '+flash.style.height);
	//alert( flash.style.heigth);
	//alert(flash.style.marginBottom);
	//flash.style.marginBottom = "0px";
	//if (height == 237) flash.style.marginBottom = "-63px";
	//alert(flash.style.marginBottom);
	//alert(document.getElementById('flash_header').firstChild.heigh);
	//document.getElementById('flash_header').firstChild.height = height + 64;
	//alert(document.getElementById('flash_header').firstChild.heigh);
}


function getElementsByClassName(className, tag, elm){
	var testClass = new RegExp("(^|\\s)" + className + "(\\s|$)");
	var tag = tag || "*";
	var elm = elm || document;
	var elements = (tag == "*" && elm.all)? elm.all : elm.getElementsByTagName(tag);
	var returnElements = [];
	var current;
	var length = elements.length;
	for(var i=0; i<length; i++){
		current = elements[i];
		if(testClass.test(current.className)){
			returnElements.push(current);
		}
	}
	return returnElements;
}

function enableImageEnlarge() {
	enlargeElements = getElementsByClassName('imageEnlarge');
//alert(enlargeElements);
}


//enableImageEnlarge();

function shiftMonths(shift) {
	var m_names = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
	
	months = document.getElementById('month_selector');
	if (shift == -1){
		month--;
		if (month < 0) {
		    //Im Januar kommt das vor
			month = 11;
			year--;
		} else if (month == 0) {
			month = 12;
			year--;
		}
		selected = '';
		if (month == inputMonth && year==inputYear) selected = 'class="selected" ';

		months.removeChild(months.lastChild);
		months.innerHTML = '<a href="index.php?id='+pageId+"&month="+month+"&year="+year+"\" "+selected+" >"+m_names[month-1]+"&nbsp;"+year+"</a>"+months.innerHTML;
		months.lastChild.className+=" noborder";
	}
	else {
		months.removeChild(months.firstChild);
                month++;
                if (month == 13) {
                        month = 1;
                        year++;
                }
		addMonth = month + 3;
		addYear = year;
		if (addMonth > 12) {
			addMonth = addMonth%12;
			addYear++;
		}
		selected = '';
//		alert(month +'|'+ inputMonth +'|'+  year+'|'+ inputYear);
		if (addMonth == inputMonth && addYear==inputYear) selected = 'selected';
		if (addMonth-1 == inputMonth && addYear==inputYear)
			months.lastChild.className="selected";
		else months.lastChild.className = "";
//alert(selected);
                months.innerHTML += '<a href="index.php?id='+pageId+"&month="+addMonth+"&year="+addYear+"\"  class=\"noborder "+selected+"\" >"+m_names[addMonth-1]+"&nbsp;"+addYear+"</a>";
	}
 
}


function updateOptions(select)
{
	var box = document.getElementById("continent");
	var id = box.options[box.selectedIndex].value;
	if (!id) return;
	var list = continent[convert[id]];
//alert(number);
	var box2 = document.getElementById("countries");
	box2.options.length = 0;
	for(i=0;i<list.length-1;i+=2)
	{
		box2.options[i/2] = new Option(list[i],list[i+1]);
	}
}

function bolderize(athid) {
	athList = document.getElementById('ath_List');
	ath = athList.firstChild;
	ath.style.fontWeight = 'normal';
	while (ath.nextSibling) {
		ath.style.fontWeight = 'normal';
		ath = ath.nextSibling;
	}
	document.getElementById(athid).style.fontWeight = 'bold';
}

function selectAthletes(group) {
//alert(eval("ath"+group));
	document.getElementById("ath_List").innerHTML = eval("ath"+group);
}

function getPos () {
	MyOffsetTop = document.getElementById('bottom_menu').offsetTop;
	MyOffsetHeight = document.getElementById('bottom_menu').offsetHeight;
	MyWindowHeight = window.innerHeight;
	if (!MyWindowHeight > 0) MyWindowHeight = document.documentElement.clientHeight;
	
	//alert (MyWindowHeight );

	// wenn der Footer noch nicht ganz unten liegt
	//if (MyOffsetTop - MyOffsetHeight < MyWindowHeight) {
	if (false) {
		differenz = MyWindowHeight - MyOffsetTop - MyOffsetHeight;
		
		// Pack ihn einfach weiter runter....
		document.getElementById('bottom_menu').style.position = 'relative';
		document.getElementById('bottom_menu').style.top = differenz+'px';
	}
  
}




