﻿    /* Copyright (c) 2006 Netmarble Inc. All rights reserved. */
    
    var gtParam = document.getElementById("jsGT").src ; 
    var gtImageURL = gtParam.substring(gtParam.lastIndexOf("imgURL=", gtParam)+7, gtParam.length);
        
    var objMsg = null;    
    var ie=(document.all);
    
    addEvent(window,"load", _init);
    addEvent(window,"resize", scrollDisabled);
    addEvent(window,"resize", _reArrangeOverlay);
    
    function addEvent(elm, evType, fn)
	{
	    if (elm.addEventListener)
	    {
		    elm.addEventListener(evType, fn, false);
		    return true;
	    }
	    else if (elm.attachEvent)
	    {
		    var r = elm.attachEvent('on' + evType, fn);
		    return r;
	    }
	    else
	    {
		    elm['on' + evType] = fn;
	    }
    }

    function _init()
    {  
        objMsg = new NMGeneralTemplate();
    }
        
    function NMMessageBox(_Type, _Title, _Msg, _Func1, _Width, _Height,_Func2)
    {    
        if(objMsg == null) objMsg =  new NMGeneralTemplate();
        _Type = _Type ? _Type.toLowerCase() : "" ; 
        
        if (_Type == "" || ( _Type != "confirm" && _Type != "confirm2" && _Type != "confirm3" && _Type != "popup" && _Type != "function" && _Type != "function2" && _Type != "blank"))
        {
            alert("Check Parameters[ Type ]");
            return;
            if ( _Title == "" || !_Title  ||  _Msg == "" || !_Msg )
            { 
                alert("Check Parameters[ Title, Msg ]");
                return;
            }                       
        }
        else if ( _Type == "popup" )
        { 
           if (_Func1 == "" || !_Func1 || _Width == "" || !_Width || _Height == "" || !_Height  || isNaN(_Width) == true || isNaN(_Height) == true || _Width < 0 || _Height < 0 )
            {
                alert("Check Parameters[ Url, Width, Height ]");
                return;
            }
        }

        objMsg.DivShade(); //Create BG layer 
        objMsg.DivMessage(); //Create MSG Layer
        objMsg.setParam(_Type, _Title, _Msg, _Func1, parseInt(_Width), parseInt(_Height), _Func2); //setting Layer
        objMsg._NM_MessageBox();
    }
    
    function NMImageBox()
    {
        objMsg._NM_ImageBox();
    }
    
    function NMGeneralTemplate()
    {
        this.ShadeLayer     = null;
        this.MessageLayer   = null;
        this.PopupLayer     = null;
        this.IFrameLayer    = null;
        this.messageType    = null;
        this.title          = null;
        this.message        = null;
        this.pwidth         = null;
        this.pheight        = null;
        this.func1          = null;
        this.func2          = null;
        this.xScroll        = null;
        this.yScroll        = null;
        this.imgGTUrl       = gtImageURL ;
        this.MessageBoxTop =  "";
        this.MessageBoxBottom = "";
        this.setParam       = function(_Type, _Title, _Msg, _Func1, _Width, _Height,_Func2)
        {
            this.messageType    = _Type;
            this.title          = _Title;
            this.message        = _Msg;
            this.pwidth         = _Width;
            this.pheight        = _Height;
            this.func1          = _Func1;
            this.func2          = _Func2;
        }
        
        //Background Layer
        this.DivShade = function()
        {
            if(document.getElementById("Div_NM_DisableBox") != null) 
            {
                if(checkFixedPostion())                 
                    window.setTimeout("_reArrangeOverlay()",1);
                else
                    return;
            }                
            
            this.ShadeLayer                         = document.createElement("DIV");
            this.ShadeLayer.setAttribute            ("id","Div_NM_DisableBox");            
            this.ShadeLayer.style.position          =  checkFixedPostion()  ? "absolute" : "fixed" ;
            this.ShadeLayer.style.width             =  NM_getScrollOffsets().width + "px";
            this.ShadeLayer.style.height            =  NM_getScrollOffsets().height + "px";
            this.ShadeLayer.style.left              =  "0px" ;
            this.ShadeLayer.style.top               =  "0px" ;    
            this.ShadeLayer.style.margin            = "auto";
            this.ShadeLayer.style.zIndex            = 2999;
            this.ShadeLayer.style.opacity           = 0.5;
            this.ShadeLayer.style.filter            = "alpha(opacity=50)";
            this.ShadeLayer.style.mozopacity        = 0.0;
            this.ShadeLayer.style.backgroundColor   = "#000000";
            //this.ShadeLayer.style.cursor            = "pointer";
            this.ShadeLayer.style.display           = "none";
            
            if(document.body != null)
                document.body.appendChild( this.ShadeLayer);                    
            else
                alert("General Template Error_DivShade!!" + document.body);                                   
        }
        //Message Box Layer
        this.DivMessage = function()
        {             
            if(document.getElementById("Div_NM_MessageBox") == null) 
            {                            
                this.MessageLayer                       = document.createElement("DIV");
                this.MessageLayer.setAttribute          ("id","Div_NM_MessageBox");
                this.MessageLayer.style.position        = checkFixedPostion()  ? "absolute" : "fixed" ;
                this.MessageLayer.style.opacity         = 0.9;
                this.MessageLayer.style.filter          = "alpha(opacity=92)";
                this.MessageLayer.style.border          = "0px";            
                this.MessageLayer.style.zIndex          = 3000;
                this.MessageLayer.style.display         = "none";
                
                if(document.body != null)
                    document.body.appendChild(this.MessageLayer);             
                else
                    alert("General Template Error_DivMessage!!");                                    
            }                        
            
            firstLayerPosion("Div_NM_MessageBox");
                             
        }
        //Popup Window Layer
        this.DivPopupMessage = function()
        {  
            if(document.getElementById("Div_NM_PopupMessageBox") != null) { // object delete [ div or iframe ]
                document.body.removeChild(document.getElementById("Div_NM_PopupMessageBox"));
            }
            this.PopupLayer                         = document.createElement("DIV");
            this.PopupLayer.setAttribute            ("id","Div_NM_PopupMessageBox");
            this.PopupLayer.style.position          = checkFixedPostion()  ? "absolute" : "fixed" ;
            this.PopupLayer.style.width             = this.pwidth + 10 + "px"  
            this.PopupLayer.style.height            = this.pheight + 10 + "px"  
            //this.PopupLayer.style.top               = "50%";
            //this.PopupLayer.style.left              = "50%";
            //this.PopupLayer.style.marginTop         = "-" + (this.pheight / 2) + "px";
            //this.PopupLayer.style.marginLeft        = "-" + (this.pwidth / 2) + "px";
            //this.PopupLayer.style.marginHeight      = "0px";
            //this.PopupLayer.style.marginWidth       = "0px";
            this.PopupLayer.style.border            = "0px";
            this.PopupLayer.style.zIndex            = 3000;
            this.PopupLayer.style.display           = "none";
               
            if(document.body != null)
            {
                this.PopupLayer.appendChild(this.DivIFrameMessage());
                document.body.appendChild(this.PopupLayer);
                firstLayerPosion("Div_NM_PopupMessageBox");
            }
            else
            {
                alert("General Template Error_DivPopupMessage!!");
            }
        }
        //IFrame Layer
        this.DivIFrameMessage = function()
        {  

            this.IFrameLayer                       = document.createElement("IFRAME");
			this.IFrameLayer.setAttribute          ("id","Div_NM_IframePopupMessageBox");
			this.IFrameLayer.style.width           = this.pwidth + 10 + "px"  
            this.IFrameLayer.style.height          = this.pheight + 10 + "px"                         
            //this.IFrameLayer.style.top             = "50%";
            //this.IFrameLayer.style.left            = "50%";
            //this.IFrameLayer.style.marginTop       = "-" + (this.pheight / 2) + "px";
            //this.IFrameLayer.style.marginLeft      = "-" + (this.pwidth / 2) + "px";
			this.IFrameLayer.setAttribute          ("marginWidth", "0px");
			this.IFrameLayer.setAttribute          ("marginHeight", "0px");
			this.IFrameLayer.setAttribute          ("frameBorder", "0px");
			this.IFrameLayer.setAttribute          ("topmargin", "0px");
			this.IFrameLayer.setAttribute          ("scrolling", "no");
			this.IFrameLayer.setAttribute          ("allowTransparency", true);			
            this.IFrameLayer.setAttribute          ("src",this.func1);
			this.IFrameLayer.style.borderRight     = "0px";
			this.IFrameLayer.style.borderTop       = "0px";
			this.IFrameLayer.style.borderLeft      = "0px";
			this.IFrameLayer.style.borderBottom    = "0px";
			this.IFrameLayer.style.clear           = "both";
			this.IFrameLayer.style.position        = "absolute";
			//this.IFrameLayer.style.backgroundColor = "#FFFFFF";
			this.IFrameLayer.style.zIndex          = 3000;
            this.IFrameLayer.style.display         = "";
                          
            if(document.body != null)
                document.body.appendChild(this.IFrameLayer);
            else
                alert("General Template Error_DivIFrameMessage!!");
            
            return this.IFrameLayer;
        }
        
        this._NM_MessageBox = function(_content, _boolMsgBox)
        {  
            if(this.messageType == "popup")
            {
                this.MessageLayer.innerHTML = objMsg.DivPopupMessage();
                if(this.PopupLayer)
                {
                    document.getElementById("Div_NM_IframePopupMessageBox").setAttribute("src",this.func1,true);
                }                    
            }
            else
            {   
                window.focus();             
                if(_content != "" && typeof(_content) != "undefined") 
                {
                    if(_boolMsgBox)                
                    {
                        this.MessageLayer.innerHTML = this.MessageBoxTop + _content + this.MessageBoxBottom
                    }
                    else
                        this.MessageLayer.innerHTML = _content;                   
                }                    
                else
                    this.MessageLayer.innerHTML = this.ConfirmMessage();
            }
                        
            this._NM_DisableBox('Div_NM_DisableBox','block');
    		
    		var el = (this.messageType == "popup") ? document.getElementById('Div_NM_PopupMessageBox') : document.getElementById('Div_NM_MessageBox') ;    		
		    
	        el.style.display    = 'block';
	        el.style.visibility = 'visible';
        	
        	this._NM_hideSelect("hidden");
        	this._NM_readonlySetInput(); 
        }
        
        this._NM_DisableBox = function(id, displayMode)
        {
            var el = document.getElementById(id);
    	
            if (el.style.display == displayMode) return;    		
            if (checkFixedPostion() && displayMode == 'block')
            {            
                document.getElementById(id).style.left = NM_GetPageScrollTop().left +"px" ;
                document.getElementById(id).style.top  = NM_GetPageScrollTop().top +"px" ;
                addEvent(window,"scroll", scrollDisabled);
                addEvent(window,"scroll", _reArrangeOverlay);    	                
            }    		
            el.style.display = displayMode;                        		                    
        }
        
        this._NM_HideMessageBox = function()
        {
            this._NM_DisableBox('Div_NM_DisableBox','none');
            
            if (this.messageType == "popup")
                this._NM_DisplayOff('Div_NM_PopupMessageBox');                
            else
                this._NM_DisplayOff('Div_NM_MessageBox');
	        
	        document.body.style.overflow = "";
        }
        
        this._NM_DisplayOff = function(id)
        {
            var el = document.getElementById(id);
		        el.style.display = 'none';
		        this._NM_hideSelect("visible");        
		        this._NM_readonlyRemoveInput(); 
        }
        
	    this._NM_hideSelect  = function(_view)
	    {
 		    var selectTags = document.getElementsByTagName("select");
 		    
 		    for(i=0;i<selectTags.length;i++)
 		    {
  			    selectTags[i].style.visibility = _view;
 		    }
	   }
	   
        this._NM_readonlySetInput = function()
        {
            if(typeof(inputBoxReadOnly) != "undefined" && inputBoxReadOnly)
            {
                var inputTags = document.getElementsByTagName('input');
                
                for(i=0;i<inputTags.length;i++)
                {
	                inputTags[i].setAttribute("readOnly",1);
                }
            }
        }

        this._NM_readonlyRemoveInput = function()
        {
            var inputTags = document.getElementsByTagName('input');
            
            for(i=0;i<inputTags.length;i++)
            {
	            inputTags[i].removeAttribute("readOnly",0);
            }
        }
        
        this.MessageBoxTop += "<table width=\"320\" height=\"170\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\" oncontextmenu='return false' ondragstart='return false' onselectstart='return false'>";
        this.MessageBoxTop += "	<tr>";
        this.MessageBoxTop += "		<td width=\"10\" height=\"10\" style=\"background:url(\'" + this.imgGTUrl + "/img/portal/c000101_common/portal/tbl_gt_lt.gif')\"></td>";
        this.MessageBoxTop += "		      <td style=\"background-color:#414141\"> </td>";
        this.MessageBoxTop += "		<td width=\"10\" style=\"background:url(\'" + this.imgGTUrl + "/img/portal/c000101_common/portal/tbl_gt_rt.gif')\"></td>";
        this.MessageBoxTop += "	</tr>";
        this.MessageBoxTop += "	<tr>";
        this.MessageBoxTop += "		<td style=\"background-color:#414141\"> </td>";
        this.MessageBoxTop += "		<td valign=\"top\" style=\"background-color:#414141; top; padding:0 5px 0 5px\">";                 
                 
        this.MessageBoxBottom += "		</td>";
        this.MessageBoxBottom += "		<td style=\"background-color:#414141\"> </td>";
        this.MessageBoxBottom += "		</td>";
        this.MessageBoxBottom += "	</tr>";
        this.MessageBoxBottom += "	<tr>";
        this.MessageBoxBottom += "		<td height=\"10\" style=\"background:url(\'" + this.imgGTUrl + "/img/portal/c000101_common/portal/tbl_gt_lb.gif')\"></td>";
        this.MessageBoxBottom += "		<td style=\"background-color:#414141\"> </td>";
        this.MessageBoxBottom += "		<td style=\"background:url(\'" + this.imgGTUrl + "/img/portal/c000101_common/portal/tbl_gt_rb.gif')\"></td>";
        this.MessageBoxBottom += "	</tr>";
        this.MessageBoxBottom += "</table>";
        this.MessageBoxBottom += "</div>";      
          
                                               
        this.ConfirmMessage = function()
        {            
            var sHTML =  "<div>" 
            
                sHTML += this.MessageBoxTop ;
                
                sHTML += "			<table width=\"100%\" height=\"150\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
                sHTML += "				<tr>";
                sHTML += "					<td height=\"15\" align=\"right\">";
                sHTML += "						<img src=\"" + this.imgGTUrl + "/img/portal/c000101_common/portal/tbl_gt_icon_x.gif\" width=\"15\" height=\"15\" border=\"0\" style=\"cursor:pointer\" onClick=\"javascript:objMsg._NM_HideMessageBox()\">";
                sHTML += "					</td>";
                sHTML += "				</tr>";
                sHTML += "				<tr>";
                sHTML += "					<td height=\"25\">";
                sHTML += "						<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
                sHTML += "							<tr>";
                sHTML += "								<td valign=\"top\" class=\"gt_h1\" style=\"padding:3px 0 0 0px;\">";
                sHTML += 								this.title
                sHTML += "								</td>";
                sHTML += "							</tr>";
                sHTML += "						</table>";
                sHTML += "					</td>";
                sHTML += "				</tr>";
                sHTML += "				<tr>";
                sHTML += "					<td valign=\"top\" class=\"gt_p1\" style=\"padding:10px 0 0 0px;\">";
                sHTML += 					this.message
                sHTML += "					</td>";
                sHTML += "				</tr>";
                sHTML += "				<tr>";
                sHTML += "					<td align=\"center\" valign=\"bottom\" style=\"padding:5px 0 0 0px\">";
                if(this.func1 && this.messageType == "confirm")
                {
                 sHTML += "                       <img src=\"" + this.imgGTUrl + "/img/portal/c000101_common/portal/btn_ok.gif\" border=\"0\" style=\"cursor:pointer\" onClick='javascript:location.href=\"" + this.func1 + "\"'>";
                 sHTML += "                       <img src=\"" + this.imgGTUrl + "/img/portal/c000101_common/portal/btn_cancel.gif\" border=\"0\" style=\"cursor:pointer\" onClick=\"javascript:objMsg._NM_HideMessageBox()\">";
                }
                else if(this.func1 && this.messageType == "confirm2")
                {
                    sHTML += "                       <img src=\"" + this.imgGTUrl + "/img/portal/c000101_common/portal/btn_ok.gif\" border=\"0\" style=\"cursor:pointer\" onClick='javascript:location.href=\"" + this.func1 + "\"'>";
                }
                else if(this.func1 && this.messageType == "confirm3")
                {
                    sHTML += "                       <img src=\"" + this.imgGTUrl + "/img/portal/c000101_common/portal/btn_ok.gif\" border=\"0\" style=\"cursor:pointer\" onClick=\"objMsg._NM_HideMessageBox();" + this.func1 + ";\">";
                }
                else if(this.func1 && this.messageType == "function")
                {                
                    sHTML += "                       <img src=\"" + this.imgGTUrl + "/img/portal/c000101_common/portal/btn_ok.gif\" border=\"0\" style=\"cursor:pointer\" onClick=\"" + this.func1 + ";objMsg._NM_HideMessageBox();\">";                  
                    
                    sHTML += "                       <img src=\"" + this.imgGTUrl + "/img/portal/c000101_common/portal/btn_cancel.gif\" border=\"0\" style=\"cursor:pointer\" onClick=\"javascript:objMsg._NM_HideMessageBox()\">";
                }
                else if(this.func1 && this.func2 && this.messageType == "function2")
                {
                 sHTML += "                       <img src=\"" + this.imgGTUrl + "/img/portal/c000101_common/portal/btn_ok.gif\" border=\"0\" style=\"cursor:pointer\" onClick=\"" + this.func1 + "\">";
                 sHTML += "                       <img src=\"" + this.imgGTUrl + "/img/portal/c000101_common/portal/btn_cancel.gif\" border=\"0\" style=\"cursor:pointer\" onClick=\"" + this.func2   + "\">";
                } 
                else if(this.messageType == "blank")
                {                
                }               
                else
                {
                 sHTML += "				<img src=\"" + this.imgGTUrl + "/img/portal/c000101_common/portal/btn_ok.gif\" border=\"0\" style=\"cursor:pointer\" onClick=\"javascript:objMsg._NM_HideMessageBox()\">";
                }
                sHTML += "					</td>";
                sHTML += "				</tr>" ;
                sHTML += "				<tr><td height=\"10\"></td></tr>" ;
                sHTML += "			</table>" ;
                
                sHTML += this.MessageBoxBottom ;
         
                return sHTML;
        }       
        
        this.PopupMessage = function()
        {
           var  sHTML ="<table border='0' cellpadding='0' cellspacing='0' style='background-color:Transparent;'>"
                sHTML +=    "<tr>"
                sHTML +=        "<td align='center' valign='top'>"
                sHTML +=        "<iframe src='" + this.func1 + "' id='ifmLocation' oncontextmenu='return false' ondragstart='return false' onselectstart='return false' style='width:" + this.pwidth + "px;height:" + this.pheight + "px;direction:ltr;display=inline;' frameborder='no' allowtransparency='true'>"
                sHTML +=        "</iframe>"
                sHTML +=        "</td>"
                sHTML +=    "</tr>"
                sHTML +="</table>"

                return sHTML;
        }
     }  
