﻿/// <reference path="jquery-1.3.1-vsdoc.js"/>

var __ftst = 0;
var __ftsl = 0;
var __ftmt = 0;

function __Floatjq()
{
    var elm = $('#__Float_Top');
    var scrollTop = $(document).scrollTop();
    var scrollLeft = $(document).scrollLeft();
    var pl = elm.parent().offset().left;
    var px = 'px';var w = elm.outerWidth()+px;var zpx = '0px 0px 0px 0px';
    var ie6 = $.browser.msie && $.browser.version <= 6;
    if (scrollTop >= __ftst - 10)
    {
        if (scrollTop - __ftst > __ftmt - 20)
        {
            if (ie6) elm.css({position:'absolute',left:(pl+__ftsl)+px,top:(__ftmt+__ftst)+px,margin:zpx,padding:zpx});
            else elm.css({position:'relative',left:'',top:(__ftmt-10)+px});
        }
        else
        {
            if (ie6) elm.css({position:'absolute',width:w,left:(pl+__ftsl)+px,top:(scrollTop+10)+px,margin:zpx,padding:zpx});
            else  elm.css({position:'fixed',width:w,left:(pl-scrollLeft+__ftsl)+px,top:10+px});
        }
    }
    else  elm.css('position', 'static');
}


$(function (){
    try
    {
    $(window).resize(__Floatjq).scroll(__Floatjq);
    var t = $('#__Float_Top');
    var tp = t.position();
    $('#__Float_Top').css({ position:'static', top:''});
    __ftsl = tp.left - t.parent().position().left;
    __ftst = tp.top;
    __ftmt = $('#__Float_Bottom').position().top - tp.top - t.outerHeight();
    }catch(err){}
});
