function checkFlash() {

    if( hasFlash() ) {
        return;
    }

    var headerDiv = document.getElementById( "adsk81-header" );
    var headerDefault = document.getElementById( "adsk81-header-noscript" );
    if( headerDiv != null ) {
        if( headerDefault.firstChild ) {
            // Mozilla
            headerDiv.innerHTML = headerDefault.firstChild.nodeValue;
        } else {
            // IE6
            headerDiv.innerHTML = headerDefault.innerHTML;
        }
    }

    function hasFlash() {
        var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
        if ( plugin ) {
            var words = navigator.plugins["Shockwave Flash"].description.split(" ");
            for (var i = 0; i < words.length; ++i) {
                if (isNaN(parseInt(words[i])))
                    continue;
                var MM_PluginVersion = words[i];
            }
            return MM_PluginVersion >= 7;
        } else if ( navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1 ) ) {
            try {
                oFlash = new ActiveXObject( "ShockwaveFlash.ShockwaveFlash.7" );
            } catch( ex ) {
                return false;
            }
            return oFlash != null;
        }

        return false;
    }

}

function init() {

    function moveFooter() {

        if( ! document.documentElement ) {
            return;
        }
        if( ! document.documentElement.clientHeight ) {
            return;
        }
        if( ! document.getElementById ) {
            return;
        }
        var header = document.getElementById( "adsk81-header" );
        var content = document.getElementById( "adsk81-content" );
        var footer = document.getElementById( "adsk81-footer" );
        if( ! content || ! header || ! footer ) {
            return;
        }

        /* window.innerHeight is not supported by IE6; documentElement.clientHeight does not give window height in Opera 8.51 */
        var winHeight = window.innerHeight;
        if( ! winHeight ) {
            winHeight = document.documentElement.clientHeight;
        }

        var contentHeight = header.offsetHeight + content.offsetHeight;
        var footerHeight = footer.offsetHeight;
        if( ! content.offsetParent ) {
            return;
        }
        var available = winHeight - (content.offsetParent.offsetHeight - footerHeight);

        if( ! footer.style ) {
            return;
        }

        if( available > footerHeight ) {
            footer.style.position = 'relative';
            footer.style.top = (available - footerHeight) + 'px';
        } else {
            footer.style.position = 'static';
        }

    }

    window.onresize = moveFooter;

    moveFooter();
}

function openPopup( url, width, height, name, features ) {

    function addFeature( features, name, value ) {
        if( value == null || value == "" ) {
            return features;
        }
        if( features != "" ) {
            features += ",";
        }
        return features + name + "=" + value;
    }

    if( name == null || name == "" ) {
        name = "popupWindow";
    }
    if( features == null || features == "") {
        features = "";
        features = addFeature( features, "scrollbars", "yes" );
        features = addFeature( features, "resizable", "yes" );
        if( name == "popupWindow" ) {
            features = addFeature( features, "location", "yes" );
            features = addFeature( features, "menubar", "yes" );
            features = addFeature( features, "toolbar", "yes" );
            features = addFeature( features, "status", "yes" );
        }
    }
    if( name == "viewlarger" ) {
        if( width == null || width == "" ) {
            width = 800;
        }
        if( height == null || height == "" ) {
            height = 600;
        }
    }
    if( name == "popupWindow" ) {
        if( width == null || width == "" ) {
            width = 800;
        }
        if( height == null || height == "" ) {
            height = 600;
        }
    }

    features = addFeature( features, "width", width );
    features = addFeature( features, "height", height );
    var popupWindow = window.open( url, name, features );
    popupWindow.focus();

    return false;
}

