document.domain = "shinhaninvest.com";
signtag = new Object;
signtag[2] = "<font color=red>¡ã</font>";
signtag[5] = "<font color=blue>¡å</font>";
signtag[3] = "";
signtag[1] = "<font color=red><b>¡è</b></font>";
signtag[4] = "<font color=blue><b>¡é</b></font>";
signtag[0] = "";
signtag['undefined'] = "";

signtag2 = new Object;
signtag2[0] = "";
signtag2[1] = "<b>¡è</b>";
signtag2[2] = "¡ã";
signtag2[3] = "";         //º¸ÇÕ
signtag2[4] = "<b>¡é</b>";//ÇÏ¶ô
signtag2[5] = "¡å";       //º¸ÇÕ

var tryCnt = 0;
var isInit = false;
var reqFrame;
function initService(){
    if(!isInit) {
    	
        if( existFrame("btm") ) {
            reqFrame = top.frames["btm"];
        }else{
            frames["activeX"].location.href = "/active/GoodiWActive_popup.htm";
            reqFrame = frames["activeX"];
            
        }
    }
    //alert(reqFrame);
    if( tryCnt < 10  ) {
    	
        isInit = true;
        if ( !reqFrame.isInit ){
        	 
        	 if(tryCnt++ < 10) {  setTimeout("initService()", 500); } 
       	 }
        else {
        	//alert(reqFrame.location.href);
        	reqFrame.setRequestWindow(this);
        }	
    }
}

function existFrame() {
    var f = top;
    for(var n=0, len=arguments.length; n<len; n++) {
        if(!(f=f.frames[arguments[n]])) return false;
    }
    return true;
}

function Exec(r) {
   
   //try{eval(r);}catch(e){  }
   var transform = unescape(r)
   //alert("unescape:" + transform);
   try{eval(transform);}catch(e){  }
}

function initTable ( tables ){
    function init() {
        this.TdList  = new Object;
        this.columnIdx = new Object;
        var rlen = this.rows.length;
        var row;
        var clen;
        for ( var r = 0; r < rlen; r++ ) {
            row = this.rows[r];
            for ( var c = 0, clen = row.cells.length; c < clen; c++ ) {
                if ( row.cells[c].fname ) {
                    this.TdList[row.cells[c].fname] = row.cells[c];
                    this.columnIdx[row.cells[c].fname] = c;
                }
            }
        }
    }
    function initCol() {
        this.TrList  = new Object;
        var rlen = this.rows.length;
        var row;
        var clen;
        for ( var r = 0; r < rlen; r++ ) {
            row = this.rows[r];
            if ( row.cells[0].fname != null ) {
                this.TrList[row.cells[0].fname] = row;
            }

        }
    }
    function clearRowAll(initRowSize) {
       var rlen=clen=0;
       var j=0;
       for(var n = 0, rlen=this.rows.length-1 ; n < rlen ; n ++){
            for(j=0, clen = this.rows[n].cells.length ; j < clen ; j++)
                this.rows[n].cells[j].innerHTML = '';
       }
       if ( initRowSize ){
            while(1){
                rlen = this.rows.length;
                if( initRowSize < rlen ) this.deleteRow(rlen-2);
                else return;
            }
       }
    }
    function clearTable(){
        for ( var n in this.TdList )
            this.TdList[n].innerHTML = '';
    }
    function clearColor(){
        for ( var n in this.TdList )
            this.TdList[n].style.backgroundColor = '';
    }
    function setHTML(fname, html, sColor) {
        if( this.TdList[fname] ){
            if ( html ){
                if( sColor) this.TdList[fname].style.backgroundColor = 'DFDFF0';
                this.TdList[fname].innerHTML = html;
            }else
                this.TdList[fname].innerHTML = '';
         }
    }
    function setHTMLN(fname, html, sColor) {
        if( this.TdList[fname] ){
            if ( html ){
                if( sColor) this.TdList[fname].style.backgroundColor = 'DFDFF0';
                this.TdList[fname].innerHTML = html;
            }else
                this.TdList[fname].innerHTML = '&nbsp;';
         }
    }
    
    function setText(fname, html) {
        if( this.TdList[fname] ){
            if ( html ){
                this.TdList[fname].innerText = html;
            }else
                this.TdList[fname].innerText = '';
         }
    }
    function setRowHTML(r, fname, html) {
        this.rows[r].cells[this.columnIdx[fname]].innerHTML = html;
    }
    function setRowHTMLN(r, fname, html) {
        if(html){
            this.rows[r].cells[this.columnIdx[fname]].innerHTML = html;
        }else{
            this.rows[r].cells[this.columnIdx[fname]].innerHTML = '&nbsp;';
        }
    }
    
    function setRowText(r, fname, html) {
        this.rows[r].cells[this.columnIdx[fname]].innerText = html;
    }
    function setColHTML(r, fname, html) {
        if( (this.TrList[fname]) && this.TrList[fname].cells[r+1] ){
            if(html) this.TrList[fname].cells[r+1].innerHTML = html;
            else     this.TrList[fname].cells[r+1].innerHTML = '';
        }
    }
    function setColText(r, fname, html) {
        if( (this.TrList[fname]) && this.TrList[fname].cells[r+1] ){
            if(html) this.TrList[fname].cells[r+1].innerText = html;
            else     this.TrList[fname].cells[r+1].innerText = '';
        }
    }

    for ( var n in tables ){
        tables[n].init        = init;
        tables[n].initCol     = initCol;
        tables[n].clearRowAll = clearRowAll;
        tables[n].clearAll    = clearTable;
        tables[n].clearTable  = clearTable;
        tables[n].clearColor  = clearColor;
        tables[n].setHTML     = setHTML;
        tables[n].setHTMLN     = setHTMLN;
        tables[n].setText     = setText;
        tables[n].setRowHTML  = setRowHTML;
        tables[n].setRowHTMLN  = setRowHTMLN;
        tables[n].setRowText  = setRowText;
        tables[n].setColHTML  = setColHTML;
        tables[n].setColText  = setColText;
        tables[n].init();
   }
}

