    var imgId = 'basicMapImageContainer';    //Die Id des Bildes, welches die grösse verändern muss
    var minWidth = 390;                      //entspricht der Minimum Weite des Bildes, hier gleich Weit wie TabReiter!!!
    var minHeight = 300;                     //enstpricht der Minimum Höhe des Bildes
    var tabControlHeader = 'tabControlHeaderContainer';

    var oldHeight = null;
    var oldWidth = null;
    var width = null;
    var height;
    var timerID = null;

    function screenWidth()
    {
        var middleWidth = 0; 
                
        if (minWidth <= 0)
            minWidth = 400;
        
        if (window.innerWidth != null)
        {
            if (!document.getElementById(tabControlHeader).clientWidth)
                middleWidth = document.getElementById(tabControlHeader).offsetWidth - 30;//28
            else
                middleWidth = document.getElementById(tabControlHeader).clientWidth - 30;//28
            
            if (middleWidth < minWidth)
                return minWidth;
            else
                return middleWidth;
        }
        else if (document.body.clientWidth != null)
        {
            middleWidth = document.getElementById(tabControlHeader).clientWidth - 34;
            if (middleWidth < minWidth)
                return minWidth;
            else
                return middleWidth;
        }
        else
            return minWidth
    }

    function screenHeight()
    {
        var headerHeight = 0;
        var footerHeight = 0;
        var availableImageHeight = 0;
        var bodyHeightDiff = 0;

        minHeight = document.getElementById('rightColumn').clientHeight - 20;    //Minimum Höhe des Bildes muss auch im Html img Tag angepasst werden, nicht als Style Height definieren
        
        if (minHeight <= 0)
            minHeight = 300;
        
        if (window.innerHeight!=null)
        {
            bodyHeightDiff = 100;
            if (!document.getElementById('masthead').offsetHeight)
            {
                headerHeight = document.getElementById('masthead').offsetHeight;
                footerHeight = document.getElementById('footer').offsetHeight;
                minHeight = document.getElementById('rightColumn').offsetHeight - linkContainerHeight - 50;
            }
            else
            {
                headerHeight = document.getElementById('masthead').clientHeight;
                footerHeight = document.getElementById('footer').clientHeight;
                minHeight = document.getElementById('rightColumn').clientHeight - 15;
            }
            
            availableImageHeight = window.innerHeight - headerHeight - footerHeight  - bodyHeightDiff; //
           
            if (availableImageHeight < minHeight || availableImageHeight + bodyHeightDiff == window.innerHeight)
                return minHeight;
            else
                return availableImageHeight;
        }
        else if( document.documentElement && document.documentElement.clientHeight)
        {
            bodyHeightDiff = 100;
            headerHeight = document.getElementById('masthead').clientHeight;
            footerHeight = document.getElementById('footer').clientHeight;

            minHeight = document.getElementById('rightColumn').clientHeight - 15;
            
            availableImageHeight = document.documentElement.clientHeight - headerHeight - footerHeight - bodyHeightDiff; //measureDistanceContainer - functionsContainerHeight - 

            if (availableImageHeight < minHeight)
                return minHeight;
            else
                return availableImageHeight;
        }
        else if ( document.body && document.body.clientHeight)
        {
            bodyHeightDiff = 100;
            headerHeight = document.getElementById('masthead').clientHeight;
            footerHeight = document.getElementById('footer').clientHeight;

            minHeight = document.getElementById('rightColumn').clientHeight - 15;
            
            availableImageHeight = document.body.clientHeight - headerHeight - footerHeight - bodyHeightDiff; //measureDistanceContainer - functionsContainerHeight - 

            if (availableImageHeight < minHeight)
                return minHeight;
            else
                return availableImageHeight;
        }
        else
            return minHeight;
    }
    
    function tabItemWidth()
    {
        var middleWidth = 0; 
        minWidth = 150;
        
        if (window.innerWidth != null)
        {
            if (!document.getElementById(tabControlHeader).clientWidth)
                middleWidth = document.getElementById(tabControlHeader).offsetWidth - 22;
            else
                middleWidth = document.getElementById(tabControlHeader).clientWidth - 22;
                    
            if (middleWidth < minWidth)
                return minWidth;
            else
                return middleWidth;
        }
        else if (document.body.clientWidth != null)
        {
            middleWidth = document.getElementById(tabControlHeader).clientWidth - 22;
            if (middleWidth < minWidth)
                return minWidth;
            else
                return middleWidth;
        }
    }
    
    function tabItemHeight()
    {
        var middleHeight=0;
    
        if (window.innerHeight != null)
        {
            middleHeight = 535;
                return middleHeight;
        }
        else if (document.body.clientHeight != null)
        {
            middleHeight = 545;
                return middleHeight;
        }
        else
        {
            return 535;
        }
    }
    
    function resizeHandler(evt)
    {
        if (document.getElementById(imgId))
        {
            eventAvailable = false;
            if (window.innerHeight)
            {
                width = screenWidth();
                height = screenHeight();
                
                if (!((width == document.getElementById(imgId).clientWidth) && (height == document.getElementById(imgId).clientHeight)))
                {    
                    showSplashImage();
                    __doPostBack('ZHPlanResize', width + ";" + height);
                }
            }
            else if (document.body.clientHeight!=null)
            {
                if (timerID) {
                    clearTimeout(timerID);
                }

                timerID=setTimeout("ieSet ()", 500); 

                return false;
            }
        }
        else if (document.getElementById('ViewerContainer'))
        {           
            var itemWidth = tabItemWidth();
            var itemHeight = tabItemHeight();
           
            document.getElementById('dvInfoResultsContainer').style.width = (itemWidth + 20) + 'px';
            document.getElementById('dvInfoResultsContainer').style.height = (itemHeight + 20) + 'px';
            InitFotoViewerSize();
        }
        else if (document.getElementById('dvInfoResultsContainer'))
        {
            var itemWidth = tabItemWidth();
            var itemHeight = tabItemHeight();
           
            document.getElementById('dvInfoResultsContainer').style.width = itemWidth + 'px';
            document.getElementById('dvInfoResultsContainer').style.height = itemHeight + 'px';
        }
        else if (document.getElementById('grdSearchResultsContainer'))
        {
            var itemWidth = tabItemWidth();
            var itemHeight = tabItemHeight();
           
            document.getElementById('grdSearchResultsContainer').style.width = itemWidth + 'px';
            document.getElementById('grdSearchResultsContainer').style.height = itemHeight + 'px';
        }
        else if (document.getElementById('tblSearchAddressContainer'))
        {
            var itemWidth = tabItemWidth();
            var itemHeight = tabItemHeight();
           
            document.getElementById('tblSearchAddressContainer').style.width = itemWidth + 'px';
            document.getElementById('tblSearchAddressContainer').style.height = itemHeight + 'px';
        }


        if (InfoSizeChanged())
            InfoSizeChanged();
    }
    
    function ieSet ()
    {
        width = screenWidth();
        height = screenHeight();
        
        if (width >= minWidth)
        {
            if (!((width + 'px' == document.getElementById(imgId).style.width) && (height + 'px' == document.getElementById(imgId).style.height)))
            {
                __doPostBack('ZHPlanResize', width + ";" + height);
            }
        }
   }

   function initImage()
   {
        if (document.getElementById(imgId) != null)
        {
            
            width = screenWidth();
            height = screenHeight();
                        
            if (window.innerHeight)
            {
                if (!((width == document.getElementById('ctl00_ZHPlanDesign_ZHPlanTabControl_MapImage_constWidth').value) && (height == document.getElementById('ctl00_ZHPlanDesign_ZHPlanTabControl_MapImage_constHeight').value)))
                {
                    showSplashImage();
                    eventAvailable = false;
                    __doPostBack('ZHPlanResize', width + ";" + height);
                }
            }
            else if (document.body != null && document.body.offsetHeight != null)   //Für IE zuständig
            {
                if (!((width == document.getElementById('ctl00_ZHPlanDesign_ZHPlanTabControl_MapImage_constWidth').value) && (height == document.getElementById('ctl00_ZHPlanDesign_ZHPlanTabControl_MapImage_constHeight').value)))
                {   
                    showSplashImage();
                    eventAvailable = false;
                    __doPostBack('ZHPlanResize', width + ";" + height);
                }
            }
        }
   }

    function sizeImage()
    {
        width = screenWidth();
        height = screenHeight();

        document.getElementById('ctl00_ZHPlanDesign_ZHPlanTabControl_MapImage_ImageSizeX').value='';
        document.getElementById('ctl00_ZHPlanDesign_ZHPlanTabControl_MapImage_ImageSizeY').value='';

        if (window.innerHeight != null) //Für FireFox, Mozilla, Netscape, Opera zuständig
        {
            document.getElementById(imgId).width = width;
            document.getElementById(imgId).height = height;

            document.getElementById('ctl00_ZHPlanDesign_ZHPlanTabControl_MapImage_ImageSizeX').value = document.getElementById(imgId).width;
            document.getElementById('ctl00_ZHPlanDesign_ZHPlanTabControl_MapImage_ImageSizeY').value = document.getElementById(imgId).height;
        }
        else if (document.body != null && document.body.offsetHeight != null)   //Für IE zuständig
        {
            document.getElementById(imgId).style.width = width;
            document.getElementById(imgId).style.height = height;
            
            document.getElementById('ctl00_ZHPlanDesign_ZHPlanTabControl_MapImage_ImageSizeX').value = width;
            document.getElementById('ctl00_ZHPlanDesign_ZHPlanTabControl_MapImage_ImageSizeY').value = height;
        }
    }
