
function B2BTopBar() {
    this._sSvc = null;
    this._sCk = null;
    this._sLogo = null;
    this._sText = null;
    this._sTypeCode = null;    
    this._sBack = null;
    this._sHeight = "0px";
    this._sWin = window.name;
}

B2BTopBar.prototype = {
    Display: function(){
        var sCk = this.GetCookie(this._sCk);
        var sType = this.GetCookieValue(sCk, "TypeCode");
        if(this._sWin == "TopFrame" && Base64.decode(sType) == this._sTypeCode && document.URL.toLocaleLowerCase().indexOf(this._sSvc.toLowerCase()) == -1)
        {
            var oRoot = document.createElement("div");
            var oLayer1 = document.createElement("div");
            var oLayerLogo = document.createElement("div");
            var oLayerText = document.createElement("div");
            var iLogo = document.createElement("img");
            var iText = document.createElement("img");

            oRoot.style.height = this._sHeight;
            oRoot.style.display = "block";
            oRoot.style.position = "relative";
            oRoot.style.width = "100%";
            oRoot.style.background = "url('" + this._sBack + "') repeat left top";
            
            oLayer1.style.width = "902px";
            oLayer1.style.margin = "0 auto";
            
            oLayerLogo.style.width = "200px";
            oLayerLogo.style.float = "left";            
            oLayerLogo.style.styleFloat = "left";   // IE only
            oLayerText.style.width = "600px";
            oLayerText.style.float = "right";            
            oLayerText.style.styleFloat = "right";  // IE only
                        
            iLogo.setAttribute("src", this._sLogo);
            iText.setAttribute("src", this._sText);
            iText.style.float = "right";
            iText.style.styleFloat = "right";
            iText.style.width = "448px";
            
            oLayerLogo.appendChild(iLogo);
            oLayerText.appendChild(iText);
            oLayer1.appendChild(oLayerLogo);
            oLayer1.appendChild(oLayerText);
            oRoot.appendChild(oLayer1);
            
            document.body.style.margin = "0 0px 30px 0";            
            document.body.insertBefore(oRoot, document.body.firstChild);
        }
    },
    
    GetCookie: function(Name){
        var search = Name + "="
        if (document.cookie.length > 0) {
            offset = document.cookie.indexOf(search)
            if (offset != -1) {
              offset += search.length
              end = document.cookie.indexOf(";", offset)
              if (end == -1)
                end = document.cookie.length
              return unescape(document.cookie.substring(offset, end))
            }
        }
        return ""    
    },
    
    GetCookieValue: function(Source,Name){
        var search = Name + "="
        if (Source.length > 0) {
            offset = Source.indexOf(search)
            if (offset != -1) {
              offset += search.length
              end = Source.indexOf("&", offset)
              if (end == -1)
                end = Source.length
              return unescape(Source.substring(offset, end))
            }
        }
        return ""    
    }
}


// È¨ÇÃ·¯½º Å¾¹Ù
var homeplusTopBar = new B2BTopBar();
homeplusTopBar._sSvc = "HomePlus";
homeplusTopBar._sCk = "GTrack";
homeplusTopBar._sBack = "http://img.gongbuwarac.com/Global/B2B/HomePlus/b2b_top_bg.gif";
homeplusTopBar._sLogo = "http://img.gongbuwarac.com/Global/B2B/HomePlus/100423_samsung_top_bi.gif";
homeplusTopBar._sText = "http://img.gongbuwarac.com/Global/B2B/HomePlus/100423_samsung_top_txt.gif";
homeplusTopBar._sTypeCode = "B7415";
homeplusTopBar._sHeight = "54px";
homeplusTopBar.Display();