function drawRows(tab, total_cnt, setDoubleColor ) {
    var tdsArr = new Array;
    for ( var n = 0; n < tab.rows.length; n++ ) {
        var cells = tab.rows[n].cells;
        var tds = "";
        for ( var m = 0; m < cells.length; m++ ) {
            var cell = cells[m];
            tds += "<td nowrap ";
            if ( cell.rowSpan > 1 ) tds += " rowspan="+cell.rowSpan;
            if ( cell.colSpan > 1 ) tds += " colspan="+cell.colSpan;
            if ( cell.align )   tds += " align="+cell.align;
            if ( cell.style.display == 'none' ) tds += " style='display:none;'";
            tds += " />";
        }
        tdsArr[n] = tds;
    }
    var tdsLen = tdsArr.length;
    for ( var n = 1; n < total_cnt; n++ ) {
        for ( var m = 0; m < tdsLen; m++ ) {
            if ( setDoubleColor ){
                if ( setDoubleColor == '2' )
                    document.write("<tr bgcolor="+((n%2) < 1 ? "#FFFFFF":"#F2F2F2")+" height=20 >"+ tdsArr[m] +"</tr>");
                else
                    document.write("<tr bgcolor="+((n%10) < 5 ? "#FFFFFF":"#F2F2F2")+" height=20 >"+ tdsArr[m] +"</tr>");
            }else   document.write("<tr bgcolor=#FFFFFF height=20 >"+ tdsArr[m] +"</tr>");
        }
    }
}

function addRecord(table){
    var record_counter = table.rows.length;
    if ( record_counter >= maxTableRow ) {
        table.moveRow(record_counter-1, 0);
    }else if( record_counter >= 1 && ( table.rows[0].cells[0].innerHtml != '' ) ){
        table.insertBefore( table.rows[1].cloneNode(true), table.rows[0]);
    }
    var rlen;
    for( var n=0, rlen=table.rows[0].cells.length ; n < rlen ; n++) table.rows[0].cells[n].innerHTML = '';
}

function addRow(table, copyidx, position ){
    try{
        table.insertBefore( table.rows[copyidx].cloneNode(true), table.rows[position]);
    }catch(e){ }
}

function addRow2(table, tr11, tr22 ){
    table.insertBefore( tr11, null);
    table.insertBefore( tr22, null);
}

