        
        /*
        dojo.require("dijit.Tooltip");
        dojo.require("dijit.TooltipDialog");
        dojo.require("dijit.Dialog");
        dojo.require("dijit.form.DropDownButton");
        dojo.require("dijit.Menu");
        
        //dojo.require("dijit.form.FilteringSelect");
        dojo.require("dijit.form.ComboBox");
        dojo.require("dojo.data.ItemFileReadStore");

        // DETAIL
        dojo.require("dijit.layout.TabContainer");
        dojo.require("dijit.layout.ContentPane");
        //dojo.require("dojox.layout.ContentPane");
        */        
        
        /*
        dojo.addOnLoad(function(){
            new dijit.Tooltip({
                connectId: ["merklink_2647533"],
                label: "a <i>disposition</i> to bear injuries patiently : <b>forbearance</b>"
            });
        });
        */
        
        var detailDialog;
        var einstellungenDialog;
        dojo.addOnLoad(function(){
            // create the dialog:
            detailDialog = new dijit.Dialog({
                title: "",
                style: "width: 724px; height: 609px;",
                id: "detail_dialog"
            });
            
            einstellungenDialog = new dijit.Dialog({
                title: "",
                href: "einstellungen.php",
                style: "width: 850px; height: 700px;",
                id: "einstellungen_dialog"
            });
            
            var searchStore = new dojo.data.ItemFileReadStore({
                url: server_root_path+"json/getSuggestions.php"
            });
            
            var filteringSelect = new dijit.form.ComboBox({
                id: "searchSelect",
                name: "q",
                value: suchwort,
                store: searchStore,
                fetchProperties: {start:0, count: 15 },
                searchAttr: "name",
                queryExpr: "*${0}*",
                searchDelay: 300,
                autoComplete: false,
                highlightMatch: "all",
                hasDownArrow: false,
                required: false,
                propercase: false,
                ignoreCase: true,
                promptMessage: "Sie k&ouml;nnen hier nach Sendungen suchen.",
                tooltipPosition: "above",
                validator: function() { return true; },
                onClick: function() {
                    //alert(dijit.byId("stateSelect").value);
                    if(dijit.byId("searchSelect").value=="Stichwort eingeben...") {
                        dijit.byId("searchSelect").setAttribute("value","");
                    } else {
                        //dijit.byId("searchSelect").focus();
                    }
                    //alert(this.value);
                }
            }, "searchSelect");
            
            dijit.byId("searchSelect").setAttribute("class","search-input");
                        
        });
        
        function showSendung(url){
            // set the content of the dialog:
            detailDialog.setHref(url);
            detailDialog.show();
            //console.log("bannertmp:" + dojo.byId("bannertmp").innerHTML);
            //dijit.byId("detail_dialog").
            //dojo.byId("detailbanner").innerHTML = dojo.byId("bannertmp").innerHTML;
            //console.log(dojo.byId("detailbanner").innerHTML);
        }

        
        function sendungSchliessen(sendung_id) {
            //dijit.byId("sendung_detail_"+sendung_id).hide();
            detailDialog.hide();
        }
        
        function sendungAnzeigen(sendung_id_old,sendung_id_new,url) {
            //alert(sendung_id_old+" - "+sendung_id_new);
            var sendung_dialog = dijit.byId("sendung_detail_"+sendung_id_old);
            sendung_dialog.setAttribute("id", "sendung_detail_"+sendung_id_new);
            sendung_dialog.setHref(url);
            
            //dijit.byId("sendung_detail_"+sendung_id_old).setAttribute("style", "border: 1px solid red");
            //dijit.byId("sendung_detail_"+sendung_id_old).setAttribute("id", "sendung_detail_"+sendung_id_new)
            //alert(dijit.byId("sendung_detail_"+sendung_id_new));
        }
        
        function alsFavoritSpeichern() {
            
            url=document.URL;
            title=document.title;
            
        	if(window.sidebar) {
        		window.sidebar.addPanel(title, url,""); 
        	} else if( document.all ) {
        		window.external.AddFavorite(url, title);
        	} else if( window.opera && window.print ) {
        		return true;
        	}
        }
        
        function vollbildAnsicht(url) {
            
            var hoehe = screen.height;
            var breite= screen.width;
            
        	scrollbars="yes";
        	resizable="yes";
        	
            var winH = (screen.width - breite) / 2;
        	var winV = (screen.height - hoehe) / 2;
        	fenster = "height="+hoehe+",width="+breite+",top="+winV+",left="+winH+",scrollbars="+scrollbars+",resizable="+resizable;
            
           	dasvollbild = window.open(server_root_path+url, "fullscreen", fenster);
           	dasvollbild.focus();
            
        }
        
        // ScreenHeight
        function getScreenHeight(malus) {
        	var avail_h = 0;
            if( typeof( window.innerWidth ) == "number" ) {
                //Non-IE
                avail_h = window.innerHeight - malus;
            } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
                //IE 6+ in "standards compliant mode"
                avail_h = document.documentElement.clientHeight - malus;
            } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
                //IE 4 compatible
                avail_h = document.body.clientHeight - malus;
            }
            
            return avail_h;
        }
        
        // ScreenWidth
        function getScreenWidth(malus) {
        	var avail_w = 0;
            if( typeof( window.innerWidth ) == "number" ) {
                //Non-IE
                avail_w = window.innerWidth - malus;
            } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
                //IE 6+ in "standards compliant mode"
                avail_w = document.documentElement.clientWidth - malus + 18 - ie6_width_malus;
            } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
                //IE 4 compatible
                avail_w = document.body.clientWidth - malus;
            }
            
            return avail_w;
        }
        
        function initTimeline(left_px) {
            scrollTimelineTo(left_px);
            //alert(getScreenWidth(40));
            var pos_left = getScreenWidth(485)+"px";
            document.getElementById("spaeter_oben").style.left = pos_left;
            document.getElementById("spaeter_unten").style.left = pos_left;
            //alert(document.getElementById("spaeter_oben").style.left);
            //document.getElementById("spaeter_unten").style.left = getScreenWidth(40)+"px";
        }
        
        function scrollTimelineTo(left_px) {
            document.getElementById("timeline-sendungen").scrollLeft = left_px;
        }
        
        function scrollTimelinePrev(left_px) {
            document.getElementById("timeline-sendungen").scrollLeft = document.getElementById("timeline-sendungen").scrollLeft - 190;
        }
        
        function scrollTimelineNext(left_px) {
            document.getElementById("timeline-sendungen").scrollLeft = document.getElementById("timeline-sendungen").scrollLeft + 190;
        }
        
        
        var posx = 0;
        var posy = 0;
            
        function doSomething(e) {
        	
        	if (!e) var e = window.event;
        	if (e.pageX || e.pageY) 	{
        		posx = e.pageX;
        		posy = e.pageY;
        	}
        	else if (e.clientX || e.clientY) 	{
        		posx = e.clientX + document.body.scrollLeft
        			+ document.documentElement.scrollLeft;
        		posy = e.clientY + document.body.scrollTop
        			+ document.documentElement.scrollTop;
        	}
        	// posx and posy contain the mouse position relative to the document
        	// Do something with this information
        }

        
        document.onmousemove = doSomething;
        
        function showSendungTooltip(sendung_id) {
            
            document.getElementById("sendung_tooltip_"+sendung_id).style.left   = (posx-80)+"px";
            document.getElementById("sendung_tooltip_"+sendung_id).style.top    = (posy+20)+"px";
            document.getElementById("sendung_tooltip_"+sendung_id).style.display = "block";
        }
        
        function hideSendungTooltip(sendung_id) {
            document.getElementById("sendung_tooltip_"+sendung_id).style.display = "none";
        }
        
        
        function showEinstellungen(){
            // set the content of the dialog:
            einstellungenDialog.show();
        }
        
        function einstellungenSchliessen() {
            einstellungenDialog.hide();
        }
        
        function showHilfe() {
            var hilfepopup = window.open(server_root_path+"hilfe.html", "HilfePopup", "width=675,height=600,toolbar=yes,location=no,scrollbars=yes,menubar=1");
            hilfepopup.focus();
            
        }
