document.domain = "kbstar.com";

// addLoadEvent
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}

// ÀÌº¥Æ® Ãß°¡/»èÁ¦
function addEvent( obj, type, fn ) {
  if ( obj.attachEvent ) {
    obj['e'+type+fn] = fn;
    obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
    obj.attachEvent( 'on'+type, obj[type+fn] );
  } else
    obj.addEventListener( type, fn, false );
}
function removeEvent( obj, type, fn ) {
  if ( obj.detachEvent ) {
    obj.detachEvent( 'on'+type, obj[type+fn] );
    obj[type+fn] = null;
  } else
    obj.removeEventListener( type, fn, false );
}

// Top Search Input
function schInput(obj,chknum) {
    if (chknum == 1) {
        obj.className = 'imgin-none';
    }
    else {
        if (obj.value == '') {
            obj.className = 'imgin';
            obj.value = '';
        }
    }
}
// hasClass
function hasClass(element,value) {
	if (!element.className) return false;
	var re = new RegExp("(^|\\s)" + value + "(\\s|$)");
	return re.test(element.className);
}

// getElementsByClass
function getElementsByClass(search_class,node,tag) {
	var class_elements = new Array();
	if (node == null) {
		node = document;
	}
	if (tag == null) {
		tag = "*";
	}
	var els = node.getElementsByTagName(tag);
	for (var i=0, j=0; i<els.length; i++) {
		if (hasClass(els[i],search_class)) {
			class_elements[j] = els[i];
			j++;
		}
	}
	return class_elements;
}

// addClass
function addClass(element,value) {
	if (!element.className) {
		element.className = value;
	} else {
		var new_class_name = element.className;
		if (!hasClass(element,value)) {
			element.className += " " + value;
		}
	}
}

// removeClass
function removeClass(element,value) {
	if (element.className && hasClass(element,value)) {
		var re = new RegExp("(^|\\s)" + value + "(\\s|$)");
		element.className = element.className.replace(re,"");
	}
}

// toggleClass
function toggleClass(element,value1,value2) {
	if (hasClass(element,value1)) {
		if (value2) {
			addClass(element,value2);
		}
		removeClass(element,value1);
	} else {
		if (value2 && hasClass(element,value2)) {
			removeClass(element,value2);
		}
		addClass(element,value1);
	}
}

// get children
function getChildrenByTagName(parent,tag_name) {
	var all_children = parent.childNodes;
	var new_children = new Array();
	for (var i=0, j=0; i<all_children.length; i++) {
		if (all_children[i].tagName && (all_children[i].tagName.toLowerCase() == tag_name.toLowerCase())) {
			new_children[j] = all_children[i];
			j++;
		}
	}
	return new_children;
}
function getChildrenByClassName(parent,class_name) {
	var all_children = parent.childNodes;
	var new_children = new Array();
	for (var i=0, j=0; i<all_children.length; i++) {
		if (hasClass(all_children[i],class_name)) {
			new_children[j] = all_children[i];
			j++;
		}
	}
	return new_children;
}


// Check IE
function isIE() {
	var version = navigator.appVersion;
	if (version.indexOf("MSIE") != -1) {
		return true;
	} else {
		return false;
	}
}
function isIE6() {
	var version = navigator.appVersion;
	if (version.indexOf("MSIE 6") != -1) {
		return true;
	} else {
		return false;
	}
}

// insertAfter
function insertAfter(new_element,target_element) {
	var parent = target_element.parentNode;
	if (parent.lastChild == target_element) {
		parent.appendChild(new_element);
	} else {
		parent.insertBefore(new_element,target_element.nextSibling);
	}
}

// getStyle
function getStyle(el,css_prop){
	var strValue;
	if (document.defaultView && document.defaultView.getComputedStyle) {
		strValue = document.defaultView.getComputedStyle(el,null).getPropertyValue(css_prop);
	} else if (el.currentStyle) {
		css_prop = css_prop.replace(/\-(\w)/g, function (strMatch, p1){
			return p1.toUpperCase();
		});
		strValue = el.currentStyle[css_prop];
	}
	return strValue;
}

// image rollover
function overImg(obj, elementID) {
	if(elementID){
		if(document.getElementById(elementID)){
			var obj = document.getElementById(elementID);
			obj.src = obj.src.replace( 'off.gif', 'on.gif' );
		}
	}else{
		obj.src = obj.src.replace( 'off.gif', 'on.gif' );
	}
}
function outImg(obj, elementID) {
	if(elementID){
		if(document.getElementById(elementID)){
			var obj = document.getElementById(elementID);
			obj.src = obj.src.replace( 'on.gif', 'off.gif' );
		}
	}else{
		obj.src = obj.src.replace( 'on.gif', 'off.gif' );
	}
}

// on/off ÀÌ¹ÌÁö ±³Ã¼
function imageChg(obj) {
	if(obj.src.indexOf('off.gif') != -1) obj.src = obj.src.replace('off.gif', 'on.gif');
	else if(obj.src.indexOf('on.gif') != -1) obj.src = obj.src.replace('on.gif', 'off.gif');
}
// Content Display
function contView(obj) {
	var target = document.getElementById(obj);
	target.style.display = (target.style.display=='none' ? 'block':'none');
}

function contView1(obj) {
	var target = document.getElementById(obj);
	target.style.display = (target.style.display=='none' ? 'block':'none');
}
function contView2(obj) {
	if(typeof contView2.prevObj=="object"){
		contView2.prevObj.style.display = "none";
	}
	var target = document.getElementById(obj);
	target.style.display = 'block';
	contView2.prevObj = target;
}
function contView2c(obj) { // contView2 ·¹ÀÌ¾î´Ý±â
	var target2 = document.getElementById(obj);
	target2.style.display = 'none';
}
//tabChange - ÀÌ¹ÌÁö ÆÄÀÏÀ» Á÷Á¢ º¯°æÇÏ¿© ÅÇ º¯°æÇÒ °æ¿ì (eg. ¸ÞÀÎÅÇ)
function tabChange(el,more) {
	if (!document.getElementsByTagName || !document.getElementById) return false;
	var prefix = el.getAttribute("href",2).replace("#","").split("-")[0]+"-";
	var tablist = el;
	while (tablist.tagName != "UL") {
		tablist = tablist.parentNode;
	}
	var tabitems = tablist.getElementsByTagName("li");
	var clickedtab = el;
	while (clickedtab.tagName != "LI") {
		clickedtab = clickedtab.parentNode;
	}
	var tabparent = tablist.parentNode;
	var morebutton = getElementsByClass("more",tabparent)[0];
	for (var i=0; i<tabitems.length; i++) {
		var tabcont = document.getElementById(prefix+(i+1));
		var tabimg = tabitems[i].getElementsByTagName("img")[0];
		if ((tabitems[i] == clickedtab) && (tabimg.src.indexOf("_off.gif") != -1)) {
			tabimg.src = tabimg.src.replace("_off.gif","_on.gif");
			tabcont.style.display = "block";
			if (more && morebutton) {
				morebutton.setAttribute("href",more);
				morebutton.style.display = "block";
			} else if(!more && morebutton && morebutton.style.display == "block") {
				morebutton.setAttribute("href","#");
				morebutton.style.display = "none";
			}
		} else if (tabitems[i] != clickedtab) {
			if (tabimg.src.indexOf("_on.gif") != -1) {
				tabimg.src = tabimg.src.replace("_on.gif","_off.gif");
			}
			tabcont.style.display = "none";
		}
	}
	return false;
}