function addBeforeTailRecord(table, n){
    if ( n >= table.rows.length ){
        table.appendChild(table.rows[table.rows.length-1].cloneNode(true));
        var rlen=clen=0;
        rlen = table.rows.length-1;
        for( var i=0,clen=table.rows[rlen].cells.length ; i < clen ; i++) table.rows[rlen].cells[i].innerHTML = '';
    }
}

function getSign(sign) {
    var sign = removeTag(sign);
    switch(sign) {
        case '2' :return "<font color=red>¡ã</font>";//»ó½Â
        case '5' :return "<font color=blue>¡å</font>";//ÇÏ¶ô
        case '3' :return "";
        case '1' :return "<font color=red><b>¡è</b></font>";//»óÇÑ
        case '4' :return "<font color=blue><b>¡é</b></font>";//ÇÏÇÑ
        default  :return "";
    }
}

function getColorValue(sgn, value) {
    try{
    switch(sgn) {
        case '2' :return "<font color=red>"+removeTag(value)+"</font>";
        case '5' :return "<font color=blue>"+removeTag(value)+"</font>";
        case '3' :return removeTag(value);
        case '1' :return "<font color=red>"+removeTag(value)+"</font>";
        case '4' :return "<font color=blue>"+removeTag(value)+"</font>";
        default  :return removeTag(value);
    }
    }catch(e){ return value; }
}

function getSignValue(sign, value) {
    var sign = removeTag(sign);
    switch(sign) {
        case '2' :return "<font color=red>¡ã "+removeFlag(removeTag(value))+"</font>";//»ó½Â
        case '5' :return "<font color=blue>¡å "+removeFlag(removeTag(value))+"</font>";//ÇÏ¶ô
        case '3' :return "<font color=#666666>"+removeFlag(removeTag(value))+"</font>";//º¸ÇÕ
        case '1' :return "<font color=red><b>¡è</b> "+removeFlag(removeTag(value))+"</font>";//»óÇÑ
        case '4' :return "<font color=blue><b>¡é</b> "+removeFlag(removeTag(value))+"</font>";//ÇÏÇÑ
        default  :return "<font color=#666666>"+removeFlag(removeTag(value))+"</font>";//º¸ÇÕ
    }
}

function CompareValue(v1, v2) {
    var n1, n2;
    switch ( typeof v1 ) {
        case "string": n1 = tagToNumber(v1); break;
        case "number": n1 = v1; break;
    }
    switch ( typeof v2 ) {
        case "string": n2 = tagToNumber(v2); break;
        case "number": n2 = v2; break;
    }
    return ( n1 > n2 ) ? '2' : ( ( n1 < n2 ) ? '5' : '3' );
}

function CV2(v1, v2) {
    try{
    return ( tagToNumber(v1) > tagToNumber(v2) ) ? '2' : ( ( tagToNumber(v1) < tagToNumber(v2) ) ? '5' : '3' );
    }catch(e){ return '3'; }
}

function compareColorValue(v1,v2){
    var n1, n2, sign;
    switch ( typeof v1 ) {
        case "string": n1 = tagToNumber(v1); break;
        case "number": n1 = v1; break;
    }
    switch ( typeof v2 ) {
        case "string": n2 = tagToNumber(v2); break;
        case "number": n2 = v2; break;
    }
    sign =  ( n1 > n2 ) ? '2' : ( ( n1 < n2 ) ? '5' : '3' );

    return 	getColorValue(sign, v1);
}

function getColorJname(type, value) {
    //var type = removeTag(type);
    value = value.replace('&', '&amp;');
    switch(type) {
        case "2" : return value;
        case "3" : return "<font color=#5E3E95>"+value+"</font>";
        default  : return "<font color=#2B7279>"+value+"</font>";
    }
}

//function removeTag(s) {
//   try{
//    return s.replace(/<[^<>]+>/g, "");
//   }catch(e){ return s }
//}

function removeTag(s) {
    switch ( typeof s ) {
        case "string": return s.replace(/<[^<>]+>/g, "");
        default : return s;
    }
}

