window.MIC_SRVRNM = document.location.protocol + '//' + document.location.host;
var requestLogonStatus = function() {
    var logonStatusTimerMax = 1700;
    var logonStatusTimer = null;
    var logonStatusURI = (window.MIC_SRVRNM || '') + '/ajaxfunction.do?xcase=ajaxlogonconnection';
    var switchLogonStatus = function() {
        if (!window.logonStatus) {
            return
        }
        clearInterval(logonStatusTimer);
        var welcomeSpan = document.getElementById('welcome_logon_span');
        var inquirySpan = document.getElementById('inquiry_number_span');
        var joinSpan = document.getElementById('join_now_span');
        var logoutSpan = document.getElementById('logout_span');
        var logonSpan = document.getElementById('logon_span');
        var newMsgElement = document.getElementById("newMsg");
        var inquirySpanSuffix = document.getElementById('inquiry_number_suffix_div');
        var newUserSpan = document.getElementById('new_user');
        if (parseInt(logonStatus[0]) > 0) {
            welcomeSpan && (welcomeSpan.innerHTML = 'Welcome ' + (logonStatus[1] ? '<strong>' + document.createTextNode(logonStatus[1]).nodeValue + '</strong>' : '') + '! ');
            inquirySpan && (inquirySpan.innerHTML = logonStatus[2]);
            inquirySpanSuffix && (inquirySpanSuffix.innerHTML = logonStatus[2] > 1 ? 'items' : 'item');
            joinSpan && (joinSpan.style.display = 'none');
            logoutSpan && (logoutSpan.style.display = 'inline');
            logonSpan && (logonSpan.style.display = 'none');
            newUserSpan && (newUserSpan.style.display = 'none');
            if (!newMsgElement) {
                newMsgElement = document.createElement('li');
                newMsgElement.setAttribute("id", "newMsg");
                welcomeSpan.parentNode.insertBefore(newMsgElement, welcomeSpan.nextSibling);
                newMsgElement.style.display = 'inline';
            }
            if (parseInt(logonStatus[3]) > 0) {
                newMsgElement.innerHTML = ' | <a href="http://membercenter.made-in-china.com/messagecenter.do?xcase=inbox"><img src="/images/new_msg.gif"  alt="#N0# New Message(s)" title="#N0# New Message(s)" /> #N0#</a> | '.replace(/#N0#/g, logonStatus[3]);
            }
            else {
                newMsgElement.innerHTML = ' | ';
            }
        }
        else {
            welcomeSpan && (welcomeSpan.innerHTML = '');
            inquirySpan && (inquirySpan.innerHTML = logonStatus[2]);
            inquirySpanSuffix && (inquirySpanSuffix.innerHTML = logonStatus[2] > 1 ? 'items' : 'item');
            joinSpan && (joinSpan.style.display = 'inline');
            logoutSpan && (logoutSpan.style.display = 'none');
            logonSpan && (logonSpan.style.display = 'inline');
            newMsgElement && (newMsgElement.style.display = 'none');
            newUserSpan && (newUserSpan.style.display = 'inline')
        }
    };
    var logonStatusScript = document.createElement("script");
    logonStatusScript.setAttribute("type", "text/javascript");
    logonStatusScript.setAttribute("src", logonStatusURI + '&time=' + new Date().getTime());
    document.getElementsByTagName("head").item(0).appendChild(logonStatusScript);
    logonStatusTimer = setInterval(function() {
        switchLogonStatus();
        logonStatusTimerMax -= 50;
        if (logonStatusTimerMax < 0) {
            clearInterval(logonStatusTimer);
        }
    }, 50);
};
try {
    requestLogonStatus();
    if (document.body.outerHTML) {
        document.getElementById('welcome_fav').outerHTML = '<a id="welcome_fav" href="javascript:addMICtoFavorite(\'http://www.made-in-china.com', 'Made-in-China.com - The world of China products\');">Add Made-in-China.com to your favorites list</a>'
    }
} 
catch (e) {
}
function addMICtoFavorite(url_site, home_site) {
    try {
        window.external.AddFavorite(url_site, home_site)
    } 
    catch (e) {
    }
}

/*helpList show*/
(function() {
   var timer4Area = "";
   var helpObj = document.getElementById("helpList");
   if (helpObj != undefined && helpObj != null) {
     helpObj.style.display = "none";
     var areaOverFunc = function() {
            clearTimeout(timer4Area);
            var seOutF = function() {
                helpObj.style.display = "";
                if (window.attachEvent) {
                  helpObj.nextSibling.className = "help over";
                }else{
                  helpObj.nextSibling.nextSibling.className = "help over";
                }
            };
            timer4Area = setTimeout(seOutF, 200)
        };
        var areaOutFunc = function() {
            clearTimeout(timer4Area);
            var seOutF = function() {
                helpObj.style.display = "none";
                if (window.attachEvent) {
                  helpObj.nextSibling.className = "help";
                }else{
                  helpObj.nextSibling.nextSibling.className = "help";
                }
            };
            timer4Area = setTimeout(seOutF, 200)
        };
        var clearTime4Area = function() {
            clearTimeout(timer4Area);
            helpObj.style.display = "";
        };
       if(window.attachEvent){  
        helpObj.nextSibling.attachEvent( "onmouseover",areaOverFunc);  
        helpObj.nextSibling.attachEvent( "onmouseout",areaOutFunc);  
        helpObj.attachEvent( "onmouseover",clearTime4Area);  
        helpObj.attachEvent( "onmouseout",areaOutFunc);
        }else{  
          helpObj.nextSibling.nextSibling.addEventListener( "mouseover",areaOverFunc,false);  
          helpObj.nextSibling.nextSibling.addEventListener( "mouseout",areaOutFunc,false);  
          helpObj.addEventListener( "mouseover",clearTime4Area,false);  
          helpObj.addEventListener( "mouseout",areaOutFunc,false);  
        }
 
   }
})();

