﻿var bodyHeight = 0, divheight = 0, divtop = 0, scrolltimer = null, Win = null, Ifm = null,Win1=null;
var lastScrollY = 0, diffY = 0, percent = 0;
function Init_open() {
    var newWin = "<div id=\"open_bm\">" +
                                "<div id=\"openc\">" +
                                "<a class=\"close_open\" href=\"javascript:void(0)\" onclick=\"closeScroll();\"></a>" +
                                "<a class=\"bm_img\" href=\"http://www.ksyx.net/ZXBM/index.aspx\" target=\"_blank\" " +
                                "title=\"亲 更多优惠等着你 赶快来报名吧\"></a>" +
                                "</div>" +
                                "<a class=\"qq qq_1\" target=\"_blank\" href=\"http://wpa.qq.com/msgrd?v=3&uin=739548424&site=qq&menu=yes\">" +
                                "<img  src=\"http://wpa.qq.com/pa?p=2:739548424:41\" title=\"点击这里给我发消息\"></a>" +
                                "<a class=\"qq qq_2\" target=\"_blank\" href=\"http://wpa.qq.com/msgrd?v=3&uin=903308302&site=qq&menu=yes\">" +
                                "<img  src=\"http://wpa.qq.com/pa?p=2:903308302:41\" title=\"点击这里给我发消息\"></a>" +
                                "</div>" +
                                "<iframe id=\"ifm_bm\" scrolling=\"no\"  frameborder=\"0\" class=\"ifm_bm\" style=\"visibility:hidden;\"></iframe>";
    $(document.body).append(newWin);
}
function resizeScroll() {
	if ($.browser.msie && $.version < 7) {
		if (!Win) Win = $("#open_bm");
		if (!Ifm) Ifm = $("#ifm_bm");
		diffY = (document.body.scrollTop > 0) ? document.body.scrollTop : document.documentElement.scrollTop;
		bodyHeight = document.documentElement.clientHeight;
		Win.css("top", diffY + bodyHeight - divheight - 146);
		Ifm.css("top", diffY - 143);
	}
}
function closeScroll() {
	if (!Win) Win = $("#open_bm");
    if (!Ifm) Ifm = $("#ifm_bm");
    Win.hide();
    Ifm.attr("visibility", "hidden");
    bodyHeight = document.documentElement.clientHeight;
    Win.css("top", bodyHeight);
    Ifm.css("top", bodyHeight);
    setInterval(resizeScroll, 1);
}
$(window).load(Init_open).resize(resizeScroll);