// chgHeadingTab ÇØµù ÅÇ
function chgHeadingTab(el) {
	if (!document.getElementsByTagName) return false;
	var tabtag = el;
	var headings = new RegExp("[h1-6]","i");
	while (!headings.test(tabtag.tagName)) {
		tabtag = tabtag.parentNode;
	}
	if (!headings.test(tabtag.tagName)) return false;
	var tabparent = tabtag.parentNode;
	tabtag = tabtag.tagName;
	var clickedtab = el;
	while (clickedtab.tagName != tabtag) {
		clickedtab = clickedtab.parentNode;
	}
	var tabitems = tabparent.getElementsByTagName(tabtag);
	for (var i=0; i<tabitems.length; i++) {
		var tabimg = tabitems[i].getElementsByTagName("IMG")[0];
		var tabcont = tabitems[i].nextSibling;
		while (tabcont.nodeType != 1) {
			tabcont = tabcont.nextSibling;
		}
		if ((tabitems[i] == clickedtab) && (tabimg.src.indexOf("_off.gif") != -1)) {
			tabimg.src = tabimg.src.replace("_off.gif","_on.gif");
			tabcont.style.display = "block";
		} else if (tabitems[i] != clickedtab) {
			if (tabimg.src.indexOf("_on.gif") != -1) {
				tabimg.src = tabimg.src.replace("_on.gif","_off.gif");
			}
			tabcont.style.display = "none";
		}
	}
	return false;
}

//chgTab - .on Å¬·¡½º »ç¿ëÇØ¼­ ÅÇ ÀÌ¹ÌÁö ¹× ÄÁÅÄÃ÷ º¯°æ ½Ã
function getConts(el,wrapper_class,cont_class) {
	var wrapper = el;
	while (!hasClass(wrapper,wrapper_class)) {
		wrapper = wrapper.parentNode;
	}
	var children = wrapper.childNodes;
	var tabconts = new Array();
	for (var i=0, j=0; i<children.length; i++) {
		if (children[i].className && hasClass(children[i],cont_class)) {
			tabconts[j] = children[i];
			j++;
		}
	}
	return tabconts;
}

function chgTab(el) {
	if (!document.getElementsByTagName) return false;
	var tabconts = getConts(el,"tab-wrap","tab-cont");
	var tablist = el;
	while ((tablist.tagName != "OL") && (tablist.tagName !="UL")) {
		tablist = tablist.parentNode;
	}
	var ontag = getElementsByClass("on",tablist)[0].tagName;
	var clicked = el;
	while (clicked.tagName != ontag) {
		clicked = clicked.parentNode;
	}
	var tabitems = tablist.getElementsByTagName(ontag);
	for (var i=0; i<tabitems.length; i++) {
		if ((tabitems[i] == clicked) && !hasClass(clicked,"on")) {
			addClass(tabitems[i],"on");
			addClass(tabconts[i],"on");
		} else if (tabitems[i] != clicked) {
			removeClass(tabitems[i],"on");
			removeClass(tabconts[i],"on");
		}
	}
	return false;
}

// ÀÌÀüÅÇ/ÀÌÈÄÅÇ
function prevTabs(el) {
	var tab = el;
	while (!hasClass(tab,"scroll-tab")) {
		tab = tab.parentNode;
	}
	tab = tab.getElementsByTagName("ul")[0];
	var tab_list_height = tab.offsetHeight;
	var tab_height = tab.getElementsByTagName("li")[0].offsetHeight;
	var tab_top = parseInt(getStyle(tab,"top").replace("px",""));
	if (tab_top == 0) {
		tab.style.top = -(tab_list_height - tab_height) + "px";
	} else {
		tab.style.top = (tab_top + tab_height) + "px";
	}
	return false;
}

function nextTabs(el) {
	var tab = el;
	while (!hasClass(tab,"scroll-tab")) {
		tab = tab.parentNode;
	}
	tab = tab.getElementsByTagName("ul")[0];
	var tab_list_height = tab.offsetHeight;
	var tab_height = tab.getElementsByTagName("li")[0].offsetHeight;
	var tab_top = parseInt(getStyle(tab,"top").replace("px",""));
	if (tab_top == -(tab_list_height - tab_height)) {
		tab.style.top = 0 + "px";
	} else {
		tab.style.top = (tab_top - tab_height) + "px";
	}
	return false;
}

// ÅÇÅ¬·¡½º º¯°æ
function chgTabClass(el, newClass) {
	var tablist = el;
	while (tablist.tagName != "UL") {
		tablist = tablist.parentNode;
	}
	tablist.className = newClass;
}

// chgCont : Å¬¸¯ ½Ã ÄÁÅÄÃ÷ º¯°æ
function chgCont(el) {
	if (!document.getElementById) return false;
	var t_id = el.getAttribute("href",2).replace("#","");
	var target = document.getElementById(t_id);
	var conts = getConts(target,"tab-wrap","tab-cont");
	for (var i=0; i<conts.length; i++) {
		/*var c_id = conts[i].getAttribute("id");
		if (c_id == t_id && !hasClass(conts[i],"on")) {
			addClass(conts[i],"on");
		} else if (c_id != t_id) {
			removeClass(conts[i],"on");
		}*/
		removeClass(conts[i],"on");
	}
	addClass(target,"on");
	return false;
}

// checkbox Å¬¸¯½Ã tr class º¯°æ
function chk_selected(f){
	var _tr = f;
	while(_tr.tagName.toLowerCase() != "tr"){
		_tr = _tr.parentNode;
	}

	if(f.checked){
		_tr.className += " checked";
	}else{
		_tr.className = _tr.className.replace("checked","");
	}
	return false;
}

// show
function show(el) {
	el = (typeof el == "string") ? document.getElementById(el) : el;
	el.style.display = "block";
}

// hide
function hide(el) {
	el = (typeof el == "string") ? document.getElementById(el) : el;
	el.style.display = "none";
}

// toggle
function toggle(_id) {
	var el = document.getElementById(_id);
	el.style.display = (!el.style || (el.style.display != 'none')) ? 'none' : '';
	if (isIE6() && hasClass(el,"secret-memo")) toggleMemo(el);
}
function togObj(obj) {
	obj.style.display = (obj.style.display != 'none') ? 'none' : '';
}
function togObjYn(obj,dp) {
	obj.style.display = (dp != true) ? 'none' : '';
}
// ºñ¹Ð¸Þ¸ð Åä±Û
function toggleMemo(el) {
	if (!hasClass(el,"generated")) {
		addClass(el,"generated");
		var _iframe = document.createElement("iframe");
		var _div = document.createElement("div");
		_iframe.frameBorder = 0;
		addClass(_iframe,"fix-ie6");
		addClass(_div,"screen");

		var fix_ie6 = el.insertBefore(_iframe,el.firstChild);
		var screen = el.insertBefore(_div,el.firstChild);

		var memo_width = el.offsetWidth;
		var memo_height = el.offsetHeight;

		fix_ie6.style.width = memo_width + "px";
		fix_ie6.style.height = memo_height + "px";
		screen.style.width = (memo_width - 2) + "px";
		screen.style.height = (memo_height - 2) + "px";
	}
}

