var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

if (document.location.href.match(/\/ar\//)) {
	document.write(unescape("%3Clink href='/__/styles/ar.css' type='text/css' rel='stylesheet'%3E"));
}

var downloadTrack = function(){
    //do nothing :)
}
var changeSt = function(nr, link){
    var d = document.getElementById('st' + nr);
    if (d) {
        var tb = document.getElementById('strttb');
        if (tb)
            tb.style.background = 'url(/images/nanostart/vorschalt2.jpg) no-repeat left top';
        for (var z = 1; z <= 4; z++) {
            if (z != nr) {
                var dhide = document.getElementById('st' + z);
                if (dhide)
                    dhide.style.display = 'none';
            }
        }
        d.style.display = 'block';
    }
};
var movieOnMouseOver = function(){
    this.SetVariable('mOut', 0);
};
var movieOnMouseOut = function(){
    this.SetVariable('mOut', 1);
};
var embedslideshow = function(src, trid){
    if (!src || src == '' || src == 'undefined')
        return;
    if (!trid || trid == '' || trid == 'undefined')
        return;
    var path = document.location.pathname.split('/');
    fName = 'zitat_bild_leiste.swf';
    /*if (path[1] && path[1] == 'cn') {
        fName = 'cn_zitat_bild_leiste.swf';
    }
    if (path[1] && path[1] == 'ar') {
        fName = 'zitat_bild_leiste_ar.swf';
    }*/
    var oeTags = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' +
    'width="630" height="99"' +
    'data="' +
    basepath +
    '__/images/flash/' +
    fName +
    '?trid=' +
    trid +
    '&slsrc=' +
    src +
    '"' +
    'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">' +
    '<param name="movie" value="' +
    basepath +
    '__/images/flash/' +
    fName +
    '?trid=' +
    trid +
    '&slsrc=' +
    src +
    '" />' +
    '<param name="loop" value="false"/>' +
    '<param name="menu" value="false" />' +
    '<param name="quality" value="high" />' +
    '<param name="wmode" value="transparent" />' +
    '<embed src="' +
    basepath +
    '__/images/flash/' +
    fName +
    '?trid=' +
    trid +
    '&slsrc=' +
    src +
    '" quality="high" wmode="transparent" width="630" height="99" name="obj" align="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>' +
    '<\/object>';
    document.write(oeTags);
};
var cnt;
var positions = {};
var totalheight = 0;
var stopAnim = false;
var offset = false;
var cntheight = 0;
slide = function(ct){
    var els = Ext.select("#autoslide a", true);
    els.each(function(lnk){
        lnk.dom.onclick = function(){
            stopAnim = true;
            var box = Ext.MessageBox.show({
                title: '',
                msg: '<img src="/_/scripts/ext/resources/images/default/shared/blue-loading.gif" alt="" style="border:0; vertical-align:middle;">&nbsp;Loading...',
                //animEl: lnk,
                width: 500,
                height: 400,
                modal: false,
                fn: function(){
                    Ext.MessageBox.hide();
                    stopAnim = false;
                }
            });
            var url = lnk.dom.href;
            Ext.Ajax.request({
                url: url,
                success: function(req){
                    var treg = /<!--\sINHALT\s-->(.+)<!--\sINHALT\s-->/gi;
                    var ntxt = req.responseText.split('\n').join('');
                    //var bd = treg.exec(ntxt);
                    var bd = ntxt.match(treg);
                    if (bd && bd[0]) {
                        var txt = bd[0];
                        box.updateText(txt);
                    }
                }
            });
            return (false);
        };
        //var h = lnk.getHeight();
        if (lnk.dom.firstChild) {
        	totalheight += lnk.dom.firstChild.height;
        }
        //alert(h);
    });
    cntheight = totalheight;
    els.each(function(lnk){
        var h = lnk.getHeight();
        totalheight += h;
        var cp = lnk.dom.cloneNode(true);
        var lnk2 = cp;
        ct.appendChild(cp);
        lnk2.onclick = function(){
            stopAnim = true;
            var box = Ext.MessageBox.show({
                title: '',
                msg: '<img src="/_/scripts/ext/resources/images/default/shared/blue-loading.gif" alt="" style="border:0; vertical-align:middle;">&nbsp;Loading...',
                //animEl: lnk2,
                width: 500,
                height: 400,
                modal: false,
                fn: function(){
                    Ext.MessageBox.hide();
                    stopAnim = false;
                }
            });
            var url = lnk2.href;
            Ext.Ajax.request({
                url: url,
                success: function(req){
                    var treg = /<!--\sINHALT\s-->(.+)<!--\sINHALT\s-->/gi;
                    var bd = treg.exec(req.responseText.split('\n').join(''));
                    if (bd && bd[1]) {
                        var txt = bd[1];
                        box.updateText(txt);
                    }
                }
            });
            return (false);
        };
    });
    cnt = ct;
    window.setInterval("doScroll()", 50);
}
doScroll = function(){
    if (stopAnim)
        return;
    var t = cnt.getScroll();
    var p = cnt.scroll('down', 1);
    //document.getElementById('menubottom').innerHTML = p+' : '+t.top+' : '+cntheight;
    //if (!p || t.top >= cntheight) {
    if (t.top >= cntheight) {
        cnt.scroll('top');
    }
}
runOnLoad(function() {
    var sl = Ext.get('autoslide');
    if (sl) {
        slide(sl);
    }
});
var pMoviePlayer = function(src, w, h, v) {
    var id = getUniqueID();
    var txt = '<div style="width:' + w + 'px; height:' + (h - 30) + 'px;" id="flash' + id + '"></div>';
    var swf = new SWFObject(basepath + '_/flash/moviePlayer.swf', "flash" + id + "obj", w, h, v || "8");
    swf.addParam('wmode', 'transparent');
    swf.addVariable("skinSource", basepath + '_/flash/SteelExternalAll.swf');
    swf.addVariable("streamSource", src);
    swf.useExpressInstall(basepath + '_/flash/expressinstall.swf');
    var m = Ext.Msg.show({
        title :'',
        msg :txt,
        buttons :false,
        modal :false,
        width: w,
        fn: function(btn) {
	    	Ext.get("flash" + id).remove();
	    }
    });
    swf.write("flash" + id);
    //Ext.Msg.getDialog().resizeTo(w + 30, h + 50);
};
var playvideo = function(id){
    var myPlayer = '';
    myPlayer += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="384" height="325">';
    myPlayer += '<param name="FlashVars" value="&autoplay=0&clipId=' + id + '"/>';
    myPlayer += '<param name="movie" value="http://player.videocluster.de/externClip.swf" />';
    myPlayer += '<embed src="http://player.videocluster.de/externClip.swf" type="application/x-shockwave-flash"';
    myPlayer += 'width="384" height="325" FlashVars="&autoplay=0&clipId=' + id + '"></embed>';
    myPlayer += '</object>';
    var box = Ext.MessageBox.show({
        title: '',
        msg: myPlayer,
        animEl: null,
        width: 420,
        height: 200,
        modal: false,
        fn: function(){
            Ext.MessageBox.hide();
        }
    });
};
var playExtVideo = function(url, w, h){
    var box = Ext.MessageBox.show({
        title: '',
        msg: '<iframe src="' + url + '" width="' + (w + 50) + '" height="' + h + '" frameborder="0"></iframe>',
        animEl: null,
        width: w + 50,
        height: h,
        modal: false,
        fn: function(){
            Ext.MessageBox.hide();
        }
    });
}
var makeItBig = function(el){
    var box = Ext.MessageBox.show({
        title: '',
        msg: '<img src="http://neu.nanostart.de/media/neu.nanostart.de/media/679_beteiligungsh6.gif" width="400" height="236" border="0" alt="">',
        animEl: null,
        width: 420,
        height: 200,
        modal: false,
        fn: function(){
            Ext.MessageBox.hide();
        }
    });
    var dlg = box.getDialog();
    var pos = dlg.getPosition();
    pos[1] = pos[1] - 200;
    dlg.setPagePosition(pos);
};
var invaccept = function(el){
    if (el.checked) {
        var path = document.location.pathname.split('/');
        document.cookie = "investoraccept=true; path=/" + path[1] + "/";
        window.location.reload();
    }
};

if (document.location.pathname.match(/\/en\/calendar\//)) {
	document.write(unescape("%3Cscript src='/scripts/eventsen.js' type='text/javascript'%3E%3C/script%3E"));
}
