jQuery.preloadImages = function () {
    for (var i = 0; i < arguments.length; i++) {
        jQuery("<img>").attr("src", arguments[i]);
    }
}

$jScroller = { config: { obj: [], refresh: 35, regExp: { px: /([0-9,.\-]+)px/} }, cache: { timer: 0, init: 0 }, add: function (a, b, c, d, e) { if ($(a).length && $(b).length && c && d >= 1) { $(a).css({ overflow: 'hidden' }); $(b).css({ position: 'absolute', left: 0, top: 0 }); if (e) { $(b).hover(function () { $jScroller.pause($(b), true) }, function () { $jScroller.pause($(b), false) }) } $jScroller.config.obj.push({ parent: $(a), child: $(b), direction: c, speed: d, pause: false }) } }, pause: function (a, b) { if (a && typeof b !== 'undefined') { for (var i in $jScroller.config.obj) { if ($jScroller.config.obj[i].child.attr("id") === a.attr("id")) { $jScroller.config.obj[i].pause = b } } } }, start: function () { if ($jScroller.cache.timer === 0 && $jScroller.config.refresh > 0) { $jScroller.cache.timer = window.setInterval($jScroller.scroll, $jScroller.config.refresh) } if (!$jScroller.cache.init) { $(window).blur($jScroller.stop); $(window).focus($jScroller.start); $(window).resize($jScroller.start); $(window).scroll($jScroller.start); $(document).mousemove($jScroller.start); if ($.browser.msie) { window.focus() } $jScroller.cache.init = 1 } }, stop: function () { if ($jScroller.cache.timer) { window.clearInterval($jScroller.cache.timer); $jScroller.cache.timer = 0 } }, get: { px: function (a) { var b = ''; if (a) { if (a.match($jScroller.config.regExp.px)) { if (typeof a.match($jScroller.config.regExp.px)[1] !== 'undefined') { b = a.match($jScroller.config.regExp.px)[1] } } } return b } }, scroll: function () { for (var i in $jScroller.config.obj) { if ($jScroller.config.obj.hasOwnProperty(i)) { var a = $jScroller.config.obj[i], left = Number(($jScroller.get.px(a.child.css('left')) || 0)), top = Number(($jScroller.get.px(a.child.css('top')) || 0)), min_height = a.parent.height(), min_width = a.parent.width(), height = a.child.height(), width = a.child.width(); if (!a.pause) { switch (a.direction) { case 'up': if (top <= -1 * height) { top = min_height } a.child.css('top', top - a.speed + 'px'); break; case 'right': if (left >= min_width) { left = -1 * width } a.child.css('left', left + a.speed + 'px'); break; case 'left': if (left <= -1 * width) { left = min_width } a.child.css('left', left - a.speed + 'px'); break; case 'down': if (top >= min_height) { top = -1 * height } a.child.css('top', top + a.speed + 'px'); break } } } } } };

$(document).ready(function () {

    $(".menu li").hover(
		function () {
		    $(this).addClass("hover");
		},
		function () {
		    $(this).removeClass("hover");
		}
    );


    var show;
    if ($(".bg_top").hasClass("bg_user")) {
        show = 0;
        $(".middle .line1 .user").show();
    }
    else if ($(".bg_top").hasClass("bg_adv")) {
        show = 1;
        $(".middle .line1 .adv").show();
    }

    function SwitchIt() {
        if (show == 0) {
            $(".middle .bg_top").removeClass("bg_adv").addClass("bg_user");
            $(".middle .line1 .adv").slideUp(800, function callback() {
                $(".middle .line1 .user").slideDown(800);
                show = 1;
            });
        }
        else if (show == 1) {
            $(".middle .bg_top").removeClass("bg_user").addClass("bg_adv");
            $(".middle .line1 .user").slideUp(800, function callback() {
                $(".middle .line1 .adv").slideDown(800);
                show = 0;
            });
        }
    }

    $(".toggle_content .user").click(function () {
        SwitchIt();
        return false;
    });
    $(".toggle_content .adv").click(function () {
        SwitchIt();
        return false;
    });

    $jScroller.add(".jQueryScroller", ".jQueryScroller div", "up", 1, true);
    $jScroller.start();

});