// alt ÅØ½ºÆ® ±³Ã¼
function chgAlt(obj,src,dst) {
	var objAlt = obj.getAttribute('alt');
	if ( objAlt == src ) {
		obj.setAttribute('alt',dst);
	} else if ( objAlt == dst ) {
		obj.setAttribute('alt',src);
	}
}

function togCal(cal) {
	if (typeof cal == "string") {
		cal = document.getElementById(cal);
	}
	var ie6 = isIE6();
	var frame = cal.getElementsByTagName("iframe")[0];

	if (!frame && ie6) {
		frame = document.createElement("iframe");
		frame.className = "cal";
	}
	if (cal.style.display != "inline") {
		cal.style.display = "inline";
		if (ie6) {
			cal.insertBefore(frame,cal.firstChild);
		}
	} else {
		cal.style.display = "";
		if (ie6) {
			cal.removeChild(frame);
			cal = null;
		}
	}
}
function contView(el) {
	if (typeof el == "string") {
		el = document.getElementById(el);
	}
	var ie6 = isIE6();
	var frame = el.getElementsByTagName("iframe")[0];

	if (!frame && ie6) {
		frame = document.createElement("iframe");
		frame.className = "fav-acct";
	}
	if (el.style.display != "block") {
		el.style.display = "block";
		if (ie6) {
			el.insertBefore(frame,el.firstChild);
		}
	} else {
		el.style.display = "none";
		if (ie6) {
			el.removeChild(frame);
			el = null;
		}
	}
}
// Faq
function viewContent(lid,num,obj) {
	if(!obj){
		obj = 'faq'
	}
	var faqList = document.getElementById(obj);
	var faqItems = faqList.childNodes;
	var faqConts = new Array();
	for (var i=0, j=0; i<faqItems.length; i++) {
		if (faqItems[i].tagName == "LI") {
			faqConts[j] = faqItems[i];
			j++
		}
	}
	for (i=1; i<=faqConts.length ; i++) {
		document.getElementById(lid+i).style.display = (i==num) ? 'block' : 'none';
	}
}

// Step
function stepOn(step) {
	step.className = step.className.replace('off','on');
}
function stepOff(step) {
	step.className = step.className.replace('on','off');
}

// °èÁÂÁ¶È¸ Åä±Û
function togTrd(trdnum) {
	var trdobj = document.getElementById('trd' + trdnum);
	var trdtit = getElementsByClass('trd-st', trdobj, 'h5')[0];
	var trdblk = getElementsByClass('trd-block', trdobj, 'div')[0];
	var togbtn = trdtit.getElementsByTagName('img')[0];

	imageChg(togbtn);
	chgAlt(togbtn,'¿­±â','´Ý±â');
	togObj(trdblk);
}

//¿øÇÏ´Â ºÎºÐ¸¸ ÇÁ¸°Æ®ÇÏ±â
function printArea(el) {
	if (el) {
		if (!document.getElementById) return false;
		var original = document.body.innerHTML;
		var cont = document.getElementById(el);
		window.onbeforeprint = function() {
			document.body.innerHTML = cont.innerHTML;
		}
		window.onafterprint = function() {
			document.body.innerHTML = original;
		}
	}
	window.print();
}
//getFlash
function getFlash(swfName,wt,ht,id,t){
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+wt+'" height="'+ht+'" id="'+id+'">');
    document.write('<param name="movie" value="'+swfName+'">');
    document.write('<param name="quality" value="high">');
    if (t != 0)    {
        document.write('<param name="wmode" value="transparent">');
    }
    document.write('<param name="allowScriptAccess" value="always">');
    document.write('<embed src="'+swfName+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" width="'+wt+'" height="'+ht+'" allowScriptAccess="sameDomain" id="'+id+'"></embed></object>');
}

// Flash ´ëÃ¼ÅØ½ºÆ®¿ë
function getFlash2(swfName,wt,ht,id,t,title){
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+wt+'" height="'+ht+'" id="'+id+'" title="'+title+'">');
    document.write('<param name="movie" value="'+swfName+'">');
    document.write('<param name="quality" value="high">');
    if (t != 0)    {
        document.write('<param name="wmode" value="transparent">');
    }
    document.write('<param name="allowScriptAccess" value="always">');
    document.write('<embed src="'+swfName+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" width="'+wt+'" height="'+ht+'" allowScriptAccess="sameDomain" id="'+id+'"></embed></object>');
}

