﻿/*png问题解决*/
function correctPNG() {
    for (var i = 0; i < document.images.length; i++) {
        var img = document.images[i]
        var imgName = img.src.toUpperCase()
        if (imgName.substring(imgName.length - 3, imgName.length) == "PNG") {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
            img.outerHTML = strNewHTML
            i = i - 1
        }
    }
}
if (window.attachEvent) { window.attachEvent("onload", correctPNG); }


/*IE6不缓存css背景图的解决办法*/
document.execCommand("BackgroundImageCache", false, true);


var Menu = {
    init: function() {
    var lis = document.getElementById("navmenu").getElementsByTagName("li");
        for (var i = 0; i < lis.length; i++) {
            lis[i].onmouseover = function() {
                this.className += " iehover";
            }
            lis[i].onmouseout = function() {
                this.className = this.className.replace(new RegExp(" iehover\\b"), "");
            }
        }
    }
};


function startmarquee(lh, speed, delay, index) {
    var t;
    var p = false;
    var o = document.getElementById("marqueebox" + index);
    o.innerHTML += o.innerHTML;
    o.onmouseover = function() { p = true }
    o.onmouseout = function() { p = false }
    o.scrollTop = 0;
    function start() {
        t = setInterval(scrolling, speed);
        if (!p) o.scrollTop += 2;
    }
    function scrolling() {
        if (o.scrollTop % lh != 0) {
            o.scrollTop += 2;
            if (o.scrollTop >= o.scrollHeight / 2) o.scrollTop = 0;
        }
        else {
            clearInterval(t);
            setTimeout(start, delay);
        }
    }
    setTimeout(start, delay);
}

function AutoScroll(obj) {
    $(obj).find("ul:first").animate({
        marginTop: "-25px"
    }, 500, function() {
        $(this).css({ marginTop: "0px" }).find("li:first").appendTo(this);
    });
}
$(document).ready(function() {
setInterval('AutoScroll("#HotMessage")', 2000)
});


 
    var customade = 'none';
    var iscustom = "";
    function Custom(selObj) {
        if (selObj.value == "60") {
            customade = "block";
           // document.getElementById('msgBoxMask').style.display = 'none';
            document.getElementById('Customfloat').style.display = 'block';
            //  $("Customfloat").style.display = "block";
            $("Customefloat").css("display", "block");
            $("customade").css("display", "block");
            $("customcss2").className = 'link_now';
            $("custom1").css("display", "none");
            $("custom2").css("display", "block");
            iscustom = "custom";
        }
        else {
            document.getElementById('Customfloat').style.display = 'none';
            customade = 'none';
            iscustom = "";
        }
    }

    function customsize() {

        $('Customfloat').style.display = 'block';
        $('custom2').style.display = 'none';
        $('customade').style.display = 'none';
        $('custom1').style.display = 'block';
        $('customcss2').className = '';
        $('customcss1').className = 'link_now';
        if (customade == 'block') {
            $('custom1').style.display = 'block';
            $('customade').style.display = 'block';
        }
    }

    var i;
    function changeunit(value) {
        for (i = 1; i < customnum; i++) {
            if (i == 2 && value == "cm" && (customnum == 16 || customnum == 8)) {
                document.getElementById('unit' + i).innerHTML = 'kg';
            }
            else if (i == 2 && value == "in" && (customnum == 16 || customnum == 8)) {
            document.getElementById('unit' + i).innerHTML = 'lb';
            }
            else {
                document.getElementById('unit' + i).innerHTML = value;
            }
        }
    }

    function checknow() {
        if (iscustom == "custom") {
            var customfloat = "none";
            for (var i = 1; i < customnum; i++) {
                if (!isNumber(document.getElementById('Customszie' + i).value)) {
                    customfloat = 'block';
                    document.getElementById('cussize' + i).style.display = '';
                }
                else {
                    document.getElementById('cussize' + i).style.display = 'none';
                }
            }
            if (customfloat == 'none') {
                document.getElementById('Customfloat').style.display = 'none';
                customfloat = "none";
            }
            else {
                document.getElementById('custom2').style.display = 'block';
                document.getElementById('customcss2').className = 'link_now';
                return false;
            }
        }
        else {
            document.getElementById('Customfloat').style.display = 'none';
        }
    }
    function isNumber(oNum) {
        if (!oNum) return false;
        var strP = /^\d+(\.\d+)?$/;
        if (!strP.test(oNum)) return false;
        try {
            if (parseFloat(oNum) != oNum) return false;
        }
        catch (ex) {
            return false;
        }
        return true;
    }