function removeFlag(s) {
    switch ( typeof s ) {
        case "string": return s.replace(/[¡è¡ã¡é¡å]/g, "");
        case "number": return s;
        default : return "";
    }
}

function removeComma(s) {
    return s.replace(/[, ]/g, "")
}

function tagToNumber(tag) {
    try{
    return Number(removeTag(tag).replace(/[, ]/g, ""));
    }catch(e){ return tag; }
}

function nbformat(numstr) {
  var re0 = /(\d+)(\d{3})($|\..*)/;
  if (re0.test(numstr)) return numstr.replace(re0,function(str,p1,p2,p3) { return nbformat(p1) + "," + p2 + p3; });
  else return numstr;
}

function comma(s) {

    var numstr;
    switch ( typeof s ) {
        case "string":  numstr = removeComma(s); break;
        case "number" : numstr = String(s); break;
        default: return "0";
    }
    return nbformat( numstr, 3);
}

function addZero(number) {
	var numStr = number+"";
	return ( number < 10 ) ? ("0" + numStr): numStr;
}

function getNewDate( odata, dtype, doppset ){
    var nDate;
    nDate = (odata != "") ? new Date(odata.substr(0,4), odata.substr(4,2)-1,odata.substr(6,2)) : new Date();
    if( dtype == 'Y' ) nDate = new Date( tagToNumber(odata.substr(0,4))+doppset, odata.substr(4,2)-1,odata.substr(6,2)) ;
    else if( dtype == 'M' ) nDate = new Date(odata.substr(0,4), tagToNumber(odata.substr(4,2))-1+doppset, odata.substr(6,2)) ;
    else nDate = new Date(odata.substr(0,4), odata.substr(4,2)-1, tagToNumber(odata.substr(6,2))+doppset) ;
    var cdate = nDate.getYear() + addZero(nDate.getMonth() + 1) + addZero(nDate.getDate())
    return cdate;
}

function getMonth( edate, prevnext ) {
    var endDate = (edate != "") ? new Date(edate.substr(0,4), edate.substr(4,2)-1,edate.substr(6,2)) : new Date();
    if (isNaN(edate)) { endDate=new Date(); }
    endDate.setMonth(endDate.getMonth() + prevnext );
    var cMonth = endDate.getMonth() + 1;
    var cDay   = endDate.getDate() - 1;
    return endDate.getYear() + addZero(cMonth) + addZero( cDay);
}

function getDate(){
    var date = new Date();
    return formatDate2(date, 'YMd');
}

function formatDate2(d, format) {
    var r = "";
    for ( var n = 0, cnt = format.length; n < cnt; n++ ) {
        var c = format.charAt(n);
        switch ( c ) {
            case "Y": r += String(d.getFullYear()).npad(4); break;
            case "M": r += String(d.getMonth()+1).npad(2); break;
            case "d": r += String(d.getDate()   ).npad(2); break;
            case "H": r += String(d.getHours()  ).npad(2); break;
            case "m": r += String(d.getMinutes()).npad(2); break;
            case "s": r += String(d.getSeconds()).npad(2); break;
            default : r += c;
        }
    }
    return r;
}

function formatDate(d, format) {
    var r = "";
    var c;
    for ( var n = 0, cnt = format.length, i=0; n < cnt; n++ ) {
        c = format.charAt(n);
        switch ( c ) {
            case "Y":
            case "y":
            case "M":
            case "D":
            case "d":
            case "H":
            case "h":
            case "m":
            case "S":
            case "s": r += d.charAt(i); i++; break;
            case "r": i++; break;
            default : r += c;
        }
    }
    return r;
}

function dateFormat(dateStr) {
	if (dateStr)  return dateStr.length >= 8 ? (dateStr.substr(0, 4)+"/"+dateStr.substr(4, 2)+"/"+dateStr.substr(6, 2)): (dateStr.substr(0, 2)+"/"+dateStr.substr(2,2));
	else return "";
}
function timeFormat(timeStr) {
    try{
        if ( !isNaN(timeStr) )
         return timeStr.length >= 6 ? (timeStr.substr(0, 2)+":"+timeStr.substr(2, 2)+":"+timeStr.substr(4, 2)):(timeStr.substr(0, 2)+":"+timeStr.substr(2, 2));
        else{
         if( timeStr.indexOf('J') == -1 )
            return (timeStr.substr(0, 1)+":"+timeStr.substr(1, 1)+":"+timeStr.substr(2, 1));
         else
            return timeStr.substr(0, 2)+":"+timeStr.substr(2, 2);
        }
    }catch(e){
        return "";
    }
}