//getFlashXML
function getFlashXML(pSwfUrl,pXmlUrl,wt,ht,trans) {
    var xmlUrl = escape(pXmlUrl);
    document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='"+wt+"' height='"+ht+"' id='' align='middle'>");
    document.write("<param name='allowScriptAccess' value='always' />");
    document.write("<param name='movie' value='"+pSwfUrl+"' />");
    document.write("<param name='quality' value='high' />");
    if (trans == 1) {document.write("<param name='wmode' value='transparent' />");}
    document.write("<param name='FlashVars' value='xml_url="+xmlUrl+"' />");
    document.write("<param name='bgcolor' value='#FFFFFF' />");
    document.write("<embed src='"+pSwfUrl+"' FlashVars='xml_url="+xmlUrl+"' quality='high' wmode='transparent' bgcolor='#FFFFFF' width='"+wt+"' height='"+ht+"' name='' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
    document.write("</object>");
}

//Gnb, Lnb
function flashNavigation(pSwfUrl, pXmlUrl, pCode, wt, ht, fmode, crtPageNm){
    var xmlUrl = escape(pXmlUrl);
    var pathArr = pSwfUrl.split("/");
    var flashID = pathArr[pathArr.length-1].split(".")[0];

    document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='"+wt+"' height='"+ht+"' id='"+flashID+"' align='middle'>");
    document.write("<param name='allowScriptAccess' value='always' />");
    document.write("<param name='movie' value='"+pSwfUrl+"' />");
    document.write("<param name='quality' value='high' />");
    document.write("<param name='FlashVars' value='xml_url="+xmlUrl+"&code="+pCode+"&crtPageNm="+crtPageNm+"' />");
    document.write("<param name='wmode' value='"+fmode+"' />");
    document.write("<param name='bgcolor' value='#FFFFFF' />");
    document.write("<embed src='"+pSwfUrl+"' FlashVars='xml_url="+xmlUrl+"&code="+pCode+"&crtPageNm="+crtPageNm+"' wmode='"+fmode+"' quality='high' width='"+wt+"' height='"+ht+"' name='lnb' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
    document.write("</object>");
}

function flashNavigation_new(pSwfUrl, pCode, wt, ht, fmode, crtPageNm, cha){
    var pathArr = pSwfUrl.split("/");
    var flashID = pathArr[pathArr.length-1].split(".")[0];

    document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='"+wt+"' height='"+ht+"' id='"+flashID+"' align='middle'>");
    document.write("<param name='allowScriptAccess' value='always' />");
    document.write("<param name='movie' value='"+pSwfUrl+"' />");
    document.write("<param name='quality' value='high' />");
    document.write("<param name='FlashVars' value='code="+pCode+"&crtPageNm="+crtPageNm+"&cha="+cha+"' />");
    document.write("<param name='wmode' value='"+fmode+"' />");
    document.write("<param name='bgcolor' value='#FFFFFF' />");
    document.write("<embed src='"+pSwfUrl+"' FlashVars='code="+pCode+"&crtPageNm="+crtPageNm+"&cha="+cha+"' wmode='"+fmode+"' quality='high' width='"+wt+"' height='"+ht+"' name='nlnb' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
    document.write("</object>");
}

function userPdName(pSwfUrl,pName,wt,ht,trans) {
    document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='"+wt+"' height='"+ht+"' id='' align='middle'>");
    document.write("<param name='allowScriptAccess' value='always' />");
    document.write("<param name='movie' value='"+pSwfUrl+"' />");
    document.write("<param name='quality' value='high' />");
    if (trans == 1) {document.write("<param name='wmode' value='transparent' />");}
    document.write("<param name='FlashVars' value='name="+pName+"' />");
    document.write("<param name='bgcolor' value='#FFFFFF' />");
    document.write("<embed src='"+pSwfUrl+"' FlashVars='name="+pName+"' quality='high' wmode='transparent' bgcolor='#FFFFFF' width='"+wt+"' height='"+ht+"' name='' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
    document.write("</object>");
}

function flashLogin(pSwfUrl, page_url, wt, ht, fmode, login_url) {
    var xmlUrl = escape(page_url);
	var pathArr = pSwfUrl.split("/");
	var flashID = pathArr[pathArr.length-1].split(".")[0];

	document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='"+wt+"' height='"+ht+"' id='"+flashID+"' align='middle'>");
	document.write("<param name='allowScriptAccess' value='always' />");
	document.write("<param name='movie' value='"+pSwfUrl+"' />");
	document.write("<param name='quality' value='high' />");
	document.write("<param name='wmode' value='"+fmode+"' />");
	document.write("<param name='FlashVars' value='page_url="+page_url+"&login_url="+login_url+"' />");
	document.write("<param name='bgcolor' value='#FFFFFF' />");
	document.write("<embed src='"+pSwfUrl+"' FlashVars='page_url="+page_url+"&login_url="+login_url+"' quality='high' wmode='transparent' width='"+wt+"' height='"+ht+"' name='loginButton' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
	document.write("</object>");
}

function flashMyKB(pSwfUrl, pXmlUrl, wt, ht, fmode, mLogin){														//MyKB Bar Flash¸¦ ºÒ·¯¿À±âÀ§ÇÑ ÇÔ¼öÀÔ´Ï´Ù.
    var xmlUrl = escape(pXmlUrl);																			//pXmlUrl¿¡ ¹Þ¾Æ¿Â URL°ª¿¡ °ø¹éÀÌ ÀÖÀ»°æ¿ì escape¹®ÀÚ Ã³¸®ÇÕ´Ï´Ù.
	var pathArr = pSwfUrl.split("/");																		//¹Þ¾Æ¿Â URL¿¡¼­ '/'Ç¥½Ã·Î ³ª´²¼­ ¹è¿­ÇÕ´Ï´Ù.
	var flashID = pathArr[pathArr.length-1].split(".")[0];													//pathArr¹è¿­¿¡¼­ ¸¶Áö¸· Ç×¸ñ°ªÀ» '.'À¸·Î ºÐ±âÇÏ¿© ³ÖÀº ¹è¿­Áß Ã¹¹øÂ°¹è¿­Ç×¸ñÀ» flashID¿¡ ³Ö½À´Ï´Ù.*ÁÖ·Î ÆÄÀÏ¸íÀÌ µË´Ï´Ù
																											//ÇÃ·¡½Ã ¿ÀºêÁ§Æ® ÅÂ±×Ç×º¹À» ÆäÀÌÁö¿¡ ¾¹´Ï´Ù.
	document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='"+wt+"' height='"+ht+"' id='"+flashID+"' align='middle'>");
	document.write("<param name='allowScriptAccess' value='always' />");
	document.write("<param name='movie' value='"+pSwfUrl+"' />");
	document.write("<param name='quality' value='high' />");
	document.write("<param name='wmode' value='"+fmode+"' />");
	document.write("<param name='FlashVars' value='mkb_List="+xmlUrl+"&login="+mLogin+"' />");
	document.write("<param name='bgcolor' value='#FFFFFF' />");
	document.write("<embed src='"+pSwfUrl+"' FlashVars='mkb_List="+xmlUrl+"&login="+mLogin+"' quality='high' width='"+wt+"' height='"+ht+"' name='minibar' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
	document.write("</object>");

}

function flashMykbset(pXmlUrl, pSendUrl, pSwfUrl) {
    var xmlUrl = escape(pXmlUrl);
    var sendUrl = escape(pSendUrl);
    document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='245' height='320' id='mykbSet' align='middle'>");
    document.write("<param name='allowScriptAccess' value='always' />");
    document.write("<param name='movie' value='"+pSwfUrl+"' />");
    document.write("<param name='quality' value='high' />");
    document.write("<param name='FlashVars' value='xml_url="+xmlUrl+"&send_url="+sendUrl+"' />");
    document.write("<param name='wmode' value='transparent' />");
    document.write("<param name='bgcolor' value='#FFFFFF' />");
    document.write("<embed src='"+pSwfUrl+"' FlashVars='xml_url="+xmlUrl+"&sendUrl="+sendUrl+"' quality='high' bgcolor='#FFFFFF' width='245' height='320' wmode='transparent' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
    document.write("</object>");
}

function flashMyMenu(mListXmlUrl, mXmlAddUrl, mSendUrl,mSendAddUrl, mLogin, mLoginUrl, mSwfUrl,mSetting) {
	var listXmlUrl = escape(mListXmlUrl);
	var xmlAddUrl = escape(mXmlAddUrl);
	var sendUrl = escape(mSendUrl);
	var sendAddUrl = escape(mSendAddUrl);
	var loginUrl = escape(mLoginUrl);
	var setting = escape(mSetting);
	document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='258' height='238' id='myMenu' align='middle'>");
	document.write("<param name='allowScriptAccess' value='always' />");
	document.write("<param name='movie' value='"+mSwfUrl+"' />");
	document.write("<param name='quality' value='high' />");
	document.write("<param name='FlashVars' value='list_xml_url="+listXmlUrl+"&xml_add_url="+xmlAddUrl+"&send_url="+sendUrl+"&send_add_url="+sendAddUrl+"&login="+mLogin+"&login_url="+loginUrl+"&setting="+setting+"' />");
	document.write("<param name='wmode' value='transparent' />");
	document.write("<param name='bgcolor' value='#FFFFFF' />");
	document.write("<embed src='"+mSwfUrl+"' FlashVars='list_xml_url="+listXmlUrl+"&xml_add_url="+xmlAddUrl+"&send_url="+sendUrl+"&send_add_url="+sendAddUrl+"&login="+mLogin+"&login_url="+loginUrl+"&setting="+setting+"' quality='high' bgcolor='#FFFFFF' width='258' height='238' wmode='transparent' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
	document.write("</object>");
}
/*
function flashMainPrd(loginState, custType, custName, pSwfUrl, pXmlUrl){
    var pathArr = pSwfUrl.split("/");
    var flashID = pathArr[pathArr.length-1].split(".")[0];
    var xmlUrl = escape(pXmlUrl);

    document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='900' height='332' id='"+flashID+"' align='middle'>");
    document.write("<param name='allowScriptAccess' value='always' />");
    document.write("<param name='movie' value='"+pSwfUrl+"' />");
    document.write("<param name='quality' value='high' />");
    document.write("<param name='wmode' value='transparent' />");
    document.write("<param name='FlashVars' value='xml_url="+xmlUrl+"&login="+loginState+"&custom_type="+custType+"&custom_name="+custName+"' />");
    document.write("<param name='bgcolor' value='#FFFFFF' />");
    document.write("<embed src='"+pSwfUrl+"' FlashVars='xml_url="+xmlUrl+"&login="+loginState+"&custom_type="+custType+"&custom_name="+custName+"' quality='high' bgcolor='#FFFFFF' width='900' height='332' name='mainPrd' wmode='transparent' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
    document.write("</object>");
}
*/

function flashMainPrd(loginState, custType, custName, pSwfUrl, pXmlUrl, getDate){
    var pathArr = pSwfUrl.split("/");
    var flashID = pathArr[pathArr.length-1].split(".")[0];
    var xmlUrl = escape(pXmlUrl);

    document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='900' height='332' id='"+flashID+"' align='middle'>");
    document.write("<param name='allowScriptAccess' value='always' />");
    document.write("<param name='movie' value='"+pSwfUrl+"' />");
    document.write("<param name='quality' value='high' />");
    document.write("<param name='wmode' value='transparent' />");
    document.write("<param name='FlashVars' value='xml_url="+xmlUrl+"&login="+loginState+"&custom_type="+custType+"&custom_name="+custName+"&get_date="+getDate+"' />");
    document.write("<param name='bgcolor' value='#FFFFFF' />");
    document.write("<embed src='"+pSwfUrl+"' FlashVars='xml_url="+xmlUrl+"&login="+loginState+"&custom_type="+custType+"&custom_name="+custName+"&get_date="+getDate+"' quality='high' bgcolor='#FFFFFF' width='900' height='332' name='mainPrd' wmode='transparent' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
    document.write("</object>");
}

function flashMainPrd_1(loginState, custType, custName, pSwfUrl, pXmlUrl, getDate, pSwfFolderUrl){
    var pathArr = pSwfUrl.split("/");
    var flashID = pathArr[pathArr.length-1].split(".")[0];
    var xmlUrl = escape(pXmlUrl);

    document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='900' height='290' id='"+flashID+"' align='middle'>");
    document.write("<param name='allowScriptAccess' value='always' />");
    document.write("<param name='movie' value='"+pSwfUrl+"' />");
    document.write("<param name='quality' value='high' />");
    document.write("<param name='wmode' value='transparent' />");
    document.write("<param name='FlashVars' value='xml_url="+xmlUrl+"&login="+loginState+"&custom_type="+custType+"&custom_name="+custName+"&get_date="+getDate+"&swfUrl="+pSwfFolderUrl+"' />");
    document.write("<param name='bgcolor' value='#FFFFFF' />");
    document.write("<embed src='"+pSwfUrl+"' FlashVars='xml_url="+xmlUrl+"&login="+loginState+"&custom_type="+custType+"&custom_name="+custName+"&get_date="+getDate+"&swfUrl="+pSwfFolderUrl+"' quality='high' bgcolor='#FFFFFF' width='900' height='290' name='mainPrd' wmode='transparent' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
    document.write("</object>");
}



function  LPGNB_Location(url) {
    document.location.href = url;
}

/* ---- Box Click & Open/Close Content ---- */
function boxOpen(obj, objCon, n) {
    var cList = document.getElementsByTagName("h4");
    var count = 0;
    for (i=0; i<cList.length ; i++)    {
        if(cList[i].className.indexOf("num") != -1) count++;
    }
    for (j=1; j<=count; j++)    {
        var cName = document.getElementById(obj+j);
        var cCon = document.getElementById(objCon+j);
        if ((n == j) && (cCon.style.display=='none')) {
            cCon.style.display = '';
            cName.className= cName.className.replace("off","on");
        } else  {
            cCon.style.display = 'none';
            cName.className= cName.className.replace("on","off");
        }
    }
}


function imgRegist_target(who){
	var root = who.parentNode.parentNode; // µ¤°íÀÖ´Â tr
	var source = root.getElementsByTagName("UL")[0];
	var source_li = source.getElementsByTagName("LI");
	this.source = source;
	this.source_li = source_li;
}
function imgRegist_add(my){
	var target = new imgRegist_target(my);
	/* li »ý¼º */
	var dom_li = document.createElement("LI");
	dom_li.innerHTML = '<input type="text" style="width:85%" /> <a href="#"><img src="http://img1.kbstar.com/btn/sbtn_registration.gif" alt="ÀÌ¹ÌÁö µî·Ï" class="mgl6" /></a>';
	target["source"].appendChild(dom_li);
}
function imgRegist_del(my){
	var target = new imgRegist_target(my);
	/* li »èÁ¦ */
	if(target.source_li.length <= 2) return false;
	var obj = target["source_li"][target.source_li.length-1];
	obj.parentNode.removeChild(obj);
}

/* ÆË¾÷ ·¹ÀÌ¾î(ÅõÀÚÀÚ±¤Àå) */
function poplry_doc(my, chk){
	var root_li = my.parentNode;
	var target = my.nextSibling.nextSibling;

	if(chk){
		root_li.style.zIndex = 10;
		target.style.display="block"
	}else{
		root_li.style.zIndex = 0;
		target.style.display="";
	}
}

/* ÆË¾÷ ¶ç¿ì±â */
function popup(e) {
	var winURI = e.getAttribute("href");
	var winname = e.rel.split(" ")[1] ? e.rel.split(" ")[1] : "popup";
	newWindow = window.open(winURI,winname,"menubar=no,location=no,resizable=no,status=no");
	newWindow.focus();
	return false;
}
function initPopup() {
	if (!document.getElementsByTagName) return false;
	var links = document.getElementsByTagName("a");
	if (links.length < 1) return false;
	var title;
	for (i = 0; i<links.length; i++) {
		if (links[i].rel.indexOf("popup") != -1) {
			links[i].onclick = function() {
				return popup(this);
			}
			title = links[i].getAttribute("title") ? links[i].getAttribute("title") + "(ÆË¾÷Ã¢À» ¶ç¿ó´Ï´Ù.)" : "ÆË¾÷Ã¢À» ¶ç¿ó´Ï´Ù.";
			links[i].setAttribute("title",title);
		}
	}
}

function MM_openBrWindow(theURL,winName,features) {
	window.open(theURL,winName,features);
}
function goWinPopup(url){
	pOption = "left=300,top=200,width=716,height=620";
	//url     = "/quics?page=B008556&cc=b000001:B003730" ;
	//url     = "/quics?page=B001873&cc=b000001:b005978";
	window.open(url, "Pop", pOption);
}


addLoadEvent(initPopup);

function popup2(filename,width,height) {
	window.open(filename,"popup", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, width="+width+", height="+height);
}

/*
 * Unit PNG fix
 * http://labs.unitinteractive.com/unitpngfix.php
 */
var clear = "http://img1.kbstar.com/img/common/clear.gif" //path to clear.gif

pngfix = function() {
	var els = document.getElementsByTagName('*');
	var ip = /\.png/i;
	var i = els.length;
	while (i-- > 0) {
		var el = els[i];
		var es = el.style;
		if (el.src && el.src.match(ip) && !es.filter) {
			es.height = el.height;
			es.width = el.width;
			es.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + el.src + "',sizingMethod='crop')";
			el.src = clear;
		} else {
			var elb = el.currentStyle.backgroundImage;
			if (elb.match(ip)) {
				var path = elb.split('"');
				var rep = (el.currentStyle.backgroundRepeat == 'no-repeat') ? 'crop' : 'scale';
				es.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + path[1] + "',sizingMethod='" + rep + "')";
				es.height = el.clientHeight + 'px';
				es.backgroundImage = 'none';
				var elkids = el.getElementsByTagName('*');
				if (elkids) {
					var j = elkids.length;
					if (el.currentStyle.position != "absolute") es.position = 'static';
					while (j-- > 0) if (!elkids[j].style.position) elkids[j].style.position = "relative";
				}
			}
		}
	}
}

function ie6PngFix() {
	if (isIE6()) {
		window.attachEvent('onload',pngfix);
	} else {
		return false;
	}
}

addLoadEvent(ie6PngFix);

/* MyKB LP-Bar ³ôÀÌ¼³Á¤ */
function mkb_sizeTo(h){												//¿ÜºÎ(ÇÃ·¡½Ã)¿¡¼­ ¾×¼ÇÀÌ ÀÏ¾î³¯¶§ ÇÔ¼ö¸¦ È£ÃâÇÕ´Ï´Ù.
   document.getElementById("elevator").style.height = h + "px";		// ÇÃ·¡½ÃÀÇ ¾ÆÀÌÄÜ°¹¼ö¿¡µû¸¥ ³ôÀÌ°ª h ¸¦ ¹Þ¾Æ¼­ ÇØ´ç div³ôÀÌ¸¦ ÁöÁ¤ÇÕ´Ï´Ù.
}

/* ºÐ¾çÁßÀÎ ¾ÆÆÄÆ® ·Ñ¸µ */
function scrolling(objId,sec1,sec2,speed,height){
  this.objId=objId;
  this.sec1=sec1;
  this.sec2=sec2;
  this.speed=speed;
  this.height=height;
  this.h=0;
  this.div=document.getElementById(this.objId);
  this.htmltxt=this.div.innerHTML;
  this.div.innerHTML=this.htmltxt+this.htmltxt;
  this.div.isover=false;
  this.div.onmouseover=function(){this.isover=true;}
  this.div.onmouseout=function(){this.isover=false;}
  var self=this;
  this.div.scrollTop=0;
  window.setTimeout(function(){self.play()},this.sec1);
}
scrolling.prototype={
  play:function(){
    var self=this;
    if(!this.div.isover){
      this.div.scrollTop+=this.speed;
      if(this.div.scrollTop>this.div.scrollHeight/2){
        this.div.scrollTop=0;
      }else{
        this.h+=this.speed;
        if(this.h>=this.height){
          if(this.h>this.height|| this.div.scrollTop%this.height !=0){
            this.div.scrollTop-=this.h%this.height;
          }
          this.h=0;
          window.setTimeout(function(){self.play()},this.sec1);
          return;
        }
      }
    }
    window.setTimeout(function(){self.play()},this.sec2);
  },
  prev:function(){
    if(this.div.scrollTop == 0)
    this.div.scrollTop = this.div.scrollHeight/2;
    this.div.scrollTop -= this.height;
  },
  next:function(){
    if(this.div.scrollTop ==  this.div.scrollHeight/2)
    this.div.scrollTop =0;
    this.div.scrollTop += this.height;
  }
};


/*------- Top Util Menu Script -------*/

function utilAct(obj) {
//    if (obj.src.indexOf(siteCode) != -1) {
//       return false;
//    }
//    else {

        if (obj.src.indexOf("_on.gif") != -1) obj.src = obj.src.replace("_on","_off");
        else if (obj.src.indexOf("_off.gif") != -1) obj.src = obj.src.replace("_off","_on");
//	}
}

function ibankView(chkNum) {
    var ibankSub = document.getElementById("ibank-sub");
    if(chkNum == 1) ibankSub.style.display = 'block';
    else ibankSub.style.display = 'none';
}

/* MyKB */

var xx = 0;																											// ÆÇ³ÚÀÌ ¿­·È´ÂÁö ´ÝÇû´ÂÁö ¾Ë±âÀ§ÇÑ ¼³Á¤°ª ÃÊ±âÈ­
function openPannel() {																								// ¿ÜºÎ(ÇÃ·¢½º,ÇÃ·¡½Ã)¿¡¼­ È£ÃâÇÏ´Â ÇÔ¼ö¸¦ ½ÃÀÛÇÕ´Ï´Ù.
	if(xx==0) {																										//ÃÊ±â°ªÀÌ 0ÀÏ¶§´Â ´ÙÀ½ ÇÔ¼ö¸¦ ÁøÇàÇÕ´Ï´Ù.
		document.getElementById('wrapper-kbstar').style.display = 'none';											//ÄÁÅÙÃ÷¿µ¿ªÀÇ MyKB¹Ù ¿µ¿ªÀ» Á¦¿ÜÇÑ div¸¦ °¨Ãä´Ï´Ù.
		document.body.style.background = 'url(http://img1.kbstar.com/img/common/mykb_bg_on.gif)';
		xx = xx+1;																									//ÃÊ±â°ªÀ» 0 ÀÌ¿ÜÀÇ °ªÀ¸·Î º¯°æÇÕ´Ï´Ù.
	}else{																											//ÃÊ±â°ªÀÌ 0ÀÌ ¾Æ´Ò¶§´Â ´ÙÀ½ ÇÔ¼ö¸¦ ÁøÇàÇÕ´Ï´Ù.
		document.getElementById('wrapper-kbstar').style.display = 'block';											//ÄÁÅÙÃ÷¿µ¿ªÀÇ MyKB¹Ù ¿µ¿ªÀ» Á¦¿ÜÇÑ div¸¦ º¸ÀÔ´Ï´Ù.
		document.body.style.background = 'url(http://img1.kbstar.com/img/common/mykb_bg_off.gif)';
		xx = xx-1;																									//ÃÊ±â°ªÀ» 1·Î º¯°æÇÕ´Ï´Ù.
	}																												//ÇÔ¼ö¸¦ ´Ý½À´Ï´Ù.
}

var yy = 0;																//ÀÛµ¿°ªÀ» ÃÊ±âÈ­ÇÕ´Ï´Ù. 0 º¸ÀÓ / 1 °¨Ãã
function openWidget() {
	if(yy==0) {
		document.getElementById('widget-layer').style.display = 'block'; // ID widget-layer ÀÇ DIVºí·ÏÀ» º¸ÀÔ´Ï´Ù.
		yy = yy+1;														//ÃÊ±â°ªÀ» 0 ÀÌ¿ÜÀÇ °ªÀ¸·Î º¯°æÇÕ´Ï´Ù.
	}else{
		document.getElementById('widget-layer').style.display = 'none'; // ID widget-layer ÀÇ DIVºí·ÏÀ» °¨Ãä´Ï´Ù.
		yy = yy-1;														//ÃÊ±â°ªÀ» 1·Î º¯°æÇÕ´Ï´Ù.
	}
}

var zz = 0;																//ÀÛµ¿°ªÀ» ÃÊ±âÈ­ÇÕ´Ï´Ù. 0 º¸ÀÓ / 1 °¨Ãã
function openMymenu() {
	if(zz==0) {
		document.getElementById('mymenu-layer').style.display = 'block'; // ID mymenu-layer ÀÇ DIVºí·ÏÀ» º¸ÀÔ´Ï´Ù.
		zz = zz+1;														//ÃÊ±â°ªÀ» 0 ÀÌ¿ÜÀÇ °ªÀ¸·Î º¯°æÇÕ´Ï´Ù.
	}else{
		document.getElementById('mymenu-layer').style.display = 'none'; // ID mymenu-layer ÀÇ DIVºí·ÏÀ» °¨Ãä´Ï´Ù.
		zz = zz-1;														//ÃÊ±â°ªÀ» 1·Î º¯°æÇÕ´Ï´Ù.
	}
}

/* layer */
function layerOpen(n) {
	document.getElementById('lay_box0'+n).style.display = 'block';
}
function layerClose(n) {
	document.getElementById('lay_box0'+n).style.display = 'none';
}

/* Å×ÀÌºí¾È¿¡ +/- ÁÙÃß°¡,»èÁ¦ */
function line_mng_add(id){
	var target = document.getElementById(id);
	var tmp = target.cloneNode(true);
	var input = tmp.getElementsByTagName("input");
	for (var i=0; i<input.length; i++) {
		input[i].value = "";
	}
	target.parentNode.appendChild(tmp);
}
function line_mng_del(id){
	var target = document.getElementById(id);
	/* modified 2008-09-24
	var arr = target.parentNode.getElementsByTagName("li");
	if(arr.length <= 1) return false;

	var obj = arr[arr.length-1];
	target.parentNode.removeChild(obj);
	*/
	var arr = target.parentNode.childNodes;
	var li = new Array();
	var j = 0;
	for (var i=0; i<arr.length; i++) {
		if (arr[i].tagName == "LI") {
			li[j] = arr[i];
			j++;
		}
	}
	if (li.length <= 1) return false;
	target.parentNode.removeChild(li[li.length-1]);
}

function addRow(el){
	var row = el;
	while (row.tagName != "TR") {
		row = row.parentNode;
	}
	var tmp = row.cloneNode(true);
	var input = tmp.getElementsByTagName("input");
	for (var i=0; i<input.length ; i++) {
		input[i].value = "";
	}
	addClass(tmp,"added");
	/*if (getElementsByClass("calendar-shadow",tmp)) {
		changeCalId(tmp);
	}*/
	insertAfter(tmp,row);
	return false;
}

function changeCalId(el) {
	var cals = getElementsByClass("calendar-shadow",el);
	for (var i=0; i<cals.length; i++) {
		var cal_id = cals[i].getAttribute("id");
		var id_num = (cal_id.indexOf("-") != -1) ? (parseInt(cal_id.split("-")[1]) + 1) : 1;

		if (cal_id.indexOf("-") == -1) {
			new_id = cal_id + "-" + id_num;
		} else {
			new_id = cal_id.split("-")[0] + "-" + id_num;
		}

		cals[i].setAttribute("id",new_id);

		var cal_link = cals[i];
		while ((cal_link.tagName != "A") || !cal_link.onclick) {
			cal_link = cal_link.previousSibling;
		}
		cal_link.new_id = new_id;
		cal_link.onclick = function() {
			togCal(this.new_id);
		}
	}
}

function removeRow(el){
	var target = el;
	while (target.tagName != "TR") {
		target = target.parentNode;
	}
	if (hasClass(target,"added")) {
		target.parentNode.removeChild(target);
	} else {
		alert("»èÁ¦ÇÒ ¼ö ¾ø½À´Ï´Ù.");
	}
	return false;
}

function addElement(el,tag){
	var original = el;
	while (original.tagName != tag.toUpperCase()) {
		original = original.parentNode;
	}
	var tmp = original.cloneNode(true);
	var input = tmp.getElementsByTagName("input");
	for (var i=0; i<input.length ; i++) {
		input[i].value = "";
	}
	addClass(tmp,"added");
	insertAfter(tmp,original);
	return false;
}

function removeElement(el,tag){
	var target = el;
	while (target.tagName != tag.toUpperCase()) {
		target = target.parentNode;
	}
	if (hasClass(target,"added")) {
		target.parentNode.removeChild(target);
	}
	return false;
}

// KB Houstar È¸¿ø¾÷¼Ò Left Menu
function Menu(id) {
	var root = document.getElementById(id);
	this.item = getChildrenByTagName(root,"li");
	for (var i = 0, sub_menu; i < this.item.length; i++) {
		sub_menu = getChildrenByTagName(this.item[i],"div")[0];
		sub_menu = getChildrenByTagName(sub_menu,"ul")[0];
		if (sub_menu) {
			// this.item[i].sub = getChildrenByTagName(sub_menu,"ul")[0];
			this.item[i].sub = sub_menu;
			this.item[i].sub.item = getChildrenByTagName(this.item[i].sub,"li");
		} else {
			this.item[i].sub = null;
		}
	}
}

function openMenu(menu,clicked) {
	clicked = clicked.nextSibling;
	while (clicked.tagName != "DIV") {
		clicked = clicked.nextSibling;
	}
	for (var i=0; i<menu.items.length; i++) {
		menu.items[i].sub_menu.style.display = "none";
	}
	clicked.style.display = "block";
	return false;
}

function initLeftMenu(id,_1depth,_2depth) {
	var target_menu = new Menu(id);
	_1depth = _1depth || 0;
	_2depth = _2depth || 0;
	if (_1depth > 0 && _2depth > 0) {
		addClass(target_menu.item[_1depth-1].sub.item[_2depth-1],"on");
	}
}


/* ºÐ¾ç ÁßÀÎ ¾ÆÆÄÆ® */
function scrollList(list_id,dir) {
	var list = document.getElementById(list_id);
	var all_li = list.getElementsByTagName("li");
	var on_li = getElementsByClass("on",list,"li");
	var first_on, last_on;
	for (var i=0; i<all_li.length; i++) {
		if (all_li[i] == on_li[0]) first_on = i;
		if (all_li[i] == on_li[on_li.length-1]) last_on = i;
	}
	if (dir == "prev") {
		if (first_on != 0) {
			addClass( all_li[first_on-1], "on" );
			removeClass( all_li[last_on], "on" );
		} else if (first_on == 0) {
			var last = all_li[all_li.length-1];
			var temp = last.cloneNode(true);
			addClass(temp,"on");
			last.parentNode.insertBefore(temp,all_li[0]);
			temp = null;
			removeClass(on_li[on_li.length-1],"on");
			last.parentNode.removeChild(last);
		}
	} else if (dir == "next") {
		 if (last_on != (all_li.length-1)) {
			addClass( all_li[last_on+1], "on" );
			removeClass( all_li[first_on], "on" );
		} else if (last_on == (all_li.length-1)) {
			var first = all_li[0];
			var temp = first.cloneNode(true);
			addClass(temp,"on");
			first.parentNode.appendChild(temp);
			temp = null;
			removeClass(on_li[0],"on");
			first.parentNode.removeChild(first);
		}
	} else return;
}
// °ñµå¾Ø¿ÍÀÌÁî ¹Ì¸®º¸±â

var pageCnt = 1;
function cView(lid,n,imgSrc) {
	var cBox = document.getElementById("cBox").getElementsByTagName("div");
	var cnt = 0;
	for (var i=0; i<cBox.length; i++) {
		if (cBox[i].getAttribute("id").indexOf(lid) != -1) cnt++;
	}
	if (n == 'prev') {
		if (pageCnt > 1) {
			document.getElementById(lid+pageCnt).style.display = 'none';
			document.getElementById(lid+(pageCnt-1)).style.display = 'block';
			document.getElementById("cBtn"+pageCnt).src = document.getElementById("cBtn"+pageCnt).src.replace("on","off");
			document.getElementById("cBtn"+(pageCnt-1)).src = document.getElementById("cBtn"+(pageCnt-1)).src.replace("off","on");
			pageCnt -= 1;
		}
	} else if (n == 'next') {
		if (pageCnt < cnt) {
			document.getElementById(lid+pageCnt).style.display = 'none';
			document.getElementById(lid+(pageCnt+1)).style.display = 'block';
			document.getElementById("cBtn"+pageCnt).src = document.getElementById("cBtn"+pageCnt).src.replace("on","off");
			document.getElementById("cBtn"+(pageCnt+1)).src = document.getElementById("cBtn"+(pageCnt+1)).src.replace("off","on");
			pageCnt += 1;
		}
	} else {
		for (var i=1; i<=cnt; i++) {
			document.getElementById(lid+i).style.display = 'none';
			document.getElementById("cBtn"+i).src = document.getElementById("cBtn"+i).src.replace("on","off");
			if (i==n) {
				document.getElementById(lid+i).style.display = 'block';
				document.getElementById("cBtn"+i).src = document.getElementById("cBtn"+i).src.replace("off","on");
				pageCnt = i;
			}
		}
	}
}
function cntOn(obj) {
	if (parseInt(obj.alt) != pageCnt) obj.src = obj.src.replace("_off","_on");
}
function cntOff(obj) {
	if (parseInt(obj.alt) != pageCnt) obj.src = obj.src.replace("_on","_off");
}
// ±ÝÀ¶¼½¼Ç KBStarÅëÀå ÆË¾÷ ¹× »óÇ°ÀÚ¼¼È÷º¸±â ¸µÅ©
function goKBstart() {
    location.href = "javascript:void(window.open('/quics?page=B010583','start',('scrollbars=no,width=830,height=550,top=50,left=50')))";
}
function goDetail() {
	opener.location.href="/quics?page=A013587&cc=a022959:a023287&eventId=223659"; /* ´çÃ·ÀÚ ¹ßÇ¥ */
	self.close();
}
function goDetail1() {
	opener.location.href="/quics?page=B000237&cc=b004697:b004703&À¥»óÇ°ÄÚµå=DP000186";
	self.close();
}

// °ñµå¾Ø¿ÍÀÌÁî ÅÇÀÌµ¿ ½ºÅ©¸³Æ®
function viewJarsan(val){
	for(i=1;i<6;i++){
		document.getElementById("jarsan-box00"+i).style.display = 'none';
	}
	document.getElementById("jarsan-box00"+val).style.display = '';
}

// °í°´Çàº¹¼¾ÅÍ °Ë»ö ÀÎÇ²¹Ú½º ¹è°æ
function searchOut(el) {
	if (!el.value || el.value == "") {
		removeClass(el,"focus");
	}
}
/* ±ÝÀ¶¼½¼Ç ¸ñÀûº° ÀçÅ×Å© ÇÃ·£ */

function planPop(elementID) {
	for(i=1;i<5;i++) {
		var planNum = 'plan'+i;
		objOther = document.getElementById(planNum);
		objOther.style.display = 'none';
	}
	var obj = document.getElementById(elementID);
		obj.style.display = 'block';
}
function closePlanPop() {
	for(i=1;i<5;i++) {
		var planNum = 'plan'+i;
		objOther = document.getElementById(planNum);
		objOther.style.display = 'none';
	}
}

// º»Ã¢ ÁÖ¼Ò º¯°æ
function openerUrl(url) {
	window.opener.location = url;
	return false;
}

// ¼±ÅÃÇÑ ÅÇ ¿­¸° »óÅÂ·Î ÆäÀÌÁö ·Îµå
function openSelectedTab() {
	var url = window.location;
	if ((url.toString().indexOf("#") == -1) || !getElementsByClass("tab-wrap",document)) return false;
	var tab_id = url.hash.replace("#","");
	var selected_tab = document.getElementById(tab_id);

	var tab_wrap = selected_tab.parentNode;
	while (!hasClass(tab_wrap,"tab-wrap")) {
		tab_wrap = tab_wrap.parentNode;
	}
	var tab_conts = getChildrenByClassName(tab_wrap,"tab-cont");

	var tab = document.getElementsByTagName("a");
	for (var i=0; i<tab.length; i++) {
		var _id = tab[i].href.split("#")[1];
		if (_id == tab_id) {
			if (tab[i].onclick) {
				var func = tab[i].onclick;
			} else if (tab[i].onmouseover) {
				var func = tab[i].onmouseover;
			}
			func.call(tab[i]);
			return false;
		}
	}
}
// addLoadEvent(openSelectedTab);

// titleWriter
if ( !titData ) { var titData; }

function titleWriter(str){
	titData = str.replace(/\./g,''); ;
  flashTitle_in();
}

function flashTitle_in(){    
    document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='500' height='24' id='common_bank_title2' align='middle'>");
    document.write("<param name='allowScriptAccess' value='always' />");
    document.write("<param name='movie' value='http://img1.kbstar.com/img/common/common_bank_title2.swf' />");
    document.write("<param name='quality' value='high' />");
    document.write("<param name='wmode' value='transparent' />");
    document.write("<param name='bgcolor' value='#FFFFFF' />");
    document.write("<embed src='http://img1.kbstar.com/img/common/common_bank_title2.swf' wmode='transparent' quality='high' width='500' height='24' name='common_bank_title2' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
    document.write("</object>");
}

function titleData(){

   return titData; 	
}


