INTERNAL_AREA_OPENED = 0;

function reformateMailto() {
    var a = document.getElementsByTagName("a");

    for (var i = a.length-1; i >= 0; i--) {        
        if (a[i].className.search(/\bmailto\b/) != -1) {
            var email = a[i].firstChild.data + "@" + a[i].lastChild.data;
            a[i].innerHTML = email;
            a[i].href = "mailto:" + email;
        }
    }
}

function toggleInternalArea() {
    var targetRight = 0;
    
    if(INTERNAL_AREA_OPENED === 1)
        targetRight = -140;
    
    $("#ia_wrapper").animate({
                        right: targetRight
                    },
                    100,
                    function(){
                        $("#ia_fader_wrapper").attr("title", (INTERNAL_AREA_OPENED === 0 ? "internen Bereich schließen" : "internen Bereich öffnen"));
                        $("#ia_fader").removeClass(INTERNAL_AREA_OPENED === 0 ? "closed" : "opened");
                        $("#ia_fader").addClass(INTERNAL_AREA_OPENED === 0 ? "opened" : "closed");
                        INTERNAL_AREA_OPENED = (INTERNAL_AREA_OPENED === 0 ? 1 : 0);
                    }        
    );
}

window.onload = reformateMailto;
