/*++
/*============================================================================
/* Produced by Logica UK, Energy & Utilities Division.
/* Copyright (c) 2000 Logica UK Ltd.
/*
/* FILENAME:    floatbar.ujs
/* VERSION:     1.5
/* PATHNAME:    /app/kfigkernel/master/neta/sw/bmra/server/bsp/js/s.floatbar.ujs
/* LAST CHANGE: 08/06/26
/*
/* DESCRIPTION
/* The javascript file used for making the left side menu move along with the
/* scroll of the page
/*============================================================================
--*/
/*============================================================================
Define the initial vertical coordinate of the menu, and define which div the 
menu is placed in
==============================================================================*/
var target_y= 30;
var has_inner = typeof(window.innerWidth) == 'number'; 
var floating_menu = document.getElementById('leftcolumnwrapper');
/*============================================================================
Create the variables the will hold the shifting steps when we scroll on the page
==============================================================================*/
var fm_shift_y, fm_next_y;
function calculate_shifts()
{    fm_shift_y = document.documentElement.scrollTop;
    if (target_y < 0)

        fm_shift_y += has_inner  ? window.innerHeight  : has_element  ? document.documentElement.clientHeight : document.body.clientHeight;
};
function menu_floating()
{    var   step_y;
    calculate_shifts();
    step_y = (fm_shift_y + target_y - fm_next_y) * .07;
    if (Math.abs(step_y) < .5)
        step_y = fm_shift_y + target_y - fm_next_y;
    if (Math.abs(step_y) > 0)
    {    fm_next_y += step_y;
		 floating_menu.style.top = fm_next_y + 'px';
    }
/*============================================================================
Call the menu_floating function every a fixed period of time. This will get the current
vertical coordinate that visible part of the page is(by calling the calculate_shifts) and then will 
start placing the script with distance of target_y from the top of the part of the 
screen that is visible at that time.
==============================================================================*/
   setTimeout('menu_floating()', 30);
};
calculate_shifts();
fm_next_y = fm_shift_y + target_y;
floating_menu.style.top = fm_next_y + 'px';
//Enable floating only for IE
if(!(document.implementation && document.implementation.createDocument)){menu_floating();}
