﻿
$(function() {




    
    
    

    $("#Hot_00 ul li a img").each(function(i) {


        if ($(this).height() == $(this).width()) {
            $(this).attr("height", "90").removeAttr("width");
        }
        if ($(this).height() > $(this).width()) {
            $(this).attr("height", "90").removeAttr("width");
        }
        if ($(this).height() < $(this).width()) {

            $(this).attr("width", "90").removeAttr("height");
        }

    });
    $.post("SearchShopWang.ashx", function(data, state) {
        if (state == "success") {
            if (data != "") {
                $("body").append(data);
            }
        }
    });


    $(".nav_list a").each(function() {
        var XmlVocationId = $(this).attr("XmlVocationId");
        $(this).hover(function() {
            if ($("#shop_" + XmlVocationId).length > 0) {

                $(this).addClass("position").addClass("hovestyle").append($("#shop_" + XmlVocationId));
                var main_left = $("#main").offset().left;
                var left = $(this).offset().left;
                if (left - main_left <= 9) {
                    $("#shop_" + XmlVocationId).css("margin-left", "-2px");
                }
                //                alert($("#shop_" + XmlVocationId).width());
                //                alert(left - main_left);
                if (left - main_left >= 481 && $("#shop_" + XmlVocationId).width() > 120) {
                    $("#shop_" + XmlVocationId).css("margin-left", "-146px");
                }

                if (left - main_left >= 520 && $("#shop_" + XmlVocationId).width() > 120) {
                    $("#shop_" + XmlVocationId).css("margin-left", "-100px");
                }

                if (left - main_left >= 599 && $("#shop_" + XmlVocationId).width() > 120) {
                    $("#shop_" + XmlVocationId).css("margin-left", "-135px");
                }
                if (left - main_left >= 400 && $("#shop_" + XmlVocationId).width() < 120) {
                    $("#shop_" + XmlVocationId).css("margin-left", "-45px");
                }


                $("#shop_" + XmlVocationId).show();
            }

        }, function() {
            $(this).removeClass("hovestyle").removeClass("position");
            $("#shop_" + XmlVocationId).hide();

        });

    });


    $("#shortcut ul li").each(function() {
        $(this).click(function() { Notgly(); });
    });

    $(".nav_list").each(function() {
        $(this).hover(function() {

            $(this).css("border", "#a9deed 1px solid").css("background-color", "#f3fafc").css("margin", "0px 0px 0").css("overflow", "visible");
        }, function() {
            $(this).css("background-color", "").css("border-top", "#e0e0e0 1px solid").css("float", "left").css("border-right", "#e0e0e0 1px solid").css("border-left", "#e0e0e0 1px solid").css("border-bottom", "#e0e0e0 1px dotted").css("margin-left", "0px").css("padding-bottom", "5px");

        });

    });




    //首页供求滚动部分
    //$("#scrollDiv").jScroll({ speed: 3000, scroll: 3, vertical: true });
});

//弹出层
function Notgly() {
    $("#tan_app").skygqbox();
}

//多行滚动
(function($) {
    $.fn.extend({
        Scroll: function(opt, callback) {
            if (!opt) var opt = {};
            var _this = this.eq(0).find("ul:first");
            var lineH = _this.find("li:first").height() + 7,
line = opt.line ? parseInt(opt.line, 10) : parseInt(this.height() / lineH, 10),
speed = opt.speed ? parseInt(opt.speed, 10) : 300, //卷动速度，数值越大，速度越慢（毫秒）
timer = opt.timer ? parseInt(opt.timer, 10) : 300; //滚动的时间间隔（毫秒）
            if (line == 0) line = 1;
            var upHeight = 0 - line * lineH;
            scrollUp = function() {
                _this.animate({
                    marginTop: upHeight
                }, speed, function() {
                    for (i = 1; i <= line; i++) {
                        _this.find("li:first").appendTo(_this);
                    }
                    _this.css({ marginTop: 0 });
                });
            }
            _this.hover(function() {
                clearInterval(timerID);
            }, function() {
                timerID = setInterval("scrollUp()", timer);
            }).mouseout();
        }
    })
})(jQuery);



//$(document).ready(function() {
//    $("#scrollDiv").Scroll({ line: 3, speed: 2500, timer: 4000 });
//});







function Extension_Service(VocationId) {
    $.post("/Search/StatsHandler.ashx", { "act": "Extension_Service", "VocationId": VocationId }, function(data, state) {
        if (state == "success") {
            //   alert(data);
        }
    });

}