function unFormat( dateStr ){
    return dateStr.replace(/[/ :]/g, "");
}

function unregImage(icode){
try{
reqFrame.regImage('SC',icode,'C');//Ã¼°á ÇØÁ¦
reqFrame.regImage('SH',icode,'C');//È£°¡ ÇØÁ¦
reqFrame.regImage('SK',icode,'C');//È¸¿ø»ç ÇØÁ¦
}catch(e){}
}

function regImage(icode){
try{
	//alert('icode');
reqFrame.regImage('SC',icode,'U');//Á¾¸ñ ½Ç½Ã°£ Ã¼°á µî·Ï
reqFrame.regImage('SH',icode,'U');//Á¾¸ñ ½Ç½Ã°£ È£°¡ µî·Ï
reqFrame.regImage('SK',icode,'U');//Á¾¸ñ ½Ç½Ã°£ È¸¿ø»ç µî·Ï
}catch(e){}
}

function setImage(itype,icode,ioption){
	try{
	reqFrame.regImage(itype,icode,ioption);//ÀÌÀüÁ¾¸ñ ½Ç½Ã°£ µî·Ï, ÇØÁ¦
	}catch(e){ 
	//alert("[ERROR] ntype.js: setImage() E = " + e); 
	}
}

String.prototype._padb = function(bsize, padc, isLPAD) {
    if ( bsize <= 0 ) return "";
    if ( ! padc ) padc = " ";
    var charCnt = 0;
    var byteCnt = 0;
    for ( var n = 0, len = this.length; n < len; n++ ) {
        var charCode = this.charCodeAt(n);
        charCnt++;
        byteCnt += charCode > 0x00ff ? 2:1;
        if ( byteCnt == bsize )
            return this.substring(0, charCnt);
        else if ( byteCnt > bsize )
            return this.substring(0, charCnt-1)+" ";
    }
    var padcs = "";
    for ( var n = bsize - byteCnt; n > 0; n-- )
        padcs += padc;
    return isLPAD ? padcs + this : this + padcs;
}

String.prototype.trim = function() {
    return this.replace(/(^\s*)|(\s*$)/g, "");
}

String.prototype.blength = function() {
    var blen = 0;
    for ( var n = 0, len = this.length; n < len; n++ )
        blen += this.charCodeAt(n) > 0x00ff ? 2 : 1;
    return blen;
}

String.prototype.substrb = function(bsidx, bsize) {
    if ( bsidx < 0 ) bsidx = 0;
    var bsidxc = 0;// ºñ±³´ë»ó
    var idx = 0;// char index
    var excess;
    while ( true ) {
        if        ( bsidxc  > bsidx ) {   excess = true;  break;
        } else if ( bsidxc == bsidx ) {   excess = false; break;
        }
        if ( idx >= this.length )  return "";
        bsidxc += this.charCodeAt(idx++) > 0x00ff ? 2:1;
    }
    var bsizec = excess ? 1 : 0 ;
    var sidx = idx;
    var remain = false;//
    var size=0;
    while ( true ) {
        if        ( bsizec  > bsize ) { remain = true;  break;
        } else if ( bsizec == bsize ) { break;
        }
        if ( idx >= this.length ) return excess ? " "+ this.substr(sidx) : this.substr(sidx);
        bsizec += this.charCodeAt(idx++) > 0x00ff ? 2:1;
        size++;
    }
    return  (  excess &&   remain) ? " "+ this.substr(sidx, size-1) +" " :
                    (  excess && ! remain) ? " "+ this.substr(sidx, size  )      :
                    (! excess &&   remain) ?      this.substr(sidx, size-1) +" " :
                                                                                this.substr(sidx, size  );
}

String.prototype.npad = function(size) {
    return this._padb(size, "0", 1);
}

String.prototype.rpad = function(size, padc) {
	return this._padb(size, padc, 0);
}