//---------------------------------------------
//  set first left,top position (create Div)
//---------------------------------------------   
    function firstLayerPosion(id)
    {
        var layerPos = checkFixedPostion() ? NM_getScrollCenter(id) : NM_getPageCenter(id) ;                 
        document.getElementById(id).style.left = layerPos.left +"px" ;
        document.getElementById(id).style.top = layerPos.top +"px" ;            
    }
//---------------------------------------------
//  set background Div  
//---------------------------------------------   
    function _reArrangeOverlay()
    {
        try{                                   
            document.getElementById("Div_NM_DisableBox").style.height   = NM_getScrollOffsets().height +"px" ;
            if(checkFixedPostion()) 
            {           
                var gnb = document.getElementById("GNB2") != null ? document.getElementById("GNB2") : document.getElementById("GNB1") ; 
                var gnbWidth = gnb != null ? gnb.offsetWidth : NM_getScrollOffsets().width ;
                
                if(gnb.offsetWidth >= (NM_getScrollOffsets().width + NM_GetPageScrollTop().left))
                {
                    document.getElementById("Div_NM_DisableBox").style.width    = NM_getScrollOffsets().width +"px" ;
                }
                document.getElementById("Div_NM_DisableBox").style.left     = NM_GetPageScrollTop().left +"px" ;
                document.getElementById("Div_NM_DisableBox").style.top      = NM_GetPageScrollTop().top +"px" ;        
            }
            else
            {
                document.getElementById("Div_NM_DisableBox").style.width    = NM_getScrollOffsets().width +"px" ;
            }            
        }catch(x){}    
    }
