function getBgImg(obj) {
	return obj.style.backgroundImage.split('(')[1].split(')')[0];
}

function setBgImg(obj, img) {
	obj.style.backgroundImage = 'url("'+img+'")';
}

function setBgPosition(obj, y) {
	obj.style.backgroundPosition = '32px '+y+'px';
}

function setColor(obj, col) {
	obj.style.color = col;
}

function getColor(obj) {
	return obj.style.color;
}

var popupActive = false;
var aktPopup = null;

function flagge_grau(obj) {
	obj.oldBgImg = getBgImg(obj);
	newBgImg = getBgImg(obj).substring(0, getBgImg(obj).lastIndexOf('_')+1)+'0.gif';
	setBgImg(obj, newBgImg);
}

function flagge_bunt(obj) {
	if (typeof(obj.oldBgImg)!='undefined')
		setBgImg(obj, obj.oldBgImg);
}

function punkt_grau(obj) {
	obj.className = 'grau';
}

function punkt_bunt(obj) {
	obj.className = 'blau';
}

function country_mouseover(nr) {
	return;
	if (!popupActive) {
		getEl('laender').className = 'active';
		var laenderLi = getEl('laender').getElementsByTagName('li');
		for (i=0; i<laenderLi.length; i++) {
			if (i!=nr) {
				obj = laenderLi[i].firstChild;
				flagge_grau(obj);
			}
			if (i!=nr) {
				try {
					punkt_grau(getEl('point_'+i).firstChild.firstChild);
				} catch(e) {}
			}
		}
		setBgPosition(getEl('laender'), 25*nr-328);
	}
}

function country_mouseout(nr) {
	return;
	if (!popupActive) {
		getEl('laender').className = '';
	
		var laenderLi = getEl('laender').getElementsByTagName('li');
		for (i=0; i<laenderLi.length; i++) {
			obj = laenderLi[i].firstChild;
			flagge_bunt(obj);
			try {
				punkt_bunt(getEl('point_'+i).firstChild.firstChild);
			} catch(e) {}
		}
	}
}

function country_click(nr) {
	return false;
	getEl('popup_'+nr).style.display = 'block';
	aktPopup = nr;
	popupActive = true;
	return false;
}

function close_popup() {
	popupActive = false;
	getEl('popup_'+aktPopup).style.display = 'none';
	country_mouseout(aktPopup);
	return false;
}





























var countryArr = new Array(
	'aut',
	'rus',
	'chi',
	'can',
	'ned',
	'cze',
	'swe',
	'ind',
	'usa',
	'pol',
	'ger',
	'swi',
	'jp',
	'mex',
	'bra',
	'hun',
	'esp',
	'kor',
	'tur',
	'aus',
	'ita',
	'uk',
	'afr',
	'fra',
	'bel',
	'rom'
);

var karteGrau = new Image(); karteGrau.src = '/media/_administration/images/globalpage/laender/karte_grau.gif';
var karteBlau = new Image(); karteBlau.src = '/media/_administration/images/globalpage/laender/karte_blau.gif';

var activeCountryPopup = 'worldwide';
var tmpCountry = '';
var countriesEnabled = true;
var activeCountry = '';

function disableKarte() {
	try {
		getEl('kartenImg').src = karteGrau.src;
	} catch(e) {}
}


function enableKarte() {
	try {
		getEl('kartenImg').src = karteBlau.src;
	} catch(e) {}
}

function disableCountry(country) {
	try {
		getEl('country_'+country).style.backgroundImage = 'url(/media/_administration/images/globalpage/laender/flags/'+country+'_0.gif)';
		getEl('country_'+country).style.color = '#a5a5a5';
		getEl('pointImg_'+country).className = 'point_grau';
		activeCountry = '';
	} catch(e) {}
}

function enableCountry(country) {
	try {
		getEl('country_'+country).style.backgroundImage = 'url(/media/_administration/images/globalpage/laender/flags/'+country+'_1.gif)';
		getEl('country_'+country).style.color = '#00457e';
		getEl('pointImg_'+country).className = 'point_blau';
		activeCountry = country;
	} catch(e) {}
}

function disableAllCountries() {
	if(countriesEnabled) {
		for (i=0; i<countryArr.length; i++)
			disableCountry(countryArr[i]);
		disableKarte();
		countriesEnabled = false;
	}
}

function enableAllCountries() {
	if (!countriesEnabled) {
		for (i=0; i<countryArr.length; i++)
			enableCountry(countryArr[i]);
		enableKarte();
		countriesEnabled = true;
	}
}

function country_mouseover(country) {
	if (!countryIsActivated()) {
		enableCountry(country);
	} else {
		if (country!=activeCountryPopup) {
			enableCountry(country);
			tmpCountry = country;
		}
	}
}

function country_mouseout() {
	if (!countryIsActivated()) {
		disableCountry(activeCountry);
	}	else {
		if (tmpCountry==activeCountryPopup) tmpCountry='';
		if (tmpCountry!='') {
			disableCountry(tmpCountry);
			activeCountry = activeCountryPopup;
			tmpCountry = '';
		}
	}
}

function activateCountry(country) {
	try {
		getEl('popup_'+activeCountryPopup).style.display = 'none';
		getEl('popup_'+country).style.display = 'block';
		activeCountryPopup = country;
	} catch(e) {}
}

function deactivateCountry() {
	try {
		getEl('popup_'+activeCountryPopup).style.display = 'none';
		getEl('popup_worldwide').style.display = 'block';
		activeCountryPopup = 'worldwide';
	} catch(e) {}
}

function country_click(country) {
	if (!countryIsActivated()) {
		disableAllCountries();
		activateCountry(country);
	} else if (activeCountryPopup==country) {
		deactivateCountry();  
		//enableAllCountries();
	} else {
		disableCountry(activeCountryPopup);
		deactivateCountry();
		//disableAllCountries();
		enableCountry(country);
		activateCountry(country);
	}

	return false;
}

function countryIsActivated() {
	if (activeCountryPopup=='worldwide')
		return false;
	return true;
}

function liste_mouseout() {
	if (!countryIsActivated())
		enableAllCountries();
}

function liste_mouseover() {
	if (!countryIsActivated())
		disableAllCountries();
}
