if (typeof(console) != 'object') console = { log: function(text,obj) {} }

function addLayerMenu() {	

	
	
	var showLayerMenu = function(e) {
		var overlay = $(this).children('.overlay'); 
		var overlayFrame = $(this).children('.overlayFrame');		
		overlay.show();
		
		overlayFrame.css('height',overlay.height()-24)
		overlayFrame.show();
	}
	
	var hideLayerMenu = function(e) {
		$(this).children('.overlay').hide();
		$(this).children('.overlayFrame').hide();
	}
	
	$("div#horizontalNavigation li").hover(showLayerMenu,hideLayerMenu);
		
} // addLayerMenu();

function addHeaderFlash() {	
	if (typeof(headerSWF) == undefined) return;		
	headerSWF.addParam("wmode", "opaque");
	headerSWF.write("headerFlash");			
} // addHeaderFlash()


$(document).ready(function() {
    if(getcookie('evista_font_size')) {
		try { setFontSize(getcookie('evista_font_size')); } catch (e) {}
	}
	addLayerMenu();
	addHeaderFlash();
	var tmploc = window.location.pathname.match(/\/site_(.*)\//);
	treelocale = tmploc[1].replace('information', 'evista');
	getAllLinks(treelocale);
});



function bookmark(lang) {
	var title = document.title; 	
	var url = location.href;
	var description = title;
	if ( window.sidebar ) { // Mozilla Firefox
		window.sidebar.addPanel(title, url,"");
	} else if ( window.external ) { // IE
		window.external.AddFavorite( url, title);
	} 
	else{
		switch (lang){
			case 'es': alert('');break;
			case 'tr': alert('');break;
			case 'at': alert('');break;
			case 'sk': alert('');break;
			case 'pt': alert('Para marcar este site por favor pressione as seguintes teclas: "Strg + D"');break;
			case 'be_nl': alert('');break;
			case 'be_fr': alert('');break;
			default:
			alert('Please press CTRL + D to bookmark this Page');
		}
			
		
	}
	
}

//Ja, folgendes ist böse, wird bei freier zeit geändert

function bookmark_es() {
  	bookmark('es');
}

function bookmark_tr() {
    bookmark('tr');
}

function bookmark_at() {
   	bookmark('at');
}

function bookmark_sk() {
    bookmark('sk');
}


function setFontSize(fs) {
    $('img.normal').attr('src', '/_res_local/output-img/evista/layout/header/but_fontSize_s_no.png');
    $('img.bigger').attr('src', '/_res_local/output-img/evista/layout/header/but_fontSize_m_no.png');
    $('img.biggest').attr('src', '/_res_local/output-img/evista/layout/header/but_fontSize_l_no.png');
    switch(parseInt(fs)) {
        case 100:
            $('img.normal').attr('src', '/_res_local/output-img/evista/layout/header/but_fontSize_s_act.png');
            break;
        case 120:
            $('img.bigger').attr('src', '/_res_local/output-img/evista/layout/header/but_fontSize_m_act.png');
            break;
        case 140:
            $('img.biggest').attr('src', '/_res_local/output-img/evista/layout/header/but_fontSize_l_act.png');
            break;
    }
    if (navigator.appName == "Microsoft Internet Explorer") {
        $('div#contentMain').removeClass('fontsize100');
        $('div#contentMain').removeClass('fontsize120');
        $('div#contentMain').removeClass('fontsize140');
        $('div#contentMain').addClass('fontsize' + fs);
    } else {
        $('div#contentMain').css('font-size', fs + '%');
    }
    setcookie('evista_font_size', fs, 365, '/');
}

function setcookie(name, value, days, path, domain, secure) {
	var expires = -1;
	if(typeof days == "number" && days >= 0) {
		var d = new Date();
		d.setTime(d.getTime()+(days*24*60*60*1000));
		expires = d.toGMTString();
	}
	value = escape(value);
	document.cookie = name + "=" + value + ";" + (expires != -1 ? " expires=" + expires + ";" : "") + (path ? "path=" + path : "") + (domain ? "; domain=" + domain : "") + (secure ? "; secure" : "");
}

function delcookie(name) {
	setcookie(name, "-", 0);
}

function getcookie(name) {
	var idx = document.cookie.indexOf(name+'=');
	if(idx == -1) {
		return null;
	}
	value = document.cookie.substring(idx+name.length+1);
	var end = value.indexOf(';');
	if(end == -1) {
		end = value.length;
	}
	value = value.substring(0, end);
	value = unescape(value);
	return value;
}

function loginDB_swap() {
	if (document.getElementById('profession').value == 1 || document.getElementById('profession').value == 5) {
		document.getElementById('div-fachrichtung').style.display = 'block';
	} else {
		document.getElementById('div-fachrichtung').style.display = 'none';
	}
	if (document.getElementById('beruflich').checked == true) {
		document.getElementById('pflicht_adresse').style.display = 'inline';
		document.getElementById('pflicht_plz').style.display = 'inline';
		document.getElementById('pflicht_stadt').style.display = 'inline';
		document.getElementById('pflicht_adresse_error').style.display = 'block';
		document.getElementById('pflicht_plz_error').style.display = 'block';
		document.getElementById('pflicht_stadt_error').style.display = 'block';
	} else if (document.getElementById('privat').checked == true) {
		document.getElementById('pflicht_adresse').style.display = 'none';
		document.getElementById('pflicht_plz').style.display = 'none';
		document.getElementById('pflicht_stadt').style.display = 'none';
		document.getElementById('pflicht_adresse_error').style.display = 'none';
		document.getElementById('pflicht_plz_error').style.display = 'none';
		document.getElementById('pflicht_stadt_error').style.display = 'none';
	}
}