AidCalculator = Class.create(DivPopup, {

    initialize: function($super, baseUrl) {

        $super(baseUrl);

        this.startAidCalculation = function() {
            this.showDialog($('foerderungStartDialog'));
        }

        this.showAidCalculatorDialog = function() {
            window.frames['foerdermittelIframe'].location = baseUrl + 'home.FdbProxy.html?requestUrl=' + urlEncode('http://foerdermittelauskunft.de/extern/moderne-heizung/object.php');
            this.showDialog($('foerderungBerechnenDialog'));
        }

        this.closeAidCalculator = function() {

            this.close();

            window.frames['foerdermittelIframe'].location = 'about:blank';
            fdbIframe = document.getElementById('foerdermittelIframe');
            fdbIframe.style.height = '0px';
        }

        function getTopLevelDomain(url) {
            var domain = url.toString().replace(/^http:\/\/(www\.){0,1}/, '');
            var domainParts = domain.split('.');
            topLevelDomain = domainParts[domainParts.length - 2] + '.' + domainParts[domainParts.length - 1];
            return topLevelDomain;
        }

        function getOptionValue(formName, optionName) {
            var i = 0;
            while (i < document.forms[formName].elements[optionName].length) {
                if (document.forms[formName].elements[optionName][i].checked == true) {
                    return document.forms[formName].elements[optionName][i].value;
                }
                i++;
            }
            return null;
        }
    }
});

function onFdbIframeLoaded() {
    var fdbIframe = document.getElementById('foerdermittelIframe');
    fdbIframe.style.height = '0px';
    fdbIframe.style.height = fdbIframe.contentWindow.document.body.scrollHeight + "px";

    resizePageInactive(fdbIframe.contentWindow.document.body.scrollHeight + 200);

    scrollUp();
}