
    function LineMap() {
        this.home = "";
        this.midStyle = ["", ""];
        this.endStyle = ["", ""];
        this.gubun = "";
        this.errorEnd = "";
        this.path = [];
        this.code = [];
		this.codeLen = 3;
        

        this.add = function (path,code,title,link,var1) {
            this.path[path.toLowerCase()] = code;
			if(!this.code[code])
				this.code[code] = {title:title,link:link,target:var1, code:code};
        }

        // 코드값을 리턴
        this.getCode = function () {
            if (typeof(this.path[location.pathname]) == 'undefined') return "";
            return this.path[location.pathname.toLowerCase()];
        }

        this.getTitle = function (code, cd) {
            var retVal = "";
            var target = "";
            if (this.code[code].link == "" || cd!="") {
                retVal = this.midStyle[0] + this.code[code].title + this.midStyle[1];
            }else{
                if (this.code[code][2] != "") target = " target=\""+ this.code[code].target +"\"";
                retVal = "<a href='"+ this.code[code].link +"' "+ target +">"+ this.midStyle[0] + this.code[code].title + this.midStyle[1] +"</a>";
            }
            return retVal;
        }

        this.getLastTitle = function (code) {
            return this.endStyle[0] + this.code[code].title + this.endStyle[1];
        }

        this.getString = function () {
            var linemap = "";
            var code = this.getCode();
            for (var i=0; i < code.length/this.codeLen ; i++ ) {
                tmp = code.substring(0,i*this.codeLen+this.codeLen);
                if (linemap != "") linemap += this.gubun;
                linemap += this.code[tmp].title;
            }
            return linemap;
        }

		this.menuList = function(){
			var cd = this.getCode().substring(0, 2);
			var html = "";
			var prev = "";
			var tmp = {};

			for(var code in this.code){
				if(code.length>2 && code.substring(0, 2)==cd){
					html += "<a href='"+this.code[code].link+"'>"+this.code[code].title+"</a><br />";
				}
			}
			document.write(html);
		}

		this.topList = function(){
			var cd = this.getCode().substring(0, 2);
			var html = "";
			var prev = "";
			var tmp = {};

			for(var code in this.code){
				if(code.length==2){
					html += "<a href='"+this.code[code].link+"'>"+this.code[code].title+"</a> | ";
				}
			}
			document.write(html);
		}


        this.write = function (cd,pop) {
            if (typeof(cd) == 'undefined') cd = "";

            var linemap = "";
            var tmp = "";
            var code = "";
            var gubun = "";

            if(cd!=""){
                code = cd;
            }else{
                code = this.getCode();
            }
            //alert(code);

            if (typeof(pop) == 'undefined'){
                linemap=this.home;
            }else{
                linemap="";
            }

            if (code != "") {
                for (var i=0; i < code.length/this.codeLen ; i++ ) {
                    if ((typeof(pop) != 'undefined') && i==0){
                        gubun = "";
                    }else{
                        gubun = this.gubun;
                    }
                    tmp = code.substring(0,i*this.codeLen+this.codeLen);
                    if (i == (code.length/this.codeLen -1)) {
                        linemap += gubun + this.getLastTitle(tmp);
                    }else{
                        linemap += gubun + this.getTitle(tmp, cd);
                    }
                }
            }
            document.write(linemap);
        }

    }	




    // 사용방법 
    var objLineMap = new LineMap();
    objLineMap.home = "<p class='lineMap'><a href='/'><img src='/images/common/iconHome.gif' alt='home' class='iconhome' /></a>";	//최상위 주소.
    objLineMap.midStyle = ["", ""]; // 중간 맵 스타일
    objLineMap.endStyle = ["<span>", "</span>"]; // 끝 라인맵 스타일
    objLineMap.gubun = " > ";	//&gt;임.
    objLineMap.codeLen = 2;	//1 Depth 당 코드길이

    // 매개변수 설명
    // path : 코드값을 검색하기 위한 키, 즉 페이지가 로드된 후 현재 페이지의 '/' 이하 주소를 키로 한다.(주의: 중복된 값이 있으면 안됨)
    // code : path에 해당하는 페이지의 코드값
    // title : path에 해당하는 페이지의 제목
    // link : path에 들어오기 위한 실제 주소, 대부분 path 와 동일하며, 값을 지정하지 않거나 마지막 Depth인 경우엔 링크가 걸리지 않는다.
    // target : 페이지의 로드 위치 ex) _top, _self, _parent, _blank





objLineMap.add('', '00', 'home','', '');