//---------------------------------------------
//  set message Div  
//---------------------------------------------       
    function scrollDisabled(e)
    {            
        //try{
            
            var evt = window.event || e ;
            
            if(!checkFixedPostion() && !evt.type == "resize") return;
            
            var currentBoxID = (document.getElementById("Div_NM_PopupMessageBox") != null && document.getElementById("Div_NM_PopupMessageBox").style.display == "block")  ? "Div_NM_PopupMessageBox" : "Div_NM_MessageBox";

            if(document.getElementById(currentBoxID) == null) return ;
                        
            var docRoot     = NM_truebody();
	        var maxWidth    = Math.max(docRoot.clientWidth, docRoot.offsetWidth, docRoot.scrollWidth);    	    	    
            var maxHeight   = Math.max(docRoot.clientHeight, docRoot.offsetHeight, docRoot.scrollHeight);                
            var scrollPos = NM_GetPageScrollTop() ;
            var centerPos = checkFixedPostion() ? NM_getScrollCenter(currentBoxID) :NM_getPageCenter(currentBoxID) ;
            var layerSize = NM_getLayerSize(currentBoxID);
            if(checkFixedPostion())
            {
                if(layerSize.width + scrollPos.left > maxWidth) centerPos.left = maxWidth - layerSize.width ;
                if(layerSize.height + scrollPos.top > maxHeight) centerPos.top = maxHeight - layerSize.height ;
            }

            document.getElementById(currentBoxID).style.left = currentBoxID == "Div_NM_PopupMessageBox" ? (centerPos.left-10) +"px"  : centerPos.left  +"px";
            document.getElementById(currentBoxID).style.top = centerPos.top +"px" ; 
            //document.title = maxWidth + "--" + centerPos.left + "--" + layerSize.width;
            
        //}catch(x){}    
    }
