﻿/**
*公用部分不建议使用一些js类库
*子页面有使用prototype和jquery
*本页使用可能会导致冲突
*/

/*
*绑定函数到onload中
*子页面需要使用onload事件时 
*应调用此方法添加函数
*/
function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    }
    else {
        window.onload = function () {
            oldonload();
            func();
        }
    }
}

//load时进行定位
addLoadEvent(setDivPosition);

//对绝对定位层进行定位
function setDivPosition() {
    var mainDivPosition = getElementPos('main_content_div');
    var productDiv = document.getElementById('apDiv3');
    var cartDiv = document.getElementById('apDiv2');
    //var productClass_all = document.getElementById("productClass_all_div");
    //var apDiv1 = document.getElementById('apDiv1');
    //分辨率大于1024时显示两边层
    if (window.screen.width > 1024) {
        productDiv.style.left = (mainDivPosition.x - 90) + "px";
        cartDiv.style.left = (mainDivPosition.x + 960) + "px"
    }
    //productClass_all.style.left = (mainDivPosition.x) + "px";
    //alert(document.getElementById("img_qq").fileSize);
}
//显示在线客服层
function showContact() {
    var contactImg = document.getElementById("contact_img");
    var contactDiv = document.getElementById("contact_div");
    if (contactDiv.style.display == "block") {
        contactDiv.style.display = "none";
    }
    else {
        var contactImgPosition = getElementPos("contact_img");
        contactDiv.style.left = contactImgPosition.x - 70 + "px";
        contactDiv.style.top = contactImgPosition.y - 5 + "px";
        contactDiv.style.display = "block";
    }
}
//关闭在线客服层
function closeContact() {
    document.getElementById("contact_div").style.display = 'none';
}
//获取元素position
function getElementPos(elementId) {
    var ua = navigator.userAgent.toLowerCase();
    var isOpera = (ua.indexOf('opera') != -1);
    var isIE = (ua.indexOf('msie') != -1 && !isOpera); // not opera spoof
    var el = document.getElementById(elementId);
    if (el.parentNode === null || el.style.display == 'none') {
        return false;
    }
    var parent = null;
    var pos = [];
    var box;
    if (el.getBoundingClientRect)    //IE
    {
        box = el.getBoundingClientRect();
        var scrollTop = Math.max(document.documentElement.scrollTop, document.body.scrollTop);
        var scrollLeft = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft);
        return { x: box.left + scrollLeft, y: box.top + scrollTop };
    } else if (document.getBoxObjectFor)    // gecko    
    {
        box = document.getBoxObjectFor(el);
        var borderLeft = (el.style.borderLeftWidth) ? parseInt(el.style.borderLeftWidth) : 0;
        var borderTop = (el.style.borderTopWidth) ? parseInt(el.style.borderTopWidth) : 0;
        pos = [box.x - borderLeft, box.y - borderTop];
    } else    // safari & opera    
    {
        pos = [el.offsetLeft, el.offsetTop];
        parent = el.offsetParent;
        if (parent != el) {
            while (parent) {
                pos[0] += parent.offsetLeft;
                pos[1] += parent.offsetTop;
                parent = parent.offsetParent;
            }
        }
        if (ua.indexOf('opera') != -1 || (ua.indexOf('safari') != -1 && el.style.position == 'absolute')) {
            pos[0] -= document.body.offsetLeft;
            pos[1] -= document.body.offsetTop;
        }
    }
    if (el.parentNode) {
        parent = el.parentNode;
    } else {
        parent = null;
    }
    while (parent && parent.tagName != 'BODY' && parent.tagName != 'HTML') { // account for any scrolled ancestors
        pos[0] -= parent.scrollLeft;
        pos[1] -= parent.scrollTop;
        if (parent.parentNode) {
            parent = parent.parentNode;
        }
        else {
            parent = null;
        }
    }
    return { x: pos[0], y: pos[1] };
}