objLineMap.add('', '0101', 'Deal','','');
objLineMap.add('', '010101','M&A','','');
objLineMap.add('', '010102', 'Equity & IPO','','');
objLineMap.add('', '010103', 'Debt Monitor','' ,'');
objLineMap.add('', '010104', 'Project Finance','','');
objLineMap.add('', '010105', 'League Table','','');
objLineMap.add('', '010106', 'All Headline','' ,'');
objLineMap.add('', '080107', 'League Table', '' ,'');

objLineMap.add('', '0201', 'Market', '' , '');
objLineMap.add('', '020101', 'Economy', '' , '');
objLineMap.add('', '020102', 'Stocks', '' , '');
objLineMap.add('', '020103', 'Bond', '' , '');
objLineMap.add('', '020104', 'Currency', '' , '');
objLineMap.add('', '020105', 'Fund', '' , '');
objLineMap.add('', '020106', 'Product', '' , '');

objLineMap.add('', '0301', 'Investor', '' , '');
objLineMap.add('', '030101', 'Bank', '' , '');
objLineMap.add('', '030102', 'Securities Service', '' , '');
objLineMap.add('', '030103', 'Asst Management / PEF', '' , '');
objLineMap.add('', '030104', 'Pension/Insurance', '' , '');
objLineMap.add('', '030105', 'Others', '' , '');

objLineMap.add('', '0401', 'Firms & Credit', '' , '');
objLineMap.add('', '040101', 'Company News', '' , '');
objLineMap.add('', '040102', 'Credit Rating', '' , '');
objLineMap.add('', '040103', 'Issue & analysis', '' , '');

objLineMap.add('', '0501', 'Oversea', '' , '');

objLineMap.add('', '0601', 'People & Biz', '' , '');
objLineMap.add('', '060101', 'Hot People', '' , '');
objLineMap.add('', '060102', 'BIZ&Event', '' , '');
objLineMap.add('', '060103', 'Move&Search', '' , '');

objLineMap.add('', '0701', 'Data&Info', '' , '');
objLineMap.add('', '070101', 'Data', '' , '');
objLineMap.add('', '070102', 'Special Reports', '' , '');

objLineMap.add('', '0801', 'Special Menu', '' , '');
objLineMap.add('', '080101', '오피니언(칼럼)', '' , '');
objLineMap.add('', '080102', ' 캘린더', '' , '');
objLineMap.add('', '080103', ' 머니투데이뉴스', '' , '');
objLineMap.add('', '080104', '굿모닝', '' , '');

objLineMap.add('', '0901', 'Footer', '' , '');
objLineMap.add('', '090101', '회사소개', '' , '');
objLineMap.add('', '090102', '개인정보', '' , '');
objLineMap.add('', '090103', '이용약관', '' , '');

objLineMap.add('', '1001', 'Footer', '' , '');
objLineMap.add('', '100101', '회사소개', '' , '');
objLineMap.add('', '100102', '개인정보', '' , '');
objLineMap.add('', '100103', '이용약관', '' , '');

objLineMap.add('', '1101', 'Community', '' , '');
objLineMap.add('', '110101', 'Notice', '' , '');
objLineMap.add('', '110102', 'Freeboard', '' , '');
objLineMap.add('', '110103', '서비스 가이드', '' , '');

objLineMap.add('', '1201', 'head', '' , '');
objLineMap.add('', '120101', '사이트맵', '' , '');
objLineMap.add('', '120102', '회원정보', '' , '');

objLineMap.add('', '1301','etc', '' , '');
objLineMap.add('', '130101','all headlines', '' , '');
objLineMap.add('', '130102','Issue', '' , '');
objLineMap.add('', '130103','통합검색', '' , '');

  
var route = objLineMap.getCode();
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

function popposition(){
	if (!document.getElementById('layerin'))
	{
		return false;
	}
	var parID = document.getElementById('layerin');
	var tagID = document.getElementById('column_list_layer');
	parID.appendChild(tagID);	
}
addLoadEvent(popposition);

function popposition2(){
	if (!document.getElementById('layerin2'))
	{
		return false;
	}
	var parID = document.getElementById('layerin2');
	var tagID = document.getElementById('issue_list_layer');
	parID.appendChild(tagID);	
}
addLoadEvent(popposition2);


function poplinkwarp(){
	if (! document.getElementById('poplink'))
	{
		return false;
	}
	var popen = document.getElementById('poplink');
	var popenList = popen.getElementsByTagName('li');
	popenList[0].onclick=function(){		
		popup02.showopen02(560,360);//회사소개
	}
	popenList[2].onclick=function(){		
		popup04.showopen04(560,430);//개인정보취그방침
		
	}
	popenList[3].onclick=function(){
		popup03.showopen03(560,480);//서비스이용약관
		
	}
}
addLoadEvent(poplinkwarp);
