	var debug=true;
	var language='de';
	var menuSwitchColors=true;
	var activeMenu=-1;
	var activeMenuInnerHTML='';
	var browserStylesheetsIncluded=false;

  function IncludeJavaScript(jsFile)
  {
  document.write('<script type="text/javascript" src="'
    + jsFile + '"></scr' + 'ipt>'); 
  }

  IncludeJavaScript('fileadmin/js/technologie.js');
	
	function switchBG(image) {
		document.getElementById('contentBackgrounder').style.backgroundImage='url(/fileadmin/images/backgrounds/'+image+'.jpg)';
	}
	
	function technologyShow(itemNr) {
	
	    try {
	    
		    
		    var target=document.getElementById('contentRightBottom');
	        target.innerHTML=descriptions[itemNr][language];
	        
	    } catch (e) { if (debug) alert(e); }
	
	}
	
	function showVideo(video, preview) {
	
	   try {
	   
	       var player = swfobject.getObjectById("videoPlayer");                                                                                                        
           flashvars.video=video;
           flashvars.preview=preview;
           flashvars.autoplay=true;
           player.updatePlayer(flashvars);
           //player.start(); 
	   
	   } catch (e) { if (debug) alert(e); }
	
	}
	
	function technologyActivate(itemNr) {
	
	    try {
	        
	        var actions=new Array();
	        
	        //todo label i18n
	    
	        actions={
	            '0': {
	                'de': {
                        'action' : 'showVideo',
                        'video'  : 'schleifwalze_de.flv',
                        'preview': 'schleifwalze_de.jpg'
                    },
                    'en': {
                        'action' : 'showVideo',
                        'video'  : 'schleifwalze_en.flv',
                        'preview': 'schleifwalze_en.jpg'
                    }
                },
                '1': {
                    'de': {
                        'action' : 'showVideo',
                        'video'  : 'breitbandeinheit_de.flv',
                        'preview': 'breitbandeinheit_de.jpg'
                    },
                    'en': {
                        'action' : 'showVideo',
                        'video'  : 'breitbandeinheit_en.flv',
                        'preview': 'breitbandeinheit_en.jpg'
                    }
                },
                '2': {
                    'de': {
                        'action' : 'showVideo',
                        'video'  : 'drahtbuersten_de.flv',
                        'preview': 'drahtbuersten_de.jpg'
                    },
                    'en': {
                        'action' : 'showVideo',
                        'video'  : 'drahtbuersten_en.flv',
                        'preview': 'drahtbuersten_en.jpg'
                    }
                },
                '3': {
                    'de': {
                        'action' : 'showVideo',
                        'video'  : 'lamellenwalzen_de.flv',
                        'preview': 'lamellenwalzen_de.jpg'
                    },
                    'en': {
                        'action' : 'showVideo',
                        'video'  : 'lamellenwalzen_en.flv',
                        'preview': 'lamellenwalzen_en.jpg'
                    }
                },
                '4': {
                    'de': {
                        'action' : 'showVideo',
                        'video'  : 'rotamat_de.flv',
                        'preview': 'rotamat_de.jpg'
                    },
                    'en': {
                        'action' : 'showVideo',
                        'video'  : 'rotamat_en.flv',
                        'preview': 'rotamat_en.jpg'
                    }
                },
                '5': {
                    'de': {
                        'action' : 'showVideo',
                        'video'  : 'vlieslamellenwalze_de.flv',
                        'preview': 'vlieslamellenwalze_de.jpg'
                    },
                    'en': {
                        'action' : 'showVideo',
                        'video'  : 'vlieslamellenwalze_en.flv',
                        'preview': 'vlieslamellenwalze_en.jpg'
                    }
                },
                '6': {
                    'de': {
                        'action' : 'showVideo',
                        'video'  : 'federstahlbuersten_de.flv',
                        'preview': 'federstahlbuersten_de.jpg'
                    },
                    'en': {
                        'action' : 'showVideo',
                        'video'  : 'federstahlbuersten_en.flv',
                        'preview': 'federstahlbuersten_en.jpg'
                    }
                },
                '7': {
                    'de': {
                        'action' : 'showVideo',
                        'video'  : 'wasch_und_trockenstation_de.flv',
                        'preview': 'wasch_und_trockenstation_de.jpg'
                    },
                    'en': {
                        'action' : 'showVideo',
                        'video'  : 'wasch_und_trockenstation_en.flv',
                        'preview': 'wasch_und_trockenstation_en.jpg'
                    }
                }
	        };
	        
	        var action=actions[itemNr][language];
	        
	        switch (action['action']) {
	            
	            case 'showPDF':
	            
                    var url=action['url'];
	                var newWindow=window.open(url, "Technologie", "width=1024,height=768,scrollbars=yes");
	                newWindow.focus();
	            
	                break;
	                
	            case 'showVideo':
	            
                    var video=action['video'];
                    var preview=action['preview'];
	                
	                showVideo(video, preview);
	            
	                break;
	                
	        }
	
	    } catch (e) { if (debug) alert(e);  }
	}

    var includedStylesheets=new Array();

    function includeStylesheet2(stylesheet) {
        var head=document.getElementsByTagName('head').item(0);
        var ss = document.createElement('link');
        ss.setAttribute('rel', 'stylesheet');
        ss.setAttribute('type', 'text/css');
        ss.setAttribute('media', 'screen');
        ss.setAttribute('href', stylesheet);
        head.appendChild(ss);
        includedStylesheets[includedStylesheets.length]=stylesheet;
    }

    function inArray(needle, haystack) {
        for (var i=0; i<haystack.length; i++) {
            if (haystack[i] == needle) {
                return true;
            }
        }
        return false;
    }

    function includeStylesheet(stylesheet) {
        try {
            if (!inArray(stylesheet, includedStylesheets)) {
                includeStylesheet2(stylesheet);
            }
        } catch (e) { if (debug) alert(e); }
    }
    
    function detectBrowser() {
    
        var browser='ff';
            
        if (navigator.userAgent.match(/safari/i)) {
            browser='safari';
        } else if (navigator.userAgent.match(/msie/i)) {
            browser='ie';
        }
        
        return browser;
        
    }
    
    function includeBrowserStylesheets() {
    
        try {
            
            if (browserStylesheetsIncluded) return;
            
            browserStylesheetsIncluded=true;
            
            setLanguage();
            
            var browser=detectBrowser();
            
            if (browser=='') return;
            
            var links=document.getElementsByTagName('LINK');
            
            var length=links.length;
            
            for (var i=0; i<length; i++) {
                var link=links.item(i);
                var href=link.href;
                
                if (href && href.match(/(((https?:\/\/\w+(:\d+)?)?(\w|\/)+\/(layout|menu)\/))(\w+)\.css/)) {
                    
     
                    
                    includeStylesheet('/fileadmin/css/layout/'+RegExp.$7+'_'+language+'.css');
                    includeStylesheet('/fileadmin/css/layout/'+RegExp.$7+'_'+browser+'.css');
                    
                    includeStylesheet(RegExp.$1+RegExp.$7+'_'+language+'.css');
                    includeStylesheet(RegExp.$1+RegExp.$7+'_'+browser+'.css');
                    
                    
                    
                }
                
            }
            
        } catch (e) { if (debug) alert(e); }
    
    }
    
    function removeMenuBottom() {
        //document.getElementById('contentLeftTop').innerHTML=document.getElementById('footer').innerHTML;
        //document.getElementById('footer').innerHTML='&nbsp;';
        document.getElementById('menuBottom').innerHTML='&nbsp;';
    }
    
    function getMenuItemNr(el) {
        
        //count to the left
        var menuItem=0;
        safe=0;
        while (el.previousSibling && safe++<1000) {
            el=el.previousSibling;
            menuItem++;
            safe++;
        }
        if (safe==1000) return 0;
        
        return menuItem;
        
    }
    
    function showDefaultMenu(e) {
        
        var el=null;
        
        //get the active menu item
        
        var menuContainer=document.getElementById('menuTop');
        var menuItem=0;
        for (var i=0; i<menuContainer.childNodes.length; i++) {
            var childNode=menuContainer.childNodes.item(i);
            if (childNode.className=='menuTop1Active') {
                menuItem=i;
            }
        }
        
        //showMenu(getMenuItemNr(el));
        
        showMenu(menuItem);
        
    }
    
    function stopPropagation(e) {
        if (!e) var e=window.event;
        e.cancelBubble=true;
        if (e.stopPropagation) e.stopPropagation();
    }
    
    function getEventSourceElement(e) {
        
        var el;
        if (e.currentTarget) {
            el=e.currentTarget;
        } else if (e.srcElement) {
            el=e.srcElement;
        }
        return el;
        
    }
    
    function hideMenu(e) {
    
        var menuContainer=document.getElementById('menuTop2');
        menuContainer.innerHTML='&nbsp;';
        menuContainer.style.backgroundColor='transparent';
    
    }
    
    function showMenu2(e) {
        
        var el=getEventSourceElement(e);
        
        //IE: get the first DIV element 'upwards'
        var safe=0;
        while (el.tagName.toUpperCase()!='DIV' && safe++<1000) {
            el=el.parentNode;
            safe++;
        }
        if (safe==1000) return;
        
        showMenu(getMenuItemNr(el));
        
        stopPropagation(e);
        
    }
    
    /**
      inits the menu, needed for start page
      if this needs updating:
       - visit every link on main menu and copy the contents of menuTop2 into the menu-var below 
    */
    function showMenu(menuItem) {
    
        var menu=new Array();
        
        menu={
        
            0: {
                'backgroundColor': '#01969D',
                'de': '<div class="menuTop2"><a href="index.php?id=440" onfocus="blurLink(this);">Ernst heute</a></div><div class="menuTop2"><a href="index.php?id=296" onfocus="blurLink(this);">Geschichte</a></div><div class="menuTop2"><a href="index.php?id=304" onfocus="blurLink(this);">Referenzen</a></div>',
                'en': '<div class="menuTop2Active"><a href="index.php?id=440&amp;L=16" onfocus="blurLink(this);">Company</a></div><div class="menuTop2"><a href="index.php?id=296&amp;L=16" onfocus="blurLink(this);">History</a></div><div class="menuTop2"><a href="index.php?id=304&amp;L=16" onfocus="blurLink(this);">References</a></div>'
            },
            1: {
                'backgroundColor': '#FF8A00',
                'de': '<div class="menuTop2"><a href="index.php?id=312" onfocus="blurLink(this);">Modellwahl</a></div><div class="menuTop2"><a href="index.php?id=320" onfocus="blurLink(this);">Technologie</a></div><div class="menuTop2"><a href="index.php?id=328" onfocus="blurLink(this);">Laser Job Shop</a></div><div class="menuTop2"><a href="index.php?id=336" onfocus="blurLink(this);">Edelstahlverarbeiter</a></div><div class="menuTop2"><a href="index.php?id=344" onfocus="blurLink(this);">Stahl-Service-Center</a></div>',
                'en': '<div class="menuTop2"><a href="index.php?id=312&amp;L=16" onfocus="blurLink(this);">Model selection</a></div><div class="menuTop2"><a href="index.php?id=320&amp;L=16" onfocus="blurLink(this);">Technology</a></div><div class="menuTop2"><a href="index.php?id=328&amp;L=16" onfocus="blurLink(this);">Laser Job Shop</a></div><div class="menuTop2"><a href="index.php?id=336&amp;L=16" onfocus="blurLink(this);">Stainless steel</a></div><div class="menuTop2"><a href="index.php?id=344&amp;L=16" onfocus="blurLink(this);">Steel-Service-Center</a></div>'
            },
            2: {
                'backgroundColor': '#AF9873',
                'de': '<div class="menuTop2"><a href="index.php?id=352" onfocus="blurLink(this);">Holzschliff</a></div><div class="menuTop2"><a href="index.php?id=368" onfocus="blurLink(this);">Lackschliff</a></div><div class="menuTop2"><a href="index.php?id=360" onfocus="blurLink(this);">Strukturieren</a></div>',
                'en': '<div class="menuTop2"><a href="index.php?id=352&amp;L=16" onfocus="blurLink(this);">Wood- and Veneersanding</a></div><div class="menuTop2"><a href="index.php?id=368&amp;L=16" onfocus="blurLink(this);">Laquer sanding</a></div><div class="menuTop2"><a href="index.php?id=360&amp;L=16" onfocus="blurLink(this);">Rustical brushing</a></div>'
            },
            3: {
                'backgroundColor': '#90BF19',
                'de': '<div class="menuTop2"><a href="index.php?id=400" onfocus="blurLink(this);">Fachpresse</a></div><div class="menuTop2"><a href="index.php?id=392" onfocus="blurLink(this);">Messen</a></div><div class="menuTop2"><a href="index.php?id=384" onfocus="blurLink(this);">Jobs</a></div><div class="menuTop2"><a href="index.php?id=376" onfocus="blurLink(this);">Gebrauchtmaschinen</a></div>',
                'en': '<div class="menuTop2"><a href="index.php?id=400&amp;L=16" onfocus="blurLink(this);">Technical press</a></div><div class="menuTop2"><a href="index.php?id=392&amp;L=16" onfocus="blurLink(this);">Trade shows</a></div><div class="menuTop2"><a href="index.php?id=384&amp;L=16" onfocus="blurLink(this);">Jobs</a></div><div class="menuTop2"><a href="index.php?id=376&amp;L=16" onfocus="blurLink(this);">Used machines</a></div>'
            },
            4: {
                'backgroundColor': '#225A7F',
                //'backgroundColor': 'transparent',
                'de': '&nbsp;',
                'en': '&nbsp;'
            },
            5: {
                'backgroundColor': '#34ABB3',
                'de': '<div class="menuTop2"><a href="index.php?id=432" onfocus="blurLink(this);">Ansprechpartner</a></div><div class="menuTop2"><a href="index.php?id=424" onfocus="blurLink(this);">Händleradressen</a></div><div class="menuTop2"><a href="index.php?id=416" onfocus="blurLink(this);">Kontaktformular</a></div><div class="menuTop2"><a href="index.php?id=408" onfocus="blurLink(this);">Anfahrt</a></div>',
                'en': '<div class="menuTop2"><a href="index.php?id=432&amp;L=16" onfocus="blurLink(this);">Contact persons</a></div><div class="menuTop2"><a href="index.php?id=424&amp;L=16" onfocus="blurLink(this);">Representatives</a></div><div class="menuTop2"><a href="index.php?id=416&amp;L=16" onfocus="blurLink(this);">Contact form</a></div><div class="menuTop2"><a href="index.php?id=408&amp;L=16" onfocus="blurLink(this);">How to find us</a></div>'
            }
            
        };
        
        if (menuItem==-1) {

            //add onmouseover events to the top-level-menu
            
            var menuContainer=document.getElementById('menuTop');
            for (var i=0; i<menuContainer.childNodes.length; i++) {
                var childNode=menuContainer.childNodes.item(i);
                //should be div's
                if (childNode.attachEvent) {
                    childNode.attachEvent('onmouseover',showMenu2);
                } else if (childNode.addEventListener) {
                    childNode.addEventListener('mouseover',showMenu2,false);
                } else {
                    childNode.setAttribute('onmouseover','javascript: showMenu('+i+');');
                }
            }
            
        } else {

            //show the menu
            
            var menuContainer=document.getElementById('menuTop2');
            menuContainer.innerHTML=menu[menuItem][language];
            if (menuSwitchColors) {
                menuContainer.style.backgroundColor=menu[menuItem]['backgroundColor'];
            } else {
                if (menuItem!=4) {
                    menuContainer.style.backgroundColor='#FF8A00';
                } else {
                    menuContainer.style.backgroundColor='transparent';
                }
            }
        
        }
        
    }
    
    function setLanguage() {
        if (document.location.href.match(/&L=16/)) {
            language='en';
        }
    }
    
    function siteOnLoad() {
    
        
        try {
        
            var bodyElements=document.getElementsByTagName('BODY');
            var bodyElement=bodyElements.item(0);
            
            if (bodyElement.id.match(/uid(\d+)/)) {
                
                var pageId=parseInt(RegExp.$1);
                
                switch (pageId) {
                    
                    case 200:

                        //remove the menu on the bottom (languages/sitemap/etc)             
                        removeMenuBottom();
                        
                        //init menu
                        showMenu(-1);
                        menuSwitchColors=false;
                        
                        if (bodyElement.attachEvent) {
                            bodyElement.attachEvent('onmouseover',hideMenu);
                        } else if (bodyElement.addEventListener) {
                            bodyElement.addEventListener('mouseover',hideMenu,false);
                        } else {
                            bodyElement.setAttribute('onmouseover','javascript: hideMenu();');
                        }
                                    
                        break;
                    
                    default: 
                          var langImprint=document.getElementById('langImprint');
                          if (langImprint!=null) {
                             switch (language) {
                                
                                case 'de' :  langImprint.innerHtml='Impressum'; break;
                                case 'en' :  langImprint.innerHtml='Imprint'; break;
                             }
                         
                             
                            
                       
                          }
                                 
                        //init menu
                        
                        //initActiveMenu();
                       // showMenu(-1);
                        
                       /* if (bodyElement.attachEvent) {
                            bodyElement.attachEvent('onmouseover',showDefaultMenu);
                        } else if (bodyElement.addEventListener) {
                            bodyElement.addEventListener('mouseover',showDefaultMenu,false);
                        } else {
                            bodyElement.setAttribute('onmouseover','javascript: showDefaultMenu();');
                        }*/
                        return;
                        break;
                        
                }
                
                var menuTop=document.getElementById('menuTop');
                var menuTop2=document.getElementById('menuTop2');
               
          
   
  
                
                if (bodyElement.attachEvent) {
                    menuTop2.attachEvent('onmouseover',stopPropagation);
                    menuTop.attachEvent('onmouseover',stopPropagation);
                } else if (bodyElement.addEventListener) {
                    menuTop2.addEventListener('mouseover',stopPropagation,false);
                    menuTop.addEventListener('mouseover',stopPropagation,false);
                } else {
                    menuTop2.setAttribute('onmouseover','javascript: stopPropagation();');
                    menuTop.setAttribute('onmouseover','javascript: stopPropagation();');
                }
                
                
                
                
            }
            
            var menuTop2=document.getElementById('menuTop2');
	    
	        //make 'empty' second-level-menu visible in FF and Safari
            if (menuTop2.innerHTML.length<10) {
                menuTop2.innerHTML=menuTop2.innerHTML+'&nbsp; ';
            }
            
            setLanguage();
            
        
            
        } catch (e) { if (debug) alert(e); }
        
             
    
    }