 $(document).ready(function(){
							 
	 //$('#pane4').jScrollPane();
	 $('a.modal1').smart_modal();
	 matchHeight() ;
	 
	 
	 var $pane4 = $('#pane4');
				$pane4.jScrollPane({animateTo:true});
				$('a.scroll-to-description').bind(
					'click',
					function()
					{
						var targetElementSelectorString = $(this).attr('rel');
						$pane4[0].scrollTo(targetElementSelectorString);
						return false;
					}
				);
				
				 $("img.showtip").mouseover(function(){
						var targetElementSelectorString = $(this).attr('alt');
						//$pane4[0].scrollTo(targetElementSelectorString);
						$("#titelcontainer").html(targetElementSelectorString) 
						return false;
					}
				);
	 matchHeight() ;



  });
 
 


//match
 	matchHeight=function(){
         var divs,contDivs,maxHeight,divHeight,d;
         // get all <div> elements in the document
         divs=document.getElementsByTagName('div');
         contDivs=[];

         // initialize maximum height value
         maxHeight=300;
		 maximalHeight=$(window).height()-260 ;
         // iterate over all <div> elements in the document
         for(var i=0;i<divs.length;i++){
              // make collection with <div> elements with class attribute 'container'
			   if(/\bcontainer\b/.test(divs[i].className)){
                    d=divs[i];
                    contDivs[contDivs.length]=d;
                    // determine height for <div> element
                    if(d.offsetHeight){
                         divHeight=d.offsetHeight;
                    }
                    else if(d.style.pixelHeight){
                         divHeight=d.style.pixelHeight;
                    }
                    // calculate maximum height
                    maxHeight=Math.max(maxHeight,divHeight);
              }

         }
		 
		  maxHeight = maximalHeight + 40  ; 
		   if (maxHeight < 400) {maxHeight = 400 ;}		  
		 document.getElementById('contentcontainer').style.height=maxHeight + 'px';
		 document.getElementById('pane4').style.height=maxHeight + 'px';
		 $('#pane4').parent().get(0).style.height=maxHeight + 'px';
		 document.getElementById('inhalt').style.height=maxHeight + 'px';
		 $('#pane4').jScrollPane( {bottomCapHeight:2, reinitialiseOnImageLoad: false} );
		 
    }

   
	
	jQuery.event.add(window, "resize", resizeFrame);

		function resizeFrame() 
		{
			matchHeight();
			//$('#pane3').jScrollPane( {reinitialiseOnImageLoad: false} );
		    $('#pane4').jScrollPane( {bottomCapHeight:2, reinitialiseOnImageLoad: false} );
		}
		


			reinitialiseScrollPane = function()
				{
					//$('#pane1').jScrollPane();
					 matchHeight();
					 //$('#pane3').jScrollPane({reinitialiseOnImageLoad: false});
					 $('#pane4').jScrollPane({bottomCapHeight:2, reinitialiseOnImageLoad: false});
					var pane4top = parseInt( $('#pane4').offset().top);
					var $pane4 = $('#pane4');
					$pane4[0].scrollTo(0);
				}
		
		function pageload (documentID,projektID,h,w) {
			//alert("UHU  "+  documentID)
			//$('#sm_content').css('width',.css('height', (max_height)+'px').css('margin-left', '-'+(max_width/2)+'px');
			var ml = (w/2)-8 ;																					 
			//$('#sm_content').css('width', w+"px");
			//$('#sm_content').css('height', h+"px");
			//$('#sm_content').css('margin-left', -ml+"px");
			$('#sm_content').load('gallery.cfm?projekt='+projektID+'&nr='+documentID);
			
			}
		function pageformat (h,w) {
			var ml = (w/2)-8 ;																					 
			$('#sm_content').css('width', w+"px");
			$('#sm_content').css('height', h+"px");
			$('#sm_content').css('margin-left', -ml+"px");
		}
			
		function closemodal ()  {
			$("#sm_content").remove();
			$("#sm_olay").remove();	
			}