/*
*js ajax
*/
//创建xmlhttprequest
function createXMLHttpRequest() {
    var xmlhttp;
    if (window.ActiveXObject) {
        var arrayActive = ["Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "Msxml2.XMLHTTP.3.0", "Msxml2.XMLHTTP", "Microsoft.XMLHTTP"];
        for (var i = 0; i < arrayActive.length; i++) {
            try {
                xmlhttp = new ActiveXObject(arrayActive[i]);
                break;
            }
            catch (e) {
                continue;
            }
        }
    }
    else if (window.XMLHttpRequest) {
        try {
            xmlhttp = new XMLHttpRequest();
            if (xmlhttp.overrideMimeType) {
                xmlhttp.overrideMimeType("text/xml");
            }
        }
        catch (e) {
            xmlhttp = null;
        }
    }
    else {
        xmlhttp = null;
    }
    return xmlhttp;
}

function strings() {
    var querystring = "name=" + name + "&day=" + day;
    return encodeURL(encodeURL(querystring)); //两次编码解决中文编码问题 
}


function getXmlDoc() {
    var xmlDoc;
    try {
        xmlDoc = new ActiveXObject("Microsoft.XMLDOM");  //IE
    }
    catch (e) {
        try //Firefox, Mozilla, Opera, etc.
          {
            xmlDoc = document.implementation.createDocument("", "", null);
        }
        catch (e) {
            alert(e.message);
            return;
        }
    }
    return xmlDoc;
}

/*
*导航菜单
*/
var menuTime; //定时器
var prevId; //上一个mouseover
var firstMenuPosition = new Array(); //   厨房/食品分类按钮的位置
//导航下拉菜单
function showAllProductClass(obj, showAll) {
    var productClass = obj.id + "_div";
    var o = document.getElementById(productClass);
    if (o) {
        //        if (o.style.display == "block") {
        //            o.style.display = "none";
        //        }
        //        else {
        //            o.style.display = "block";
        //        }
        o.style.display = "block";
    }
    else {
        showProductClass(obj, showAll);
    }
}
//显示分类 showall为所有分类参数
function showProductClass(obj, showAll) {
    var imgSrc = obj.src;
    var objId = obj.id;
    var isShowAll = objId.indexOf('_all') > 0;
    if (prevId) {
        var imgObj = document.getElementById(prevId);
        document.getElementById(imgObj.id + "_div").style.display = "none";
    }
    if (!isShowAll) {
        if (imgObj) {
            imgObj.src = imgObj.src.replace("_on", "_off").replace(".gif", ".jpg");
        }
        obj.src = imgSrc.replace("_off", "_on").replace(".jpg", ".gif");
    }
    prevId = objId;
    if (menuTime) {
        clearTimeout(menuTime);
    }
    if (!document.getElementById(objId + "_div"))//层不存在时创建层并读取数据
    {
        var div = document.createElement("div");
        div.id = objId + "_div";
        var productClassType = objId.substring(objId.lastIndexOf('_') + 1) - 1;
        if (firstMenuPosition.length == 0) {
            var menuPos = getElementPos("top_menu_2");
            firstMenuPosition.push(menuPos.x);
            firstMenuPosition.push(menuPos.y);
        }
        div.style.position = "absolute";
        div.style.left = !isShowAll ? firstMenuPosition[0] + "px" : (firstMenuPosition[0] - 149) + "px";
        div.style.top = firstMenuPosition[1] + 35 + "px";
        div.style.zIndex = "6";
        div.style.display = "block";
        div.className = isShowAll ? "secondMenuAll" : "secondMenu";
        div.innerHTML = "正在加载中... 请稍后...";
        document.body.appendChild(div);
        if (!showAll) {
            if (window.attachEvent)//IE
            {
                div.attachEvent("onmouseover", function () {
                    showProductClass(obj);
                });
                div.attachEvent("onmouseout", function () {
                    hiddenProductClass(obj);
                });
            }
            else if (window.addEventListener)//other
            {
                div.addEventListener("mouseover", function () {
                    showProductClass(obj);
                }, false);
                div.addEventListener("mouseout", function () {
                    hiddenProductClass(obj);
                }, false);
            }
        }
        var innerHtml = "";
        var xmlhttp = createXMLHttpRequest();
        var queryString = "Option=getProductClass&productClassType=" + productClassType;
        xmlhttp.open("post", "/Default.aspx");
        xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
        xmlhttp.onreadystatechange = function () {
            if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                var dataobj = eval("(" + xmlhttp.responseText + ")").obj;
                //dataobj的结构[{"dt":[{},{}]},{"dt":[{},{}]}]
                if (dataobj.length > 0) {
                    var dtRows = dataobj[0].dt; //二级分类
                    var dtRows1 = dataobj[1].dt; //三级分类
                    var imgPath = "/templates/yxshop_template/lock/images/";
                    if (showAll) {
                        //显示所有分类逻辑开始
                        div.className = "box_left_menu";

                        //四个一级分类
                        innerHtml += "<ul class=\"box_left_menu_top\">";
                        innerHtml += "<li class=\"box_left_menu_topLI\"><img src=\"" + imgPath + "box_leftto_03.jpg\" width=\"236\" height=\"31\" /></li>";
                        innerHtml += "<li class=\"box_left_menu_topLI\"><img src=\"" + imgPath + "box_leftto_04.jpg\" width=\"236\" height=\"31\" /></li>";
                        innerHtml += "<li class=\"box_left_menu_topLI\"><img src=\"" + imgPath + "box_leftto_05.jpg\" width=\"236\" height=\"31\" /></li>";
                        innerHtml += "<li class=\"box_left_menu_topLI\"><img src=\"" + imgPath + "box_leftto_06.jpg\" width=\"236\" height=\"31\" /></li>";
                        innerHtml += "</ul>";
                        innerHtml += "<div class=\"box_left_center\">";
                        for (var i = 1; i <= 4; i++)//循环4次
                        {
                            var ulCount = 0;
                            innerHtml += "<div class=\"box_left_center1\">";
                            //循环二级 三级时可以考虑把已循环出的分类去掉 减少剩下的循环次数
                            for (var j = 0; j < dtRows.length; j++)//循环二级分类
                            {
                                if (dtRows[j].fatherid == i) {
                                    innerHtml += "<ul class=\"box_left_center1UL\">";
                                    innerHtml += "<li class=\"box_left_center1LI\" style='width:102px;'>";
                                    innerHtml += "<div class=\"box_left_center1LI1\"><img width=\"7\" height=\"7\" src=\"" + imgPath + "box_leftto_jia.jpg\"></div>";
                                    innerHtml += "<a href='/product/productclass.aspx?f_id=" + dtRows[j].cid + "'><div class=\"box_left_center1LI2\">" + dtRows[j].name + "</div></a></li>";
                                    for (var k = 0; k < dtRows1.length; k++)//循环三级分类
                                    {
                                        if (dtRows1[k].fatherid == dtRows[j].cid) {
                                            innerHtml += "<li class=\"box_left_center1LI\" style='width:102px;'>";
                                            innerHtml += "<div class=\"box_left_center1LI1\"><img width=\"7\" height=\"7\" src=\"" + imgPath + "box_leftto_jia1.jpg\"></div>";
                                            innerHtml += "<div class=\"box_left_center1LI3\" style='width:90px;'><a href='/product/productclass.aspx?f_id=" + dtRows1[k].cid + "'>" + dtRows1[k].name + "</a></div></li>";
                                        }
                                    }
                                    innerHtml += "</ul>";
                                    ulCount++;
                                    if (ulCount == 3) {
                                        innerHtml += "</div>"; //满3个时补div结束标签
                                        innerHtml += "<div class=\"box_left_center1\">";
                                    }
                                    else if (ulCount == 6) {
                                        innerHtml += "</div>";
                                        innerHtml += "<div class=\"box_left_center_xian\" id='div_line_" + i + "'></div>"; //竖线
                                    }
                                }
                            }
                        }
                        innerHtml += "<div class=\"box_left_right\">";
                        innerHtml += "<div class=\"box_left_right1\"><img src=\"" + imgPath + "box_leftto_xx2.jpg\" width=\"237\" height=\"88\" /></div>";
                        innerHtml += "<div class=\"box_left_right2\">";
                        innerHtml += "<ul class=\"box_left_right2UL\">";
                        innerHtml += "<li class=\"box_left_right2LI\">促销活动</li>";
                        innerHtml += "<li class=\"box_left_right2LI1\"><a href=\"/activity/activity_index.aspx?channel=activity_ing\">进行中活动</a></li>";
                        innerHtml += "<li class=\"box_left_right2LI1\"><a href=\"/activity/activity_index.aspx?channel=activity_ed\">已完成活动</a></li>";
                        innerHtml += "<li class=\"box_left_right2LI2\"><a href=\"/activity/activity_index.aspx?channel=activity_Award\">获奖名单</a></li></ul>";
                        innerHtml += "<ul class=\"box_left_right2UL\"><li class=\"box_left_right2LI\">购物知识</li>";
                        innerHtml += "<li class=\"box_left_right2LI1\"><a href=\"/goodsknowledge/ExperienceGroup_Jion.aspx\">517体验团</a></li><li class=\"box_left_right2LI1\"><a href=\"/goodsknowledge/knowledge.aspx?channel=108\">最佳评论</a></li>";
                        innerHtml += "<li class=\"box_left_right2LI1\"><a href=\"/goodsknowledge/CookingStories.aspx\">烹饪故事</a></li><li class=\"box_left_right2LI1\"><a href=\"/goodsknowledge/Knack.aspx\">517诀窍</a></li>";
                        innerHtml += "<li class=\"box_left_right2LI2\"><a href=\"/goodsknowledge/RecommendedItems.aspx\">推荐项目</a></li></ul>";
                        innerHtml += "<ul class=\"box_left_right2UL\"><li class=\"box_left_right2LI\">社区</li>";

                        innerHtml += "<li class=\"box_left_right2LI1\"><a href='/article/list.aspx?channel=101'>公告</a></li><li class=\"box_left_right2LI1\"><a href='/article/list.aspx?channel=100'>韩国最新新闻</a></li>";
                        innerHtml += "<li class=\"box_left_right2LI1\"><a href='/article/list.aspx?channel=106'>评论区</a></li><li class=\"box_left_right2LI1\"><a href='/article/list.aspx?channel=107'>问题留言板</a></li>";
                        innerHtml += "<li class=\"box_left_right2LI1\"><a href='/article/list.aspx?channel=109'>照片商品评论</a></li><li class=\"box_left_right2LI1\"><a href='/article/list.aspx?channel=108'>我想买的商品</a></li>";
                        innerHtml += "<li class=\"box_left_right2LI2\">517娱乐区[<font color=\"#666666\"><a href='/article/list.aspx?channel=110'>视频</a>|<a href='/article/list.aspx?channel=111'>照片</a></font>]</li></ul>";
                        innerHtml += "</div><div class=\"box_left_right3\"><img src=\"" + imgPath + "box_leftto_xx.jpg\" width=\"19\" style='cursor:pointer;' height=\"19\" onclick=\"hiddenProductClass(document.getElementById('product_all'));\" /></div></div>";
                        innerHtml += "</div>";
                        div.innerHTML = innerHtml;
                        var height = div.offsetHeight;
                        for (var i = 1; i < 4; i++) {
                            document.getElementById('div_line_' + i).style.height = height - 115 + "px";
                        }
                        return;
                    }

                    innerHtml += "<div class=\"box_pingdao_menu_left\">";
                    for (var i = 0; i < dtRows.length; i++) {
                        if (i % 2 == 0) {
                            innerHtml += "<div class=\"box_left_center2\">";
                        }
                        innerHtml += "<ul class=\"box_left_center1UL\">"
                        innerHtml += "<li class=\"box_left_center1LI\" >";
                        innerHtml += "<div class=\"box_left_center1LI1\"><img width=\"7\" height=\"7\" src=\"" + imgPath + "box_leftto_jia.jpg\"></div>";
                        innerHtml += "<a href='/product/productclass.aspx?f_id=" + dtRows[i].cid + "'>";
                        innerHtml += "<div class=\"box_left_center1LI2\"><font color=\"#333333\"><b>" + dtRows[i].name + "</b></font></div></a></li>";
                        for (var j = 0; j < dtRows1.length; j++) {
                            if (dtRows1[j].fatherid == dtRows[i].cid) {
                                innerHtml += "<li class=\"box_left_center1LI\"><div class=\"box_left_center1LI1\"><img width=\"7\" height=\"7\" src=\"" + imgPath + "box_leftto_jia1.jpg\"></div>";
                                innerHtml += "<a href='/product/productclass.aspx?f_id=" + dtRows1[j].cid + "'><div class=\"box_left_center1LI3\"  onmousemove=\"this.style.backgroundColor= '#577aac';this.style.color='white'\" onmouseout=\"this.style.backgroundColor='white';this.style.color='#333333'\">" + dtRows1[j].name + "</div></a></li>";
                            }
                        }
                        innerHtml += "</ul>";
                        if (i % 2 != 0) {
                            innerHtml += "</div>"
                        }
                    }
                    //补div结束标签
                    if (innerHtml.lastIndexOf("</div>") + 6 != innerHtml.length && innerHtml.length > 0) {
                        innerHtml += "</div>";
                    }
                    //                    if (obj.id == "top_menu_2") {
                    //innerHtml += "<div style='float:left'><img src='/templates/yxshop_template/lock/images/BrandImg.jpg'/></div>";
                    innerHtml += "<div class=\"box_pingdao_menu_right\"><ul class=\"box_pingdao_menu_right1\"><li class=\"box_pingdao_menu_right2\">热卖品牌</li>";
                    innerHtml += "<li class=\"box_pingdao_menu_right3\"><a href='/brand/brandlist.aspx'>查看所有品牌</a></li></ul>";
                    var xmlDoc = getXmlDoc();
                    xmlDoc.async = false;
                    var xmlId = objId.substring(objId.lastIndexOf('_') + 1);
                    xmlDoc.load("/xml/productBrandImgXml/productBrandImg_" + xmlId + ".xml");
                    for (var i = 0; i < xmlDoc.getElementsByTagName("item").length; i++) {
                        innerHtml += "<div class=\"box_pingdao_menu_right4\"><a href='" + xmlDoc.getElementsByTagName("link")[i].childNodes[0].nodeValue + "'><img width=\"112\" height=\"54\" src=\"" + xmlDoc.getElementsByTagName("imgPath")[i].childNodes[0].nodeValue + "\"></a></div>";
                    }
                    innerHtml += "</div>";
                    //                    }
                    innerHtml += "</div>";
                    if (innerHtml == "") {
                        innerHtml = "暂时没有分类！";
                    }
                }
                else {
                    innerHtml = "暂时没有分类！";
                }
                div.innerHTML = innerHtml;
            }
        }
        xmlhttp.send(queryString);
    }
    else {
        var div = document.getElementById(objId + "_div");
        //如果position已被清空 则重新获取新的position
        if (firstMenuPosition.length == 0) {
            var menuPos = getElementPos("top_menu_2");
            firstMenuPosition.push(menuPos.x);
            firstMenuPosition.push(menuPos.y);
        }
        //导航位置错误时重新进行定位
        if (div.style.left != firstMenuPosition[0]) {
            if (isShowAll) {
                div.style.left = firstMenuPosition[0] - 147 + "px";
            }
            else {
                //导航后面3个 社区 活动 购物知识 这3个与前4个分类位置不一样
                if (objId.substring(objId.lastIndexOf('_') + 1) >= 6) {
                    div.style.left = (firstMenuPosition[0] - 147) + "px";
                }
                else {
                    div.style.left = firstMenuPosition[0] + "px";
                }
                div.style.top = firstMenuPosition[1] + 35 + "px";
            }
        }
        div.style.display = "block";
    }
}
//隐藏分类
function hiddenProductClass(obj) {
    menuTime = setTimeout(function () {
        try {
            obj.src = obj.src.replace("_on", "_off").replace(".gif", ".jpg");
            document.getElementById(obj.id + "_div").style.display = "none";
        }
        catch (e) { }
    }, 100);
}

