﻿$(document).ready(function () {
    $.ajax({
        url: "/customer/LogOnUser",
        cache: false,
        success: function (data) {
            $("#LogOnUser").html(data);
        }
    });

    var urls = location.href;
    if (urls.indexOf('program') != -1) {
        $("#menus li:eq(2) a").addClass("menuselect");
    } else if (urls.indexOf('gifts') != -1) {
        $("#menus li:eq(3) a").addClass("menuselect");
    } else if (urls.indexOf('newslist') != -1) {
        $("#menus li:eq(4) a").addClass("menuselect");
    } else if (urls.indexOf('special') != -1) {
        $("#menus li:eq(5) a").addClass("menuselect");
    } else if (urls.indexOf('hot') != -1) {
        $("#menus li:eq(6) a").addClass("menuselect");
    } else if (urls.indexOf('news') != -1) {
        $("#menus li:eq(7) a").addClass("menuselect");
    } else if (urls.indexOf('products') != -1) {
        $("#menus li:eq(0) a").addClass("menuselect");
    } else {
        $("#menus li:eq(1) a").addClass("menuselect");
    }

    var x;
    if ($("#_YH_SORTLIST") != null)
        x = $("#_YH_SORTLIST").remove().html();
    if ($("#_YH_ALLSORT") != null)
        $("#_YH_ALLSORT").html(x).attr("load", "1");
    $(".allsort .item").hoverForIE6({ delay: 0 });


    var count = 0; //物件总数
    if ($.cookie('eh_cart_cookie') != null) {
        orderJsonObj = eval('(' + $.cookie('eh_cart_cookie') + ')');

        for (var obj in orderJsonObj) {
            count += orderJsonObj[obj].Num * 1
        }
    }
    $("#GetCountShop").html(count);
    leftFloat();
    rightFloat();
});
function SearchProduct(e) {
    var currKey = 0, ee = e || event;
    currKey = e.keyCode || e.which || e.charCode;
    var keyName = String.fromCharCode(currKey);
    if (currKey == 13) {
        Search();
    }
}
function Search() {
    var searchVal = $.trim($("#searchval").val());
    if (searchVal == "" || searchVal == "请在此输入您要搜索的内容....") {
        alert("请输入搜索条件!");
    } else {
        searchVal = escape(searchVal);
        window.location.href = '/products/search?word=' + searchVal;
    }
}
function SerrchHot(obj) {
    var searchVal = "";
    searchVal = escape(obj);
    window.location.href = '/products/search?word=' + searchVal;
    
    
}
function out() {
    var evt = window.event || arguments.callee.caller.arguments[0]; // 获取event对象
    var src = evt.srcElement || evt.target; // 获取触发事件的源对象
    if (src.id != "_YH_ALLSORT") {
        document.getElementById('_YH_ALLSORT').style.visibility = "hidden";
    }
}

function leftFloat() {
    var $fDiv = $("#ad2");
    var html = "<img alt=\"QQ客服\" style=\"CURSOR: pointer\" onclick=\"javascript:window.open('http://b.qq.com/webc.htm?new=0&sid=4008309666&eid=218808P8z8p8P8z8Q8q8Q&o=http://www.ehmall.com.cn&q=7', '_blank', 'height=544, width=644,toolbar=no,scrollbars=no,menubar=no,status=no');\"   border=\"0\" SRC=\"../../Images/kffb.jpg\" />";
    html += "<a href='/news/f1830228-51f5-4049-a661-dd5e9cbdfbea.html' target=\"_blank\" rel=\"nofollow\"><img alt=\"重点企业\" style=\"CURSOR: pointer\"  border=\"0\" SRC=\"../../Images/zdqyfb.jpg\" /></a>";
    html += "<a href='http://weibo.com/eachome' target=\"_blank\" rel=\"nofollow\"><img alt='宜和博客' src='../../Images/wbfb.jpg'  id=\"ad\" /></a>";
    $fDiv.html(html);
    var dobyWidth = document.body.offsetWidth;
    $fDiv.jFloat({
        position: "left",
        top: 400,
        height: 320,
        width: 100,
        left: dobyWidth / 2 + 490,
        allowClose: false
    });
}

function rightFloat() {
    var $rDiv = $("#ad3");
    var html = "<a href='http://www.ehmall.com.cn/service/job', target='_blank'><img alt=\"招聘\" style=\"CURSOR: pointer\"  border=\"0\" SRC=\"../../Images/qunyinhui.jpg\" /></a>";
         html += "<div style='height:10px;'></div>";
        html += "<a href='http://www.ehmall.com.cn/news/2f951d43-e2bc-41ea-83c8-797d61e6efdd.html' target='_blank'> <img alt=\"招标\" style=\"CURSOR: pointer\"  border=\"0\" SRC=\"../../Images/zb.jpg\" /></a>";
   
    $rDiv.html(html);
    var dobyWidth = document.body.offsetWidth;
    $rDiv.jFloat({
        position: "left",
        top: 400,
        height: 320,
        width: 120,
        left: 20,
        allowClose: false
    });
}
