/**
*BsLib reusable javascript library object
*Version 130206
**/
function BsLib130206(){

    this.iTimeout;

    /**
    *Closure binds
    **/
    this.bind = function(_obj, _method, _arguments)
    {
        return (
            function(){
                return _obj[_method].apply(_obj, _arguments);
            }
        );
    }

    /**
    *Binds together with event
    **/
    this.bindEvent = function(_obj, _method, _arguments)
    {
        return (
            function(e){
                e = e || window.event;
                _arguments[_arguments.length] = e;
                _arguments.length += 1;

                return _obj[_method].apply(_obj, _arguments);
            }
        );
    }

    /**
    *move element
    **/
    this.moveElement = function(_sElementId, _sDirection, _iUpperLimit, _iLowerLimit, _bGlide)
    {
        var _funcRef = this.bind(this, "moveElement", arguments);
        var _eMove = document.getElementById(_sElementId);

        if (_bGlide) {
            switch (_sDirection) {

                case 'up':

                    if (parseInt(_eMove.style.top) > _iLowerLimit ) {

                        _eMove.style.top = parseInt(_eMove.style.top) - Math.round( (parseInt(_eMove.style.top) - _iLowerLimit) / 2 );
                        this.iTimeout = setTimeout(_funcRef, 50);
                    } else {

                    }
                break;

                case 'down':

                    if (parseInt(_eMove.style.top) < _iUpperLimit ) {

                        _eMove.style.top = parseInt(_eMove.style.top) + Math.round( (_iUpperLimit - parseInt(_eMove.style.top)) / 2 );
                        this.iTimeout = setTimeout(_funcRef, 50);
                    } else {

                    }
                break;
            }
        } else {
            switch (_sDirection) {
                case 'up':
                    _eMove.style.top = _iLowerLimit;
                break;

                case 'down':
                    _eMove.style.top = _iUpperLimit;
                break;
            }
        }
    }

    /**
    *return a HTTP object
    **/
    this.getXmlHttp = function()
    {
        var xmlhttp;

        /*@cc_on
        @if (@_jscript_version >= 5)
        try {
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (E) {
                xmlhttp = false;
            }
        }
        @else
        xmlhttp = false;
        @end @*/

        if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
            try {
                xmlhttp = new XMLHttpRequest();
            } catch (e) {
                xmlhttp = false;
            }

        }
    return xmlhttp;
    }

}
