/*
// File written by Jochen "Khuri" Höhmann <khuri@khuris.com>
// Copyright 2010
//
// File        : main.js
// Begin       : 2008.07.07 13:27:13
// Last Update : 2010.02.15 14:53:53
*/

/* Make mails valid links */
function convert_mail(mail) {
	window.location.href="mailto:"+decodeURIComponent(mail);
}

/* clear the searchbox */
function clearsearch(who) {
	if(searchclear != 1) {
		who.className = 'textbox';
		who.value = '';
	}
	var searchclear=1;
}

function chart_switch(chart,thecaller) {
	charts = document.getElementsByTagName('div');
	chartsul = null;
	for(var i=0;i<charts.length;i++) {
		if(charts[i].className == 'chart_block') {
			charts[i].style.visibility = (charts[i].id == 'chart'+chart) ? 'visible' : 'hidden';
			charts[i].style.display = (charts[i].id == 'chart'+chart) ? 'block' : 'none';
		}
	}
	chartsul = thecaller.parentNode;
	for(var i=0;i<chartsul.childNodes.length;i++) {
		if(chartsul.childNodes[i].tagName == 'LI') {
			chartsul.childNodes[i].className='';
		}
	}
	thecaller.className='link_selected';
}

function switchmap(who,how) {
	if(document.getElementsByName(who)[0] || document.getElementById(who)) {
		for(i=0;i<document.getElementsByName(who).length;i++) {
			document.getElementsByName(who)[i].style.visibility = (how == 1) ? 'visible' : 'hidden';
		}
		if(document.getElementById(who)) {
			document.getElementById(who).style.visibility = (how == 1) ? 'visible' : 'hidden';
		}
		if(document.getElementById('mapspecial_'+who)) {
			document.getElementById('mapspecial_'+who).className = (how == 1) ? 'link_selected' : '';
			if(is_nav || (is_ie && ie_version >= 8.0)) {
				document.getElementById('mapspecial_'+who).setAttribute("onclick","switchmap('"+who+"',"+((how == 1)? 2 : 1)+");");
			}
			else {
				document.getElementById('mapspecial_'+who).setAttribute("onclick",function(){switchmap('\''+who+'\'',((how == 1)? 2 : 1))});
			}
		}
	}
}