//---------------------------------------------
//  get true html content
//---------------------------------------------             
    function NM_truebody()
    {
       return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
    }
//---------------------------------------------
//  get max html layout width, height
//---------------------------------------------                 
    function NM_getScrollOffsets()
    {   
        var scrollOffsets = {} ;     
	    var docRoot     = NM_truebody();
	    var maxWidth    = Math.max(docRoot.clientWidth, docRoot.offsetWidth, docRoot.scrollWidth);    	    	    
        var maxHeight   = Math.max(docRoot.clientHeight, docRoot.offsetHeight, docRoot.scrollHeight);          
        if(checkFixedPostion()) 
        {            
            maxWidth    = docRoot.clientWidth;
            maxHeight   = docRoot.clientHeight;    
        }
                
        scrollOffsets.width  = maxWidth ;
        scrollOffsets.height = maxHeight ;
        return scrollOffsets;
    }
//---------------------------------------------
//  get document.client width, height
//---------------------------------------------                         
    function NM_getPageSize()
    {
        var pageSize = {} ;        
        pageSize.width  = parseInt(NM_truebody().clientWidth) ; 
        pageSize.height = parseInt(NM_truebody().clientHeight) ; 
	    return pageSize;
    }    
//---------------------------------------------
//  get scroll width, height
//---------------------------------------------
    function NM_getScrollSize()
    {
        var scrollSize = {} ;        
        scrollSize.width = (ie) ? NM_truebody().offsetWidth/2 + NM_truebody().scrollLeft : window.innerWidth/2+window.pageXOffset;
        scrollSize.height = (ie) ? NM_truebody().offsetHeight/2 + NM_truebody().scrollTop : window.innerHeight/2+window.pageYOffset;
        return scrollSize;                
    }    