//显示或隐藏总分类
function showOrHiddenProductClass(obj) {
    if (document.getElementById(obj.id + "_div").style.display == "block") {
        hiddenProductClass(obj);
    }
    else {
        showProductClass(obj, true);
    }
}

//浏览器窗口改变时重新对绝对定位层进行定位
window.onresize = function () {
    setDivPosition();
    firstMenuPosition.length = 0; //清空原position信息
}

//滚动条滚动事件
//var rollDiv = ["apDiv2"]; //要随滚动条滚动的层
//var rollDivOldTop = []; //要滚动层的初始高度
//window.onscroll = function () {
//    if (rollDivOldTop.length == 0) {
//        for (var i = 0; i < rollDiv.length; i++) {
//            var o = document.getElementById(rollDiv[i]);
//            if (o) {
//                rollDivOldTop.push(o.offsetTop);
//            }
//        }
//    }
//    for (var i = 0; i < rollDiv.length; i++) {
//        var o = document.getElementById(rollDiv[i]);
//        if (o) {
//            scroll.run(rollDiv[i], rollDivOldTop[i]);
//        }
//    }
//}
//平滑滚动效果
//var scroll =
//{
//    speed: 1, //每次移动的像素 值越大越快
//    time: 30, //值越小滚动越快
//    run: function (id, oldTop) {
//        var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
//        var targetTop = scrollTop + oldTop;
//        var obj = document.getElementById(id);
//        if (obj.offsetTop + this.speed > targetTop && obj.offsetTop - this.speed < targetTop) {
//            obj.style.top = targetTop + "px";
//        }
//        else if (obj.offsetTop < targetTop) {
//            if (obj.offsetTop + 300 < targetTop) {
//                obj.style.top = targetTop - 300 + "px";
//            }
//            obj.style.top = obj.offsetTop + this.speed + "px";
//            setTimeout("scroll.run('" + id + "'," + oldTop + ")", this.time);
//        }
//        else if (obj.offsetTop > targetTop) {
//            if (obj.offsetTop - targetTop > 400) {
//                obj.style.top = obj.offsetTop - 200 + "px";
//            }
//            obj.style.top = obj.offsetTop - this.speed + "px";
//            setTimeout("scroll.run('" + id + "'," + oldTop + ")", this.time);
//        }
//    }
//};
var topValue = 0;
var topTo = function (el, to, stay) {
    var old = el.offsetTop;
    clearInterval(el.MOVEID);
    el.MOVEID = setInterval(function () {
        var len = to - old,
 Int = Math[len < 0 ? 'floor' : 'ceil'];
        old += Int(len * 0.1);
        el.style.top = old + 'px';
        if (old == to) clearInterval(el.MOVEID);
        if (old <= stay) {
            clearInterval(el.MOVEID);
            el.style.top = stay + 'px';
        }
    }, 10);
};
addLoadEvent(function () {
    topValue = parseInt(document.getElementById('apDiv2').style.top);
    window.onscroll = function () {
        setTimeout(function () {
            topTo(document.getElementById('apDiv2'), Math.max(document.body.scrollTop + 150, document.documentElement.scrollTop + 150), topValue);
        }, 100);
    }
});