Math.roundf = function(val, precision) {
	var p = this.pow(10, precision);
	return (this.round( val * p) / p).toFixed(precision) ;
}

function addPoint( val , precision ){
    if( (typeof val) == 'number' ) return val.toFixed(precision);
    else if ( (typeof val) == 'string' ){
        try{
            return (Number(val)).toFixed(precision);
        }catch(e) { return (Number(0)).toFixed(precision); }
    }else return val;
}

function Sort( table , orderBy, columnIndex, cType, read_cnt)
{
    var current;
    var insert;
    bg1 = table.rows[0].bgColor;
    bg2 = table.rows[1].bgColor;
    for ( var n = 1 ; n < read_cnt ; n++ ){
        if ( cType == 'n' ){
            insert = tagToNumber(table.rows[n].cells[columnIndex].innerHTML);
        }else{
            insert = removeTag(table.rows[n].cells[columnIndex].innerHTML);
        }
        for( var m = 0 ; m <= n ; m ++ ){
            if ( cType == 'n' ){
                current = tagToNumber(table.rows[m].cells[columnIndex].innerHTML);
            }else{
                current = removeTag(table.rows[m].cells[columnIndex].innerHTML);
            }
            if ( ( (!orderBy && insert < current) || ( orderBy && insert > current) ) && (n != m) ){
    	        table.insertBefore(table.rows[n], table.rows[m]);
                m = n;
            }
        }
    }
    for ( var k = 0 ; k < read_cnt ; k++)
        table.rows[k].style.backgroundColor = (( k%2 == 1 ) ? bg1 : bg2) ;
}

function newWin( win ) {
	openPop2(win.url+"?code="+f1.code.value, '', win.width, win.height, 600, 400, 'no');
}

function search(){
    openPop2('/code/code.htm', 'jongmokWin', 313, 448, 0, 0, 'no' );
}

function ktscode(){
    openPop2('/code/data/ktscode.jsp', 'jongmokWin', 273, 335, 0, 0, 'no' );
}


function calendar(iObject){
    openPop2( '/util/calendar.htm?'+iObject, 'calWin', 201,203, event.clientX+window.screenLeft-65, event.clientY+window.screenTop+10,  'no' );
}

function openPop2(url, name, width, height, left, top, sbar, noOption) {
	if ( ! noOption ) {
		var pop = window.open(url, name, "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars="+ sbar  +",resizable=1,width="+ width +",height="+ height + ",left="+ left +",top="+ top);
	} else {
		var pop = window.open(url, name);
	}
	try { pop.focus(); } catch(e) {}
}

function openPop(url, name, width, height, noOption) {
	if ( ! noOption ) {
		var pop = window.open(url, name, "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=1,width="+ width +",height="+ height + ",left=400, top=250");
	} else {
		var pop = window.open(url, name);
	}
	try { pop.focus(); } catch(e) {}
}

function addInterest(){
	obj = new Object();
	obj.url="/stk/stk_sise/1000_30.jsp";
	obj.height=358;
	obj.width=263;
	newWin(obj);
}

function isCtrlKeyCode(keyCode) {
    //alert( keyCode );
    switch ( keyCode ) {
		case 8:// back space
		case 9:// alt + tab
		case 13:// enter
		case 16:// shift
		case 17:// ctrl
		case 18:// left alt
		case 19:// pause
		case 20:// tab
		case 21:// right alt
		case 25:// right ctrl
		case 27:// esc
		case 33:// page up
		case 34:// page down
		case 35:// end
		case 36:// home
		case 37:// ÁÂ
		case 38:// À§
		case 39:// ¿ì
		case 40:// ¾Æ·¡
		case 45:// insert
		case 46:// delete
		case 91:// left window key
		case 92:// right window key
		case 93:
		case 112:// f1
		case 113:
		case 114:
		case 115:
		case 116:
		case 117:
		case 118:
		case 119:
		case 120:
		case 121:
		case 122:
		case 123:// f12
		case 144:// num lock
		case 145:// scroll lock
		case 229:// ÇÑÀÚÅ°, ÇÑ±ÛÅ°
			return true;
		default:
			return false;
	}
}

