var locked_country = '';
var op = 'block';
var showAll = false;


function show(country){
	if(locked_country != country && locked_country != ''){
		if(document.getElementById('countryInfoBox')){
	    	removeElement('countryInfoBox');
		}
		
	    var parentDiv = document.getElementById(locked_country);
	    parentDiv.getElementsByTagName('img')[0].src = '../trndmntr/images/icons/spacer.gif';
	}
	
	switchCountry(country);	
}

function switchCountry(country){
	if(document.getElementById('countryInfoBox')){
    	removeElement('countryInfoBox');
	}
	
	switch (country) {
		case 'indonesien':
            document.indonesien.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Indonesien');
            break;
        case 'brasilien':
            document.brasilien.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Brasilien');
            break;
      	case 'neuseeland':
            document.neuseeland.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Neuseeland');
            break;
       case 'malaysia':
            document.malaysia.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Malaysia');
            break;
		case 'russland':
            document.russland.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Russland');
            break;
		case 'china':
            document.china.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'China');
            break;
		case 'japan':
            document.japan.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Japan');
            break;
		case 'mexiko':
            document.mexiko.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Mexiko');
            break;
        case 'europa':
            document.europa.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Europa');
            break;
        case 'usa':
            document.usa.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'USA');
            break;
        case 'suedafrika':
            document.suedafrika.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Südafrika');
            break;
        case 'australien':
            document.australien.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Australien');
            break;
        case 'kanada':
            document.kanada.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Kanada');
            break;
		case 'chile':
            document.chile.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Chile');
            break;
        case 'argentinien':
            document.argentinien.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Argentinien');
            break;
        case 'indien':
            document.indien.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Indien');
            break;
        case 'portugal':
            document.portugal.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Portugal');
            break;
        case 'spanien':
            document.spanien.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Spanien');
            break;
        case 'frankreich':
            document.frankreich.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Frankreich');
            break;
        case 'belgien':
            document.belgien.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Belgien');
            break;
        case 'niederlande':
            document.niederlande.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Niederlande');
            break;
        case 'island':
            document.island.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Island');
            break;
        case 'vereinigtes_koenigreich':
            document.vereinigtes_koenigreich.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'UK');
            break;
        case 'irland':
            document.irland.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Irland');
            break;
        case 'luxemburg':
            document.luxemburg.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Luxemburg');
            break;
        case 'deutschland':
            document.deutschland.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Deutschland');
            break;
        case 'daenemark':
            document.daenemark.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Dänemark');
            break;
        case 'norwegen':
            document.norwegen.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Norwegen');
            break;
        case 'schweden':
            document.schweden.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Schweden');
            break;
        case 'finnland':
            document.finnland.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Finnland');
            break;
        case 'polen':
            document.polen.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Polen');
            break;
        case 'tschechische_republik':
            document.tschechische_republik.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Tschechische Republik');
            break;
        case 'schweiz':
            document.schweiz.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Schweiz');
            break;
        case 'oesterreich':
            document.oesterreich.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Österreich');
            break;
        case 'liechtenstein':
            document.liechtenstein.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Liechtenstein');
            break;
        case 'estland':
            document.estland.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Estland');
            break;
        case 'lettland':
            document.lettland.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Lettland');
            break;
        case 'litauen':
            document.litauen.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Litauen');
            break;
        case 'slowakei':
            document.slowakei.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Slowakei');
            break;
        case 'rumaenien':
            document.rumaenien.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Rumänien');
            break;
        case 'bulgarien':
            document.bulgarien.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Bulgarien');
            break;
        case 'griechenland':
            document.griechenland.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Griechenland');
            break;
        case 'zypern':
            document.zypern.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Zypern');
            break;
        case 'ungarn':
            document.ungarn.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Ungarn');
            break;
        case 'tuerkei':
            document.tuerkei.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Türkei');
            break;
        case 'italien':
            document.italien.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Italien');
            break;
        case 'ukraine':
            document.ukraine.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Ukraine');
            break;
		case 'kroatien':
            document.kroatien.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Kroatien');
            break;
		case 'slowenien':
            document.slowenien.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Slowenien');
            break;
        case 'europa_russland':
            document.europa_russland.src = '../trndmntr/images/karten/' + country + '.png';
            createCountryInfoBox(country, 'Russland');
            break;
    }
}