//浏览过的商品
var scanProducts =
{
    products: new Array(),
    add: function (product) //添加商品到浏览过的商品中
    {
        this.loadProducts();
        var tempProduct = null;
        //该商品是否已在浏览过的商品中
        for (var i = 0; i < this.products.length; i++) {
            if (this.products[i].productId == product.productId) {
                tempProduct = this.products[i];
                break;
            }
        }
        if (tempProduct) {
            var tempArray = new Array();
            for (var i = 0; i < this.products.length; i++) {
                if (this.products[i].productId == tempProduct.productId) {
                    continue;
                }
                tempArray.push(this.products[i]);
            }
            tempArray.push(tempProduct);
            this.products = tempArray;
        }
        else {
            if (this.products.length >= 4) {
                this.products.shift(); //删除第一个元素
            }
            this.products.push(product);
        }
        this.addToCookie();
    },
    addToCookie: function ()//写入cookie
    {
        //转换为json格式写入
        var value = "[";
        for (var i = 0; i < this.products.length; i++) {
            if (i > 0) {
                value += ",";
            }
            value += "{\"productId\":\"" + this.products[i].productId + "\"";
            value += ",\"productImg\":\"" + this.products[i].productImg + "\"";
            value += "}";
        }
        value += "]";
        AddCookie("scanProducts", value, 1);
    },
    loadProducts: function ()//从cookie中获取
    {
        this.products = eval("(" + GetCookie("scanProducts") + ")");
        if (!this.products) {
            this.products = new Array();
        }
    },
    showProducts: function ()//加载浏览过的商品
    {
        this.loadProducts();
        var innerHtml = "";
        innerHtml += "<table width=\"100%\" border=\"0\" cellpadding=\"0\" >"
        innerHtml += "<tr><td>";
        innerHtml += "<img   width=\"68\" style=\"border-left:1px solid #d6d6d6;border-right:1px solid #d6d6d6;\" src=\"/templates/yxshop_template/lock/images/bt_rsee.gif\" />";
        innerHtml += "</td></tr>";
        for (var i = this.products.length - 1; i >= 0; i--) {
            innerHtml += "<tr>";
            innerHtml += "<td align=\"center\" bgcolor=\"#FFFFFF\" style=\"border:1px solid #d7d7d7;\">";
            innerHtml += "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"9\">"
            innerHtml += "<tr><td >";
            innerHtml += "<a href='/product/productcontent.aspx?q_productid=" + this.products[i].productId + "'><img src='http://scm.locknlock.com.cn/UploadFiles/ProPic/" + this.products[i].productImg + "' width='68' height='68'/></a>";
            innerHtml += "</td></tr></table></td></tr>";
        }
        innerHtml += "<tr><td>";
        innerHtml += "<a href=\"/default.html\"><img src=\"/templates/yxshop_template/lock/images/bt_rhome.gif\" style=\" border-left:1px solid #D7D7D7;border-bottom:1px solid #D7D7D7;\"/></a>";
        innerHtml += "<a href=\"#517hanguoTop\"><img src=\"/templates/yxshop_template/lock/images/bt_rtop.gif\" style=\" border-right:1px solid #D7D7D7;border-bottom:1px solid #D7D7D7;\"/></a>";
        innerHtml += "</td></tr></table>";
        document.getElementById("scanProducts").innerHTML = innerHtml;
    }
};
addLoadEvent(function () {
    scanProducts.showProducts();
});
//新闻 评论等图片切换
function changeMenuIcon(obj) {
    if (obj.src.indexOf("_off") > 0) {
        obj.src = obj.src.replace("_off", "_on");
    }
    else {
        obj.src = obj.src.replace("_on", "_off");
    }
}
//发布时用
//window.onerror = function ()
//{
//    return true;
//}