function overTRForScroll1(tr) {
    if ( tr == null ) tr = this;
	overTR(this);
	overTR(tab2.rows[tr.rowIndex]);
}

function outTRForScroll1(tr) {
	if ( tr == null ) tr = this;
	outTR(this);
	outTR(tab2.rows[tr.rowIndex]);
}

function overTRForScroll2(tr) {
    if ( tr == null ) tr = this;
	overTR(this);
	overTR(tab1.rows[tr.rowIndex]);
}

function outTRForScroll2(tr) {
	if ( tr == null ) tr = this;
	outTR(this);
	outTR(tab1.rows[tr.rowIndex]);
}

function clickTRForScroll1(tr) {
	if ( tr == null ) tr = this;
	clickTROne(this);
	clickTROne(tab2.rows[tr.rowIndex]);
}

function clickTRForScroll2(tr) {
	if ( tr == null ) tr = this;
	clickTROne(this);
	clickTROne(tab1.rows[tr.rowIndex]);
}

function overTR(tr) {
	if ( tr == null ) tr = this;
	if ( tr.selected ) return;
	tr.style.backgroundColor = '#F4F2EA';
}
function outTR(tr) {
	if ( tr == null ) tr = this;
	if ( tr.selected )
		return;
	tr.style.backgroundColor = "";
}

function clickTROne(tr) {
	if ( tr == null ) tr = this;
	if ( tr.parentElement.selectedChild ) {
		var prev = tr.parentElement.selectedChild;
		prev.selected = false;
		prev.style.backgroundColor = "";
	}
	tr.selected = true;
	tr.style.backgroundColor = 'DFEBF3';
	//tr.style.backgroundColor = 'FFEBB4'; ½Å±ÔºÐ ÄÃ·¯º¯°æ 20080317 ±è¸¶¸®¾Æ
	tr.parentElement.selectedChild = tr;
}
function declickTR(tr) {
	if ( tr == null ) tr = this;
	tr.style.backgroundColor = "";
	tr.selected = false;
}

function setOverOutClick(tab, block_cnt, func) {

	for ( var r = 0, rlen = tab.rows.length; r < rlen; r++ ) {
		var row = tab.rows[r];

		declickTR(row);
		if ( r < block_cnt ) {
		    row.style.cursor = "hand";
			row.onclick = clickTROne;
			row.onmouseover = overTR;
			row.onmouseout = outTR;
			if (func) row.onmousedown = func;
		} else {
		    row.style.cursor = "";
			row.onclick = "";
			row.onmouseover = "";
			row.onmouseout = "";
			row.onmousedown = "";
		}
	}
}

function setOverOdd(tab, block_cnt, func) {

	for ( var r = 0, rlen = tab.rows.length; r < rlen; r+=2 ) {
		var row = tab.rows[r];

		declickTR(row);
		if ( r < block_cnt ) {
		    row.style.cursor = "hand";
			row.onclick = clickTROne;
			row.onmouseover = overTR;
			row.onmouseout = outTR;
			if (func) row.onmousedown = func;
		} else {
		    row.style.cursor = "";
			row.onclick = "";
			row.onmouseover = "";
			row.onmouseout = "";
			row.onmousedown = "";
		}
	}
}

function setOver(tab1, tab2, block_cnt, func1, func2, func3, func4) {
	for ( var r = 0, rlen = tab1.rows.length; r < rlen; r++ ) {
		var row1 = tab1.rows[r];
        var row2 = tab2.rows[r];
        declickTR(row1);
        declickTR(row2);
		if ( r < block_cnt ) {
		    row1.style.cursor = "hand";
			row1.onclick = func1;
			row1.onmouseover = overTRForScroll1;
			row1.onmouseout = outTRForScroll1;
            if (func3) row1.onmousedown = func3;

			row2.style.cursor = "hand";
			row2.onclick = func2;
			row2.onmouseover = overTRForScroll2;
			row2.onmouseout = outTRForScroll2;
			if (func4) row2.onmousedown = func4;

		} else {
		    row1.style.cursor = "";
			row1.onclick = "";
			row1.onmouseover = "";
			row1.onmouseout = "";
			row1.onmousedown = "";
			row2.style.cursor = "";
			row2.onclick = "";
			row2.onmouseover = "";
			row2.onmouseout = "";
			row2.onmousedown = "";
		}
	}
}