function hide(country){
	if(locked_country == country){
		return 0;
	}
	
	if(document.getElementById('countryInfoBox')){
    	removeElement('countryInfoBox');
	}
	
    var parentDiv = document.getElementById(country);
    parentDiv.getElementsByTagName('img')[0].src = '../trndmntr/images/icons/spacer.gif';

	if(locked_country != ""){
		switchCountry(locked_country);
	}
}

function createCountryInfoBox(country, countyDescription){
    var countryImage = document.getElementById(country);
    var countryBox = document.createElement('p');
    var countryFlag = document.createElement('img');
    
    if(country == 'europa_russland'){
		country = 'russland';
	}
	
    countryFlag.setAttribute('src', '../trndmntr/images/flaggen/' + country + '.png');
    countryBox.appendChild(countryFlag);
    countryBox.appendChild(document.createElement('br'));
    
    var countryText = document.createTextNode(countyDescription);
    countryBox.appendChild(countryText);
    countryBox.setAttribute('id', 'countryInfoBox');
    countryImage.appendChild(countryBox);
}

function removeElement(id){
    var element = document.getElementById(id);
    element.parentNode.removeChild(element);
}

function hideElement(id){
    document.getElementById(id).style.display = 'none';
}

function showElement(id){
    document.getElementById(id).style.display = 'block';
}

function showEuropa(){
    document.getElementById('weltkarte_full').src = '../trndmntr/images/karten/europa_full.png';
    document.getElementById('weltkarte_full').setAttribute('id', 'europa_full');
    
    hideElement('wrap_full');
    hideElement('kontinente');
    
    showElement('back2map');
    showElement('wrap_europa');
    showElement('europalaender');
    
    return false;
}

function hideEuropa(){
    document.getElementById('europa_full').src = '../trndmntr/images/karten/map.png';
    
    hideElement('wrap_europa');
    hideElement('europalaender');
    hideElement('back2map');
    
    showElement('wrap_full');
    showElement('kontinente');
    
    document.getElementById('europa_full').setAttribute('id', 'weltkarte_full');
    
    return false;
}

function showFirst(){
    document.getElementById("studiengeb_einbeziehen").checked = "";
    document.getElementById("lebenshaltkosten_einbeziehen").checked = "";
}

function showSecond(){
    if(document.getElementById("studiengeb_einbeziehen").value == "on" || document.getElementById("lebenshaltkosten_einbeziehen").value == "on"){
        document.getElementById("finanzrahmen_einbeziehen").checked = "";
    }               
}

function injectValue(){
	for(var i = 1; i <= 3; ++i){
		var formAction = document.getElementById('s' + i).getAttribute('action');
		
		if(formAction.indexOf('englische_laender=true') != -1){
			document.getElementById('s' + i).setAttribute('action', 'http://www.che-consult.de/cms/?getObject=702&finanzmonitor&englische_laender=false');
		}else{
			document.getElementById('s' + i).setAttribute('action', 'http://www.che-consult.de/cms/?getObject=702&finanzmonitor&englische_laender=true');
		}				
	}		
}
			
			
function hs(id) {
	if (document.getElementById(id).style.display == 'none') {
		document.getElementById(id).style.display = 'block';
	} else {
		document.getElementById(id).style.display = 'none';
	}
}

function hsAll(id) {
	var headers = new Array('ueberblick', 'gebuehren', 'lhk', 'bedingungen',
			'links', 'laenderinfos', 'hochschulen_div', 'unis', 'erfahrungsberichte');
	var anzahl = 0;
	
	if (showAll == false) {
		op = 'none';
		showAll = true;
	} else {
		op = 'block';
		showAll = false;
	}

	for ( var x = 0; x < headers.length; x++) {
		if(document.getElementById(headers[x])){
			document.getElementById(headers[x]).style.display = op;
		}
	}
	
	if(document.getElementById(id)){
		if(showAll){
			document.getElementById(id).innerHTML = 'Alles anzeigen';
		}else{
			document.getElementById(id).innerHTML = 'Alles ausblenden';
		}
	}
}
