﻿var lastOpen = null;

function SwitchZitat(bDirection) {
    if(bDirection) {
        HideAllZitate();
        currActive++;
        ZitatRange();
        Blend(ids[currActive], true);
        Blend(ids[currActive]+'_pic', true);
    } else {
        HideAllZitate();
        currActive--;
        ZitatRange();
        Blend(ids[currActive], true);
        Blend(ids[currActive]+'_pic', true);
    }
}
function Blend(idElement,bDisplay) {
    if(bDisplay) {
        document.getElementById(idElement).style.display = 'block';
    } else {
        document.getElementById(idElement).style.display = 'none';
    }
}
function BlendFooterText(idElement) {
    //default
    Blend('SpeechStrategie',false);
    Blend('SpeechLeadership',false);
    Blend('SpeechIntern',false);
    Blend('SpeechManagement',false);
    Blend('SpeechIntegration',false);
    Blend('SpeechBeratung',false);
    Blend('SpeechTraining',false);
    Blend('SpeechCoaching',false);
    //Display the current
    Blend(idElement,true);
    
}
function HideAllZitate() {
    for(i=0;i<=ids.length;i++) {
        Blend(ids[currActive],false);
        Blend(ids[currActive]+'_pic',false);
    }
}
function ZitatRange() {
    if(currActive<0) {
        currActive = ids.length-1;
    } else {
        if(currActive==ids.length) {
            currActive = 0;
        }
    }
}
function SwapImage(idElement,sPath) {
    document.getElementById(idElement).src = sPath;
}
function SwitchClass(idElement, sClass) {
    document.getElementById(idElement).className = sClass;
}
function SetPointer(idElement, sLeft, sHeight) {
    document.getElementById(idElement).style.left = sLeft + "px";
    document.getElementById(idElement).style.height = sHeight + "px";
}

function HideDivsWithSuffix(sSuffix) {
    var items = document.getElementsByTagName("div");
    for (var i = 0; i < items.length; i++)
        if (items[i].id.substr(items[i].id.length-sSuffix.length, sSuffix.length) == sSuffix) {
            if(items[i].style.display == "block" && lastOpen == null)
                lastOpen = items[i];
            items[i].style.display="none";
        }
}
function ShowLast(){
    if (lastOpen != null)
        lastOpen.style.display="block";
}
function IfScroll() {
            window.onscroll = function() {
				document.getElementById("ScrollDiv").style.display = "block";
				
			};
		}
function SwapStyle(idElement,jsstyle,jsattribut) {
    switch(jsstyle) {
        case 'bold':
            document.getElementById(idElement).style.fontWeight = jsattribut;
            break;
        case 'color':
            document.getElementById(idElement).style.color = jsattribut;
            break;
    }
}
function KontaktAnreise(jsBool){
    if(jsBool) {
        SwapStyle('auto_link', 'bold', 'normal');
        SwapStyle('auto_link', 'color', '#788186');
        SwapStyle('oeffentlich_link', 'bold', 'normal');
        SwapStyle('oeffentlich_link', 'color', '#e7690d');
        Blend('oeffentlich',true);
        Blend('auto',false);
    } else {
        SwapStyle('auto_link', 'bold', 'normal');
        SwapStyle('auto_link', 'color', '#e7690d');
        SwapStyle('oeffentlich_link', 'bold', 'normal');
        SwapStyle('oeffentlich_link', 'color', '#788186');
        Blend('oeffentlich',false);
        Blend('auto',true);
    }
}