function allblur() {
  var lnks = document.links;
  for (i = 0; i < lnks.length; i++)
    lnks[i].onfocus = lnks[i].blur;
}

function openwindow(theURL,winName,features) {
	window.open(theURL,winName,features);
}

function LayerSH(LayerName,Status)
{
	LayerN = document.all[LayerName].style;
	if (Status == 'show') LayerN.display = '';
	if (Status == 'hide') LayerN.display = 'none';
}

function enableBtn(btn, b) {
	if ( b ) {
		btn.style.display = "";
		btn.nextSibling.style.display = "none";
	} else {
		btn.style.display = "none";
		btn.nextSibling.style.display = "";
	}
}

var changedImg;

function EImgChg(flag)
{
	source=event.srcElement;
	if (source.name == "")
	{ return false;  }

	if(changedImg == source.name)
	return;

	else if (document.images && source.tagName=="IMG") {
		imgElement = source.name;  // ÀÌ¹ÌÁö name
		imgPath = source.src;   // ÀÌ¹ÌÁö src ¼Ó¼º°ª

		imgPathLen = imgPath.length;
		imgPathFlag = imgPath.lastIndexOf("/");
		imgName = imgPath.substring(0,imgPathFlag+1);

		document.images[imgElement].src =  imgName + imgElement + "_" + flag + ".gif";

	}
}

function datos_onscroll01() {
    if (datos.scrollLeft != text2.value) {
        text2.value = datos.scrollLeft;
        if(tituloscolumnas) tituloscolumnas.scrollLeft = datos.scrollLeft;
        return;
    }

    if (datos.scrollHeight != text2.value) {
        text2.value = datos.scrollTop;
        if(tituloscolumnas) tituloscolumnas.scrollTop = datos.scrollTop;
        return;
    }
}

function datos_onscroll02() {
    if (datos.scrollLeft != text1.value) {
        text1.value = datos.scrollLeft;
        if(tituloscolumnas) tituloscolumnas.scrollLeft = datos.scrollLeft;
        return;
    }
    if (datos.scrollHeight != text2.value) {
        text2.value = datos.scrollTop;
        if(titulosfilas) titulosfilas.scrollTop = datos.scrollTop;
        return;
    }
}

function tabSetting(objId,mode) {
    var nowtabImg = document.getElementById(objId+"Img");
    if (nowtabImg) nowtabImg.src = "/stk/img/tab_" + objId + "_" + mode + ".gif";
}

function tabOnOff(thisId,mode) {
    if ( prevId != thisId ) tabSetting(thisId,mode);
}

function tabClick(thisId) {
    if ( prevId != thisId ) tabSetting(prevId,'off');
    prevId = thisId;
}

function firstSetting() {
    var queryValue =  window.location.search.split("&")[0].split("=")[1];
    if (document.getElementById(queryValue)) prevId = queryValue;
    tabSetting(prevId,'on');
}

function fieldReset() {
try{
if ( f1 ){
    if ( table1 ) table1.setHTML ( 'errorMsg' , '<img src=/stk/img/ico_msg.gif align=absmiddle class=bu04><b>¸Þ¼¼Áö</b> :');
    if ( f1.oOrderNo ) f1.oOrderNo.value = '';
    if ( f1.su ) f1.su.value = '';
    if ( f1.dan ) f1.dan.value = '';
    if ( f1.OrderNo ) f1.OrderNo.value = '';
    if ( f1.canTotal) canTotal.value = '';
    if ( f1.canCredit) canCredit.value = '';
    if ( f1.code) f1.code.focus();
}
}catch(e){}
}


function open_group(form){

   with(form){
        if (!pwd.value ) {
	    	alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä!");  pwd.focus();
		    return;
	    }	    
	
        var groupwin;
        parent.EncLink('/stk/stk_order/getCharge.jsp','acctno=' + acctno[acctno.selectedIndex].value + 
            '&goods=' + gbn[gbn.selectedIndex].value + '&pwd=' + pwd.value +
            '&code=' + code.value,'groupwin',
            'toolbar=no,location=no,directory=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=260,height=10');    

    }        
}

