﻿function BodyHeightSet() 
{ 
    try
    {
        var Tab = document.getElementById("MainTable");
        var Header = document.getElementById("Header");
        var Spacer1 = document.getElementById("Spacer1");
        var NavTopX = document.getElementById("NavTopX");
        var Spacer2 = document.getElementById("Spacer2");
        var Workspace = document.getElementById("Workspace");
        var LeftColumn = document.getElementById("LeftColumn");
        var LeftColumnMain = document.getElementById("LeftColumnMain");
        var Sponsor = document.getElementById("Sponsor");
        ClientHeight = window.innerHeight?window.innerHeight:document.documentElement.clientHeight;
        ClientHeight -=25;
        Tab.style.height = ClientHeight.toString() + "px";
        HeaderHeight = Header.style.height.replace("px","");
        HeaderHeight = parseInt(HeaderHeight,10)
        Spacer1Height = Spacer1.style.height.replace("px","");
        Spacer1Height = parseInt(Spacer1Height,10)
        NavTopXHeight = NavTopX.style.height.replace("px","");
        NavTopXHeight = parseInt(NavTopXHeight,10)
        Spacer2Height = Spacer2.style.height.replace("px","");
        Spacer2Height = parseInt(Spacer2Height,10)
        
        if (Sponsor)
        {
            SponsorHeight = Sponsor.style.height.replace("px","");
            SponsorHeight = parseInt(SponsorHeight,10)
            WorkspaceHeight = ClientHeight - HeaderHeight - Spacer1Height - NavTopXHeight - Spacer2Height - SponsorHeight;
        }
        else
            WorkspaceHeight = ClientHeight - HeaderHeight - Spacer1Height - NavTopXHeight - Spacer2Height;
        
        var RightColomn = document.getElementById("RightColumn");
        
        if (RightColomn)
        {
            
            if (Sponsor)
            {
                if ((RightColomn.offsetHeight - SponsorHeight) > WorkspaceHeight)
                WorkspaceHeight = RightColomn.offsetHeight - SponsorHeight;
            }
            else
            if (RightColomn.offsetHeight > WorkspaceHeight)
                WorkspaceHeight = RightColomn.offsetHeight
            
            
            var RightTop = document.getElementById("RightTopItems");
            var RightBottom = document.getElementById("RightBottomItems");
            
            if (RightTop && RightBottom)
            {
                //alert(RightColomn.offsetHeight + ' - ' + RightTop.offsetHeight + ' - ' + RightBottom.offsetHeight);
                _rightbottom = RightColomn.offsetHeight - RightTop.offsetHeight;
                
                RightBottom.style.height = _rightbottom.toString() + "px";
            }
            
            
            
        }
        
        /*
        if (LeftColumn) 
        {
            LeftColumn.style.height = Workspace.style.height;
            var LeftColumnItem = document.getElementById("LeftColumnItem");
            LeftColumnItemHeight = WorkspaceHeight - 85;
            LeftColumnItem.style.height = LeftColumnItemHeight.toString() + "px";
        }
        */
        if (LeftColumnMain)
        {
            LeftColumnMainHeight = LeftColumnMain.offsetHeight;
            if (LeftColumnMainHeight >  WorkspaceHeight)
                WorkspaceHeight = LeftColumnMainHeight;
        }
        
        Workspace.style.height = WorkspaceHeight.toString() + "px";
    }
    catch(er)
    {}
} 

function GoNext(url, type)
{  
    GoNextAdv(url, type, "");
}
function GoNextAdv (url, type, NewWindow)
{
    var Workspace = document.getElementById("Workspace");
    var Height = parseInt(Workspace.style.height.replace("px",""),10) + 100;
    if (type!="0")
    {
        RightHeight = document.getElementById("RightColumn").offsetHeight + 50;
        url += "&Height=" + RightHeight + "px";
    }
    
    if (typeof(type)=="undefined")
        location.href = url;
    else
    {
        if (type==0)
            openWindow(url);
        else
        {
            var WRMain = document.getElementById("WRMain");
            if (WRMain)
            {
                search = "url=";
                pos = url.indexOf(search);
                if (pos>0)
                {
                    pos = pos + search.length;
                    url = url.substr(pos);
                }
                WRMain.src = unescape(url);
                WRMain.style.height = Height + "px";
                
            }
            else
                location.href = url;
         }
    }
}

function openWindow(url)
{
    var theWindow = window.open(url,"_new","toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800, height=600, top=0, left=0");
    theWindow.focus();
}

function savelink() 
{ 
   var url=location.href; 
   var title=document.title; 

   if(window.external) {                           // add IE favorite 
      external.AddFavorite(url,title); 
   } else if(window.sidebar && sidebar.addPanel) { // add to FF bookmarks 
      sidebar.addPanel(title,url,''); 
   } else {                                        // unknown browser: report user 
      alert("Browser onbekend, voeg itac.nl zelf toe aan 'Uw favorieten'."); 
   } 


} 