//---------------------------------------------
//  get scroll center postion
//---------------------------------------------        
    function NM_getScrollCenter(id)
    {
        var pageScrollCenter = {};
                     	    
        pageScrollCenter.left = parseInt(NM_getScrollSize().width-(NM_getLayerSize(id).width/2)) ;
        pageScrollCenter.top = parseInt(NM_getScrollSize().height-(NM_getLayerSize(id).height/2)) ;
                         
	    return pageScrollCenter;
    }
//---------------------------------------------
//  get layer width, height
//---------------------------------------------            
    function NM_getLayerSize(id)        
    {
        var layerSize = {};
        layerSize.width = layerSize.height = 0 ;
        var el = document.getElementById(id);        
        if(el != null)         
        {
            var elWidth = el.offsetWidth  ? el.offsetWidth  : el.scrollWidth;            
            var elHeight = el.offsetHeight ? el.offsetHeight : el.scrollHeight;
            layerSize.width = typeof(elWidth) == "undefined"  || elWidth == 0 ? 320 : elWidth ;
            layerSize.height = typeof(elHeight) == "undefined" || elHeight == 0 ? 170 : elHeight ;            
        }        
        return layerSize ;
    }
//---------------------------------------------
//  get layout(html) center position
//---------------------------------------------                
    function NM_getPageCenter(id)
    {
        var pageCenter = {};        
        
        pageCenter.left = parseInt((NM_getPageSize().width -NM_getLayerSize(id).width)/2) ;
        pageCenter.top  = parseInt((NM_getPageSize().height-NM_getLayerSize(id).height)/2) ;   
        
        return pageCenter ;
    }
