/*IE6 flicker bug*/
try {document.execCommand('BackgroundImageCache', false, true);} catch(e) {}

/* tab */
var iRollingIndex = 0;
var bRollingStop = false;

function Khc_Tab(m_id , idx){
	bg_class = "k1"
	var cName = document.getElementById(m_id).className + " " + bg_class
	document.getElementById(m_id).className = cName
	var tList = document.getElementById(m_id).getElementsByTagName("a");

	for (i=0;i<tList.length;i++) {
		TabPlay = function(bAllow) {
			for (y=0;y<tList.length;y++) {
			tList[y].className = "";
			document.getElementById(m_id + "_sub" + (y+1)).style.display = "none";
			if(this==tList[y]){x=y+1}
			}
			this.className = this.className + "on";
			document.getElementById(m_id + "_sub" + x).style.display = "block";
			document.getElementById(m_id).className = cName.replace(bg_class,"k" + x)
			iRollingIndex = x;
			bRollingStop = (bAllow != false);
			return false;
		}

		if(idx == 1){
			 tList[i].onclick = TabPlay;
		}else if(idx == 2){
			tList[i].onmouseover = TabPlay;
			tList[i].onmouseout = function() {
				bRollingStop = false;
			};
		}

		if(arguments[1]=="Mover"){tList[i].onmouseover = TabPlay;}
	}

	//setTimeout(('Khc_Tab_Rolling(\'' + m_id + '\');'), 4000);
}

function Khc_Tab_Rolling(m_id) {
	var tList = document.getElementById(m_id).getElementsByTagName("a");
	var iTotalCount = tList.length;

	if(bRollingStop == false) {
		if(iRollingIndex <= 0) {
			iRollingIndex = 1;
		}

		if(iRollingIndex < iTotalCount) {
			iRollingIndex++;
		} else {
			iRollingIndex = 1;
		}

		tList[(iRollingIndex - 1)].onmouseover(false);
	}

	setTimeout(('Khc_Tab_Rolling(\'' + m_id + '\');'), 3000);
}

/* flash */
function Khc_Flash(Url, wd, ht, swfId, wm, vars) {// url,width,height,ID,transparent,var
	var TxtSwf = "" ;
	TxtSwf += "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,29,0' width='"+ wd +"' height='"+ ht +"' id='"+ swfId +"'>" ;
	TxtSwf += "<param name='movie' value='"+ Url +"'>" ;
	TxtSwf += "<param name='wmode' value='"+ wm +"'>" ;
	TxtSwf += "<param name='FlashVars' value='" + vars + "'>" ;
	TxtSwf += "<param name='allowScriptAccess' value='always'>" ;
	TxtSwf += "<param name='allowFullScreen' value='true'>" ;
	TxtSwf += "<param name='quality' value='high'>" ;
	TxtSwf += "<param name='menu' value='false'>" ;
	TxtSwf += "<embed src='"+ Url +"' width='"+ wd +"' height='"+ ht +"' wmode='"+ wm +"' id='"+ swfId +"' FlashVars='"+ vars +"' allowScriptAccess='always' allowFullScreen='true' quality='high' menu='false' pluginspage='https://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash'></embed>" ;
	TxtSwf += "</object>" ;
	document.write (TxtSwf);
}

// select change
var idx01 = false;
function viewSel01(){
	var wrapLayer = document.getElementById('select01');
	if (idx01 == false){
		wrapLayer.className = 'sel01';
		wrapLayer.getElementsByTagName('ul')[0].style.display = 'block';
		idx01 = true;
		return false;
	}
	if (idx01 == true){
		wrapLayer.className = 'sel';
		if (document.getElementById('input01').childNodes[0].nodeType == 3)
			wrapLayer.className = 'sel01';
		wrapLayer.getElementsByTagName('ul')[0].style.display = 'none';
		idx01 = false;
		return false;
	}
}
var idx02 = false;
function viewSel02(){
	var wrapLayer = document.getElementById('select02');
	if (idx02 == false){
		wrapLayer.className = 'sel02';
		wrapLayer.getElementsByTagName('ul')[0].style.display = 'block';
		idx02 = true;
		return false;
	}
	if (idx02 == true){
		wrapLayer.className = 'sel';
		if (document.getElementById('input02').childNodes[0].nodeType == 3)
			wrapLayer.className = 'sel02';
		wrapLayer.getElementsByTagName('ul')[0].style.display = 'none';
		idx02 = false;
		return false;
	}
}
function listClick(){
	var liObj = document.getElementById('list01').getElementsByTagName('a');
	for (var i=0; i<liObj.length; i++){
		liObj[i].onclick = function(){
			document.getElementById('input01').innerHTML =  this.innerHTML;
			document.getElementById('list01').style.display = 'none';
			idx01 = false;
		}
	}
}
function listClick02(){
	var liObj = document.getElementById('list02').getElementsByTagName('a');
	for (var i=0; i<liObj.length; i++){
		liObj[i].onclick = function(){
			document.getElementById('input02').innerHTML =  this.innerHTML;
			document.getElementById('list02').style.display = 'none';
			idx02 = false;
		}
	}
}

function SiteSearchValueCheck(sName) {
	var oForm = document.getElementsByName(sName)[0];
	var bResult = true;

	if((oForm['keyword'].value == '검색') || (oForm['keyword'].value == '')) {
		alert('검색어를 입력해주세요.');
		oForm['keyword'].focus();
		bResult = false;
	}

	return bResult;
}


