Type.registerNamespace("manathanWeb");

manathanWeb.MoritzEiche = function(curr, end) {
    this.winH;
    this.isIE = false;
    this.locked = false;
    this.stillOpacity = 0;
    this.open = null;
}

manathanWeb.MoritzEiche.prototype = {

    /** private methods */
    __IEVersionNumber: function () {
        var ua = navigator.userAgent;
        var MSIEOffset = ua.indexOf("MSIE ");
        
        if (MSIEOffset == -1) {
            return 0;
        } else {
            return parseFloat(ua.substring(MSIEOffset + 5, ua.indexOf(";", MSIEOffset)));
        }
    },

    /** public methods */
    Initalize: function() {
        try {
            if (parseInt(navigator.appVersion)>3) {
	            if (navigator.appName.indexOf("Microsoft")!=-1) {
		            this.isIE = true;
		            if (this.__IEVersionNumber() < 7)
		                alert("As this webpage uses newest technologies which your browser doesn\'t support, your experience on this webpage may not be as expected. Please update to a modern browser like Internet Explorer 7.0, Firefox 2 or Opera 9.");
	            }
            }
        } catch (err) {
            alert('manathanWeb.MoritzEiche.Initalize() error: ' + err.message);
        }
    },
    
    SetFocus: function() {
        try { document.getElementById('top').focus(); } catch (Err) { }
    },       

    
    IsIE: function() {
        return this.isIE;
    },
    
    ResizePage : function(eventElement) {
        this.AlignPage(1);
    },
    
    AlignControl : function(_div) {
        this.winH = ((!this.isIE) ? window.innerHeight : document.body.offsetHeight);
    },
    
    AlignPage : function(resize) {
        try {
            if (this.isIE)
            {
                while(this.locked) {}
	            this.locked = true;
            }
	        var _div = document.getElementById('content');
	        _div.style.marginTop = '0px';
	        if (resize == 0 || !this.isIE) 
	        {
	            this.winH = screen.availableHeight;
	            this.AlignControl(_div);
	        }
            var mt = (this.isIE) ? ((this.winH / 2) - (326 / 2)) : ((this.winH / 2) - (326 / 2) - 200);
	        _div.style.marginTop = mt + 'px';
	        //alert(resize + ';winH=' + winH + ';marginTop=' + _div.style.marginTop);
	        if (this.isIE && resize != 1) {
	            try {
	                _div = document.getElementById('footer');
	                _div.style.position = 'relative';
	                _div.style.top = 0;
	                _div.style.top = ((resize != 2) ? '-87px' : '-' + (454) + 'px');
	                if (this.__IEVersionNumber() < 7) {
	                    for(var i=0; i < document.getElementsByTagName('li').length; i++) {
	                        document.getElementsByTagName('li')[i].style.display = 'inline';
	                        document.getElementsByTagName('li')[i].style.float = 'none';
	                    }
	                }
	                this.locked = false;
	            } catch (err) {
	                alert('manathanWeb.MoritzEiche.AlignPage() error: ' + err.message);
	            }
	        }
	        this.locked = false;
	    } catch (err) {
	        alert('manathanWeb.MoritzEiche.AlignPage() error: ' + err.message);
	    }
    },
    
    WindowHeight: function() {
        return this.winH;
    },
    
    Close: function() {
        try {
            if (this.isIE) {
                document.getElementById('footer').style.top = '-87px';
            }
            if (this.open) {
                this.open.Close();
            }
	        return false;
	    } catch (err) {
	        alert('manathanWeb.MoritzEiche.Close() error: ' + err.message);
	    }
    },
    
    IsClosed: function() {
        try {
            return (this.open) ? this.open.getIsClosed() : true;
        } catch (err) {
	        alert('manathanWeb.MoritzEiche.IsClosed() error: ' + err.message);
	        return true;
	    }
    },
    
    RegisterOpen: function(open) {
        this.open = open;
    },

    Startpage: function() {
        try {
            var _main = document.getElementById('content');
	        _main.style.backgroundImage = "url('http://www.moritz-eiche.com/b8645670-c9df-4857-95b6-6c60f2aaff9a.image')";
	    } catch (err) {
	        alert('manathanWeb.MoritzEiche.Startpage() error: ' + err.message);
	    }
	},

    WriteVideo: function() {
        try {
            document.writeln('<object width="768" height="450" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"');
            document.writeln('codebase="http://www.apple.com/qtactivex/qtplugin.cab" style="background-color:Black;">');
            document.writeln('<param name="src" value="http://www.moritz-eiche.de/reel_07.mov">');
            if (this.isIE)
                document.writeln('<param name="autoplay" value="true">');
            else
                document.writeln('<param name="autoplay" value="false">');
            document.writeln('<param name="controller" value="true">');
            document.writeln('<embed src="http://www.moritz-eiche.de/reel_07.mov" width="768" height="450" ');
            if (this.isIE)
                document.write('autoplay="true" ');
            else
                document.write('autoplay="false" ');
            document.writeln('controller="true" pluginspage="http://www.apple.com/quicktime/download/" style="background-color:Black;"> </embed>');
            document.writeln('</object>');
	    } catch (err) {
	        alert('manathanWeb.MoritzEiche.WriteVideo() error: ' + err.message);
	    }
    }
}

manathanWeb.MoritzEiche.registerClass('manathanWeb.MoritzEiche');

try {
var motz = new manathanWeb.MoritzEiche();
motz.Initalize();

// Notify ScriptManager that this is the end of the script.
if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();
}
catch (err) {
    alert('page initalization failed: ' + err.message);
}