//---------------------------------------------
//  get scroll top,left postion
//---------------------------------------------        
    function NM_GetPageScrollTop()
    {      	            
        var pageScrollTop = {} ;
        
        pageScrollTop.left = window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft;
        pageScrollTop.top = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
	    
	    return pageScrollTop ;
    }
//---------------------------------------------
//  get doctype
//---------------------------------------------        
    function detectDoctype()
    {
        var re = /\s+(X?HTML)\s+([\d\.]+)\s*([^\/]+)*\//gi;
        var res = false;
        //Only IE
        if(typeof document.namespaces != "undefined")
            res = document.all[0].nodeType==8 ? re.test(document.all[0].nodeValue) : false;
        else
            res = document.doctype != null ? re.test(document.doctype.publicId) : false;
        if(res)
        {
            res = new Object();
            res['xhtml']=RegExp.$1;
            res['version']=RegExp.$2;
            res['importance']=RegExp.$3;            
            return res;
        }
        else
        {
            return null;
        }
    }
//---------------------------------------------
//  check netmarble doctype
//---------------------------------------------            
    function checkDoctype()
    {
        var dt = detectDoctype();
        return (dt != null) && (dt.xhtml == "XHTML" && dt.version == "1.0" && dt.importance == "Transitional") ? true : false ;
    }            
//---------------------------------------------
//  check internet explorer 6 
//---------------------------------------------                
    function checkIeIe6()
    {
        return (navigator.appVersion.indexOf("MSIE 6") != -1 && navigator.appVersion.indexOf('MSIE 7')==-1) ? true : false ;
    }            
//---------------------------------------------
//  check layer fixed or absolute
//---------------------------------------------                    
    function checkFixedPostion()
    {
        return ((ie && !checkDoctype()) || ie && checkIeIe6()) ? true : false ;      
    }
    