var fadeOutSpeed = 350;
var prevID = null;
var count = new Object();
$(document).ready(function () {
    $("#kvnav > div").hover(function () {
        $(this).find("a").css("color", "#c40452");
        $(this).find('img').addClass("hover").stop()
			.animate({ marginTop: '0px', marginLeft: '0px', top: '-10%', left: '-10%', width: '180px', height: '98px', padding: '0px' }, 200);
    }, function () {
        $(this).find("a").css("color", "");
        $(this).find('img').removeClass("hover").stop()
			.animate({ marginTop: '0', marginLeft: '0', top: '0', left: '0', width: '168px', height: '95px', padding: '5px'
			}, 400);
    }).mouseover(function () {
        if (!count[this.id]) {
            _page.metrics.trackFlash({ "pagename": s.pageName + ":" + this.id, "type": "o" });
            count[this.id] = true;
        }
        var id = this.id + "_l";
        if (!prevID || id != prevID) {
            var img = this.getElementsByTagName("img")[0];
            var img_l_src = img.src.substr(0, img.src.length - 4) + "_l" + img.src.substr(img.src.length - 4);

            $("#kvmain > :visible").fadeOut(fadeOutSpeed, function () {
                if (id == prevID) {
                    $("#kvmain > #" + id).fadeIn(fadeOutSpeed).find("script").each(function () {
                        eval(this.innerHTML);
                    });
                }
            }).find("object").each(function () {
                swfobject.removeSWF(this.id);
            });
            $("#kv_container").fadeOut(fadeOutSpeed, function () {
                if (id == prevID) {
                    document.getElementById("kv_container").style.backgroundImage = "url(" + img_l_src + ")";
                    $("#kv_container").fadeIn(fadeOutSpeed);
                }
            });
            prevID = id;
        }
    });
});
function close_video() {
    $("#kvmain > :visible").find("object").each(function () {
        swfobject.removeSWF(this.id);
    });
    $("#kv_container").hide();
    document.getElementById("kv_container").style.backgroundImage = "url('../Image/banner_home_01_l.jpg')";
    $("#kv_container").fadeIn(fadeOutSpeed);
}

$.fn.preload = function () {
    this.each(function () {
        $('<img/>')[0].src = this;
    });
}
// Usage:
$(['../image/banner_home_01_l.jpg', '../image/banner_home_02_l.jpg', '../image/banner_home_03_l.jpg', '../image/banner_home_04_l.jpg', '../image/banner_home_05_l.jpg']).preload();
