$(function(){
    $.get("FloatAd.aspx",{},function(data){
        if (data != '')
        {
            $("#float").html(data);
        }
        else
        {
            $("#float").css("display", "none");
        }
    });
})
$(this).scroll(function() {    // 页面发生scroll事件时触发    
    var bodyTop = 0;    
    if (typeof window.pageYOffset != 'undefined') {    
        bodyTop = window.pageYOffset;    
    } 
    else if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') {    
        bodyTop = document.documentElement.scrollTop;    
    }    
    else if (typeof document.body != 'undefined') {    
        bodyTop = document.body.scrollTop;    
    }

    $("#float").css("top", 100 + bodyTop)   // 设置层的CSS样式中的top属性, 注意要是小写，要符合“标准”
    $("#float").text(bodyTop); // 设置层的内容，这里只是显示当前的scrollTop     
});
//        var step = 1;
//        var delay = 30;
//        var height = 0;
//        var Hoffset = 0;
//        var Woffset = 0;
//        var yon = 0;
//        var xon = 0;
//        var pause = true;
//        var interval;
//        var name = navigator.appName;
//        if (name == "Microsoft Internet Explorer") name = true;
//        else name = false;
//        var xPos = 20;
//        if (name) var yPos = document.body.clientHeight;
//        else var yPos = window.innerHeight;
//        function changePos() {
//            if (name) {
//                width = document.body.clientWidth;
//                height = document.body.clientHeight;
//                Hoffset = document.getElementById('float').offsetHeight;
//                Woffset = document.getElementById('float').offsetWidth;
//                document.getElementById('float').style.left = xPos + document.body.scrollLeft;
//                document.getElementById('float').style.top = yPos + document.body.scrollTop;
//            }
//            else {
//                height = window.innerHeight;
//                width = window.innerWidth;
//                Hoffset = document.getElementById('float').clip.height;
//                Woffset = document.getElementById('float').clip.width;
//                document.getElementById('float').pageY = yPos + window.pageYOffset;
//                document.getElementById('float').pageX = xPos + window.pageXOffset;
//            }
//            if (yon) {
//                yPos = yPos + step;
//            }
//            else {
//                yPos = yPos - step;
//            }
//            if (yPos < 0) {
//                yon = 1;
//                yPos = 0;
//            }
//            if (yPos >= (height - Hoffset)) {
//                yon = 0;
//                yPos = (height - Hoffset);
//            }
//            if (xon) {
//                xPos = xPos + step;
//            }
//            else {
//                xPos = xPos - step;
//            }
//            if (xPos < 0) {
//                xon = 1;
//                xPos = 0;
//            }
//            if (xPos >= (width - Woffset)) {
//                xon = 0;
//                xPos = (width - Woffset);
//            }
//        }
//        function start() {
//            if (name) document.getElementById('float').visibility = "visible";
//            else document.getElementById('float').visibility = "visible";
//            interval = setInterval('changePos()', delay);
//        }
//        start();

