			var delta=10; // scroll delta for mouse
			scrollPos = 0;
			speed=5;
			alreadyScrolled = false;
			scrollMe="";
			var isMouseOver = false;
			var COLOR_CODE_ORANGE = 'rgb(255, 153, 51)';
			var COLOR_CODE_GREY = 'rgb(153, 153, 153)';
			
			var CLASS_ACTIVE_LEVEL1 = 'activeLevel1';
			var CLASS_ACTIVE_LEVEL2 = 'activeLevel2';
			var CLASS_ACTIVE_LEVEL3 = 'activeLevel3';
			var CLASS_INACTIVE_LEVEL1 = 'inactiveLevel1';
			var CLASS_INACTIVE_LEVEL2 = 'inactiveLevel2';
			var CLASS_INACTIVE_LEVEL3 = 'inactiveLevel3';
			
					
			function showPopup(file,layout){
			    var options = layout + ',status=no,toolbar=no,menubar=no,location=no';
			    window.open(file,null,options);
			}
			
			function handle(delta) {
	            
	            //alert('delta:' + delta);
	            
	            if (delta < 0){
	                top.scrollMenuUp();
	            }else{
	                top.scrollMenuDown();
	            }
            }

		   function onMouseOver(event){
                
            }
			
			
		   function onMouseWheel(event){
			   //alert('isMouseOver:' + document.location.href + " " + isMouseOver );
	            
			   if(!isMouseOver){
				   return true;
			   }
			   
			   var delta = 0;
	            if (!event) event = window.event;
	            if (event.wheelDelta) {
		            delta = event.wheelDelta/120; 
		            if (window.opera) delta = -delta;
	            } else if (event.detail) {
		            delta = -event.detail/3;
	            }
	            if (delta){
	            if (delta > 0){
	                    top.scrollMenuUpSingle();
	                }else{
	                    top.scrollMenuDownSingle();
	                }
		        }
            }
			

		   function onMouseWheelMain(event){
			   //alert('isMouseOver in Main:' + document.location.href + " " + isMouseOver );
			   if(!isMouseOver){
				   return true;
			   }
			   
	            var delta = 0;
	            if (!event) event = window.event;
	            if (event.wheelDelta) {
		            delta = event.wheelDelta/120; 
		            if (window.opera) delta = -delta;
	            } else if (event.detail) {
		            delta = -event.detail/3;
	            }
	            if (delta){
	                if (delta > 0){
	                    top.scrollUpSingle();
	                }else{
	                    top.scrollDownSingle();
	                }
		        }
            }
			

			function scrollMenuDown() {
			    
				clearTimeout(scrollMe);
				scrollPos +=speed;
				window.frames["innermenuportfolio_name"].scrollTo(0,scrollPos);
				scrollMe=setTimeout("scrollMenuDown()",50);
				if(scrollPos>window.frames["innermenuportfolio_name"].document.body.scrollHeight - (parseInt(document.getElementById("innermenuportfolio_id").style.height)-10)){
					scrollPos=window.frames["innermenuportfolio_name"].document.body.scrollHeight - (parseInt(document.getElementById("innermenuportfolio_id").style.height)-10)
					clearTimeout(scrollMe);
				}

			}
			
			function scrollMenuDownSingle() {
			    
				scrollPos +=delta;
				window.frames["innermenuportfolio_name"].scrollTo(0,scrollPos);
				if(scrollPos>window.frames["innermenuportfolio_name"].document.body.scrollHeight - (parseInt(document.getElementById("innermenuportfolio_id").style.height)-delta)){
					scrollPos=window.frames["innermenuportfolio_name"].document.body.scrollHeight - (parseInt(document.getElementById("innermenuportfolio_id").style.height)-delta)
				}

			}


			function scrollThumbsRight(initialScrollPos, mouseTriggered) {
			    //alert('Scroll right, initialScrollPos:' + initialScrollPos + ", moustriggered:" + mouseTriggered);
			    if(initialScrollPos > 0 && !alreadyScrolled){
			        scrollPos = initialScrollPos;
			        alreadyScrolled = true;
			    }
				//clearTimeout(scrollMe);
				scrollPos +=speed;
				window.frames["galleryThumbsList_name"].scrollTo(scrollPos,0);
				if(mouseTriggered) scrollMe=setTimeout("scrollThumbsRight(" + initialScrollPos + "," + mouseTriggered +")",50);
				if(scrollPos>window.frames["galleryThumbsList_name"].document.body.scrollHeight - (parseInt(document.getElementById("galleryThumbsList_id").style.height)-10)){
					scrollPos=window.frames["galleryThumbsList_name"].document.body.scrollHeight - (parseInt(document.getElementById("galleryThumbsList_id").style.height)-10)
					if (mouseTriggered) clearTimeout(scrollMe);
				}

			}


			function scrollThumbsLeft(initialScrollPos, mouseTriggered) {
			    //alert('Scroll left, initialScrollPos:' + initialScrollPos);
			    if(initialScrollPos > 0 && !alreadyScrolled){
			        scrollPos = initialScrollPos;
			        alreadyScrolled = true;			        
			    }
				if(mouseTriggered) clearTimeout(scrollMe);
				scrollPos -=speed;
				window.frames["galleryThumbsList_name"].scrollTo(scrollPos,0);
				if(mouseTriggered) scrollMe=setTimeout("scrollThumbsLeft(" + initialScrollPos + "," + mouseTriggered +")",50);

				if(scrollPos<speed){
					scrollPos=0;
					if(mouseTriggered) clearTimeout(scrollMe);
				}
			}


			function scrollMenuUp() {
				clearTimeout(scrollMe);
				scrollPos -=speed;
				window.frames["innermenuportfolio_name"].scrollTo(0,scrollPos);
				scrollMe=setTimeout("scrollMenuUp()",50);

				if(scrollPos<speed){
					scrollPos=0;
					clearTimeout(scrollMe);
				}
			}

			function scrollMenuUpSingle() {
			    
				scrollPos -=delta;
				window.frames["innermenuportfolio_name"].scrollTo(0,scrollPos);

				if(scrollPos<delta){
					scrollPos=0;
				}
			}


			function scrollDown(mouseTriggered) {
				//alert("scroll down");
				
				var totalHeight;
				
				if(mouseTriggered){
					clearTimeout(scrollMe);
				}
				scrollPos +=speed;	
				top.frames["iframeMain"].scrollTo(0,scrollPos);
				if(mouseTriggered){
					scrollMe=setTimeout("scrollDown("+mouseTriggered+")",50);
				}
				
				totalHeight = top.frames["iframeMain"].document.body.scrollHeight - (parseInt(document.getElementById("iframeMain").style.height)-10);
				
				if(scrollPos>totalHeight){
					scrollPos = totalHeight;
					if(mouseTriggered){
						clearTimeout(scrollMe);
					}
				}

			}
			function scrollUp() {
				clearTimeout(scrollMe);
				scrollPos -=speed;
				top.frames["iframeMain"].scrollTo(0,scrollPos);
				scrollMe=setTimeout("scrollUp()",50);

				if(scrollPos<speed){
					scrollPos=0;
					clearTimeout(scrollMe);
				}
			}

			function scrollDownSingle() {
			    clearTimeout(scrollMe);
				scrollPos +=delta;
				top.frames["iframeMain"].scrollTo(0,scrollPos);
				if(scrollPos>top.frames["iframeMain"].document.body.scrollHeight - (parseInt(document.getElementById("iframeMain").style.height)-delta)){
					scrollPos=top.frames["iframeMain"].document.body.scrollHeight - (parseInt(document.getElementById("iframeMain").style.height)-delta)
				}

			}



			function scrollUpSingle() {
				scrollPos -=delta;
				top.frames["iframeMain"].scrollTo(0,scrollPos);

				if(scrollPos<delta){
					scrollPos=0;
				}
			}

			function stopMe(){
				clearTimeout(scrollMe);
			}		


	function loadInMain(url){
		loadInMain(url,true);
	}



	function loadInMain(url,showScrollButtons,linkId){
	
	    var linkList = document.getElementsByName('link');
	    for(var i=0;i<linkList.length;i++){
	      linkList[i].className = CLASS_INACTIVE_LEVEL1;
	    }
	    classElement(linkId,CLASS_ACTIVE_LEVEL1);
	
			var iframeList = top.document.getElementsByName('iframeMain');
			iframeList[0].src = url;
			visibleElement('scrollButtonUp',showScrollButtons);			
			visibleElement('scrollButtonDown',showScrollButtons);	
			closePortfolioMenu();		
	}


	function loadGallerySingle(uri){
			var iframeList = top.document.getElementsByName('iframeMain');
			var scrollLeft = document.body.scrollLeft;
			iframeList[0].src = uri + '&scrollpos=' + scrollLeft;
	}

	
	
	function displayElement(id,show){
		var element = top.document.getElementById(id);
		if(!show){
			element.style.display = 'none';
		}else{
			element.style.display = '';
		}		
	}

	function visibleElement(id,show){
		var element = top.document.getElementById(id);
		if(element != null){
		    if(!show){
			    element.style.visibility = 'hidden';
		    }else{
			    element.style.visibility = 'visible';
		    }		
		}
	}
	
	function classElement(id,className){
		var element = document.getElementById(id);
		if(element != null){
  		element.className = className;
		}
	}



	function hideMenuItemByName(item){
		document.getElementById(item).firstChild.visible = false;
	}

	function hideMenuItem(obj){
		if (obj.style.display == "none"){
			obj.style.display = "";
		}else{
			obj.style.display = "none";
		}
	}

	function toggleSubMenu(rootCategory){
		
		var url = 'portfoliolevel2main.php?' + 'category=' + rootCategory;			
		var iframeList = top.document.getElementsByName('iframeMain');
			
		iframeList[0].src = url;
		document.location.href='indexmenu.php?target=portfolio&area=p&category=' + rootCategory;
		
								
	}

	function toggleGallerySubMenu(rootCategory){
		
		var url = 'gallerylevel2main.php?' + 'category=' + rootCategory;			
		var iframeList = top.document.getElementsByName('iframeMain');
			
		iframeList[0].src = url;
		document.location.href='indexmenu.php?target=portfolio&area=g&category=' + rootCategory;
		
								
	}

		function openPortfolioSub(categoryUri){
		  
			var url = 'portfoliosub.php?' + categoryUri  + '&from=1&to=12';			
			top.location.href=url;

		}

		function openGallerySub(categoryUri){
		  
			var url = 'gallerysub.php?' + categoryUri  + '&target=gallery&from=1&to=12';			
			top.location.href=url;

		}


		function togglePortfolioMenu(){

			 //show main scroll buttons
			  visibleElement('scrollButtonUp',true);			
			  visibleElement('scrollButtonDown',true);			
			  var iframeList = top.document.getElementsByName('iframeMain');
			  var currentSrc = new String(iframeList[0].src);
			  if(currentSrc.lastIndexOf('portfoliomain.php') == -1){
				  iframeList[0].src = 'portfoliomain.php';
				  
			  }

		      if(!portfolioExpanded){
                document.location.href='indexmenu.php?category=root&area=p&target=portfolio';
              }else{
                document.location.href='indexmenu.php?area=p&target=portfolio';              
              }

			 
		     return portfolioExpanded;
		}


		function toggleGalleryMenu(){
				

			 //show main scroll buttons
			  visibleElement('scrollButtonUp',true);			
			  visibleElement('scrollButtonDown',true);			
			  var iframeList = top.document.getElementsByName('iframeMain');
			  var currentSrc = new String(iframeList[0].src);
			  if(currentSrc.lastIndexOf('gallerymain.php') == -1){
				  iframeList[0].src = 'gallerymain.php';
				  
			  }

		      if(!galleryExpanded){
                document.location.href='indexmenu.php?category=root&area=g&target=gallery';
              }else{
                document.location.href='indexmenu.php?area=g&target=gallery';              
              }
			 
		     return galleryExpanded;
		}

		function closePortfolioMenu(){
		
	     try{
				  portfolioExpanded=false;		   	 	
		          var strDisplay = '';
		          var objTableBody = document.getElementById( "idPortfolioTableBody" );
		          
		          // Toggle the table
		          objTableBody.style.display = 'none';
	     }
	     
	     catch( expError ){
	          //alert( expError.number + "   " + expError.description );
	     }

		     return portfolioExpanded;
		}

		function closeGalleryMenu(){
		
	     try{
				  galleryExpanded=false;		   	 	
		          var strDisplay = '';
		          var objTableBody = document.getElementById( "idGalleryTableBody" );
		          
		          // Toggle the table
		          objTableBody.style.display = 'none';
	     }
	     
	     catch( expError ){
	          //alert( expError.number + "   " + expError.description );
	     }

		     return galleryExpanded;
		}

       
   		function sendForm(){
   		    if(document.forms[0].search.value != ''){
			    document.form.submit();
			}else{
			    alert('leer');
			}
			return false;
		}
		
		function handleKeyPress(e){			
			alert(e);
			var key=e.keyCode;
			if (key==13){
				sendForm();
			}
		}
		
		function onEnter(e){
			var keynum;
			var keychar;
			var numcheck;

			if(window.event){
			  keynum = e.keyCode;
			}else if(e.which){
			  keynum = e.which;
			}else if(e.keyCode){
			  keynum = e.keyCode;
			}
			
			alert(keynum);
			
			if (keynum==13){
				sendForm();
			}
		}
		
		function verifySearchField(){
		    var result = false;
		    //alert ('verify search field');
		    if(document.forms[0].search.value != ''){
			    result = true
			}
			return result;
		}
		
		function onScrollKeyPressed(e){

            var keynum;

			if(window.event){
			  keynum = e.keyCode;
			}else if(e.which){
			  keynum = e.which;
			}else if(e.keyCode){
			  keynum = e.keyCode;
			}
			//alert(keynum);
			
			if(keynum==34){
			    scrollPageDown();
			}else if(keynum==33){
			    //alert('Scroll Up');
			    scrollPageUp();
			}else if (keynum == 37){ //left
				parent.frames[1].scrollThumbsLeft(parent.frames[1].scrollPos);
			}else if (keynum == 40){
			    scrollDown(false);
			    stopMe();
			}else if (keynum == 38){
			    scrollUp();
			    stopMe();
			}else if (keynum == 39){ //right
				top.frames[1].scrollThumbsRight(top.frames[1].scrollPos);
			    stopMe();
			}else if (keynum == 35){
			    scrollBottom();
			}else if (keynum == 36){
			    scrollTop();
			}
			return false;
			//alert(keynum);
			
		}
		
		function onPrevNextKeyPressed(e){
			
            var keynum;

			if(window.event){
			  keynum = e.keyCode;
			}else if(e.which){
			  keynum = e.which;
			}else if(e.keyCode){
			  keynum = e.keyCode;
			}
			//alert(keynum);
			
			if(keynum==39){
				parent.frames[1].navigateUri(parent.frames[1].nextImageUri);
			}else if(keynum==33){			    
			    scrollPageUp();
			}else if (keynum == 37){
				parent.frames[1].navigateUri(parent.frames[1].prevImageUri);
			}else if (keynum == 40){
			    scrollDown(false);
			    stopMe();
			}else if (keynum == 38){
				parent.frames[1].navigateUri(parent.frames[1].mainImageUri);			    
			}
			return true;	
			//alert(keynum);
			
		}
		
		function navigateUri(targetUri){
			//alert('NavigateUri ' + targetUri);
		    if(targetUri != ''){
		        document.location.href = targetUri;
		    }
		}
		
		function mainNavigateLeft(){
		    window.frames["iframeMain"].navigateLeft();
		}
		
		function scrollPageUp() {
			if(scrollPos >= 500){
				scrollPos -=500;
			}
			top.frames["iframeMain"].scrollTo(0,scrollPos);
			//scrollMe=setTimeout("scrollUp()",50);

			//if(scrollPos<speed){
			//	scrollPos=0;
			//	clearTimeout(scrollMe);
			//}
		}

		function scrollBottom() {
			
			var windowHeight; 
			
			if (typeof window.innerHeight == 'undefined'){
				windowHeight = document.body.offsetHeight				
			}else{
				windowHeight = window.innerHeight;
			}						
			if(top.frames.length >0){
				top.frames["iframeMain"].scrollTo(0,windowHeight+200);
			}
		}

		function scrollTop() {
			
			var windowHeight = (typeof window.outerHeight == 'undefined') 
            ? document.body.offsetHeight 
            : window.outerHeight;

						
			if(top.frames.length >0){
				top.frames["iframeMain"].scrollTo(0,0);
			}
		}

		
		function scrollPageDown() {
			
			var windowHeight; 
			
			if (typeof window.outerHeight == 'undefined'){
				windowHeight = document.body.offsetHeight				
			}else{
				windowHeight = window.outerHeight;
			}
			
			//alert('Top Frames' + top.frames + ' outerHeight:' + windowHeight)
			if(scrollPos + 500 < windowHeight){
				scrollPos +=500;
			}
			
			if(top.frames.length >0){
				top.frames["iframeMain"].scrollTo(0,scrollPos);
			}
		}
		
		function downloadMessage(){
            alert('Die Bilder dieser Web Site sind Copyright geschützt.\nDownloads und Vervielfaeltigungen ohne mein Einverstaendnis sind nicht gestattet');        
        }
