

// PNG24 스크립트

		function setPng24(obj) {
			obj.width=obj.height=1;
			obj.className=obj.className.replace(/\bpng24\b/i,''); 
			obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
			obj.src='http://image.kids.daum.net/play/images/empty';
			//obj.src='';
			return '';
		}

// 아이디 비밀번호 배경 스크립트

	String.prototype.trim=function(){
		 var str=this.replace(/(\s+$)/g,"");
		 return str;
	}
	/**
	 * 아이디, 비밀번호 입력 필드에대한 img background controll
	 */
	function setFieldBackground(obj){
		var imgName = 'pwBg.gif';

		if( obj.name == 'id' ) imgName = 'idBg.gif';

		if(obj.value.trim()==''){
			obj.style.background = '#fff url(http://cache.goorm.com/aso/cbt/common/'+imgName+') no-repeat 5px center;';
		}else{
			obj.style.background = '#fff';
		}
	}

	function setClearBackground(obj){
		obj.style.background  = '#fff';
	}


/* ################ bg 이미지를 이용한  rollover 시 flickering 현상을 방지하기 위한 스크립트 ################# */
try {
document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}


/* ################ 게시판 리스트 tr class 변경 ################ */
function fn_listDeco(target) {
	var el =document.getElementById(target).getElementsByTagName("tbody")[0].getElementsByTagName("tr");
	var el2 = new Array;
	var j = 0;

	try
	{
		for(var i=0; i<el.length; i++) {
			if(el[i].className != "notice") {
				el2[j] = el[i];
				j++;
			}
		}
		for (j=0;j<el2.length ;j++ ){
			if((j%10) > 4) {
				el2[j].className += " type2";
				if(j%10 == 5) el2[j].className += " type2_line";
			}
			else if(j!=0 && (j%10==0)) el2[j].className += " type2_line";
		}
	}
	catch (e) {}
	
	if(el[0]) el[0].className += " first";
}

/* 내용펼치기/닫기 */
function foldup(el,targetEl) {
	if(el.className == "dft") el.className = el.className.replace("dft","open");
	else if(el.className == "open") el.className = el.className.replace("open","dft");

	var target = document.getElementById(targetEl);
	if(target) {
		var targetChk = target.className.split(" ");
		var foldFlag = 0;
		for(var i=0; i<targetChk.length; i++) {
			if(targetChk[i]=="dft") {
				foldFlag = 1;
				continue;
			}else if(targetChk[i]=="close") {
				foldFlag = 2;
				continue;
			}
		}
		if(foldFlag == 1) target.className = target.className.replace("dft","close");
		else if(foldFlag == 2) target.className = target.className.replace("close","dft");
		

	}

	
}

// iframe resize
function autoResize(i)
{
    var iframeHeight=
    (i).contentWindow.document.body.scrollHeight;
    (i).height=iframeHeight+20;
}

// Tab Content
function fn_initTab(tabContainerID) {
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var i = 0;

	for(i=0; i<tabAnchor.length; i++) {
		if (tabAnchor.item(i).className == "tab")
			thismenu = tabAnchor.item(i);
		else
			continue;

		thismenu.container = tabContainer;
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.imgEl = thismenu.getElementsByTagName("img").item(0);
		thismenu.onclick = function tabMenuClick() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return false;

			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";
				if(tabContainerID == "characterIntro") {currentmenu.className = currentmenu.className.replace(" selected", "");}
				else {
					if (currentmenu.imgEl) {
						currentmenu.imgEl.src = currentmenu.imgEl.src.replace("_on.gif", "_off.gif");
					} 
					currentmenu.parentNode.className = currentmenu.parentNode.className.replace(" selected", "");
					
				}
			}
			this.targetEl.style.display = "";
			if(tabContainerID == "characterIntro") {this.className += " selected";}
			else {
				if (this.imgEl) {
					this.imgEl.src = this.imgEl.src.replace("_off.gif", "_on.gif");
				}
				this.parentNode.className += " selected";
				
			}
			this.container.current = this;

			return false;
		};

		if (!thismenu.container.first)
			thismenu.container.first = thismenu;
	}
	if (tabContainer.first)
			tabContainer.first.onclick();

	try {
		tabAnchor.item(indivisual).onclick();
	}
	catch (e) {}
}

function fn_tabmenuCtr(tabContainerID, tabNum) {
	var temp = document.getElementById(tabContainerID).getElementsByTagName("a");
	var tabMenuImg = new Array();
	var j=0;
	for(var i=0; i<temp.length; i++) {
		if(temp[i].className == "tab") {
			tabMenuImg[j] = temp[i];
			j++;
		}
	}
	tabMenuImg[tabNum].onclick();
	//location.href= "#" + tabContainerID;
	window.scrollTo(0,0);
}