 /****************************************************
* @version : 
* @date : 2009.06.03
* @author : ingpdw
* @organization : Daum Communications.
****************************************************/
try {
	document.execCommand("BackgroundImageCache",false,true);
} catch(ignored) {}

kids = {};
kids.util = {
	String : {	
		px : function(s){
			s = String(s);
			return kids.util.String.endWith(s, "px") ? s : s + "px";
		},
		removeCR : function(s){
			var ret = s;		
			return daum.String.replaceAll(daum.String.replaceAll(ret, "\n", " "), "\r", "");
		},
		
		toInt : function(s, l){
			var l = l || 10;
			return parseInt(s, l);
		},
		toFloat : function(s, l){
			var l = l || 10;
			return parseFloat(s, l);
		},

		startWith : function(s, st){
			return s.substring(0, st.length) == st;
		},	
		endWith : function(s, se){		
			return s.substring(s.length - se.length) == se;
		},
		cutPixel : function(s, _px, suffix){
			if(!daum.documentLoaded) return false;
			
			var suffix = suffix || "";		
			document.body.appendChild(daum.HTMLPrototype);			
			daum.HTMLPrototype.innerHTML = suffix;
			var suffixLen = daum.HTMLPrototype.offsetWidth;
			_px -= suffixLen;
			daum.HTMLPrototype.innerHTML = "";
			var _str = new String.Buffer();
			for(var i=0,len=s.length;i<len;i++){			
				daum.HTMLPrototype.innerHTML += s.charAt(i);
				if(_px > daum.HTMLPrototype.offsetWidth){			
					_str.append(s.charAt(i));
				}else{
					_str.append(suffix);
					break;
				}
			}
			daum.HTMLFragment.appendChild(daum.HTMLPrototype);
			
			return _str.evaluate();				
		},
		
		escape : function(s, flag){
			var s1=["&amp;","&#39;","&quot;","&lt;","&gt;"];
			var s2=["&","'","\"","<",">"];
			var s3 = [];		
			var ret = s;
			if(flag) { s3=s1;s1=s2;s2=s3; }
			for(var i=0,len=s1.length;i<len;i++) ret = ret.replace(new RegExp(s1[i], "g"), s2[i]);			
			
			return ret;
		},
		escapeHTML : function(s){
			return daum.String.escape(s, true);
		},
		
		toHTML : function(s){
			return daum.String.escape(s, false);
		},
		
		stripTag : function(s){
			return s.replace(/<\/?[^>]+>/g,'');
		}
	},

	Number : {
		px : function(n){
			return String(n) + "px";
		},	
		fillZero : function(n, cipher){
			var cipher = cipher || 0;		
			var ret = "" + n;
			if(cipher < ret.length) return ret;
			
			while(ret.length < cipher) ret = "0"+ret;			
			
			return ret;
		},		
		toInt : function(n, l){
			var l = l || 10;
			return parseInt(n, l);
		},
		toFloat : function(n, l){
			var l = l || 10;
			return parseFloat(n, l);
		}
	},

	setCookie : function(name,value,expires){
		var d = new Date();	var day="";
		if(expires){
			d.setDate(d.getDate()+expires);
			day = "expires="+d.toGMTString()+";";
		}
		document.domain = "daum.net";
		document.cookie = name+"="+escape(value)+"; path=/;"+day;
	},
	
	getCookie : function(name){
		name += "=";
		cookie = document.cookie + ";";
		start = cookie.indexOf(name);
		if (start != -1){
			end = cookie.indexOf(";",start);
			return unescape(cookie.substring(start + name.length, end));
		}
		return;
	},
	
	delCookie : function(name){
		document.cookie = name + "=;expires=Fri, 31 Dec 1987 23:59:59 GMT;";
	},	

	getWindowSize : function(){
		var w = (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth || 1003) - 2;
		var h = (window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || 650) - 2;		
		
		return { "width" : w, "height" : h }
	},

	setPngOpacity : function(/*e, src, method*/){		
		if(daum.Browser.ie6){
			return function(e, src, method){
				var method = method || "image";
				
				e.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\"" + src + "\", sizingMethod=\"" + method + "\")";
				if (e.style.background != "") 
					e.style.background = "none";
				if (e.tagName.toLowerCase() == "img") 
					e.src = "http://imap.daum-img.net/defaultimg/transparent.gif";
			}
		}else{
			return function(e, src, method){
				var method = (method == "scale") ? "repeat" : "no-repeat";
				if (e.tagName.toLowerCase() != "img") 
					e.style.background = "url(" + src + ") " + method;
				else 
					e.src = src;
			}	
       }
	}()
};

//String Buffer
String.Buffer = function(){
	this.buffer = [];
	this.bufferLength = 0;
	this.append.apply(this, arguments);
};
String.Buffer.prototype = {
	append : function(){
		this.bufferLength = this.buffer.push.apply(this.buffer, arguments);		
	},
	
	removeLast : function(){
		this.buffer.splice(this.bufferLength - 1, 1);
	},
	
	evaluate : function(d){		
		return this.buffer.join(d || "");
	}
};

var flashSetCookie = function(name,value,expires){
	document.domain = "daum.net";
    kids.util.setCookie(name,value,expires);
}

var getGradeCookie = function(name){
	document.domain = "daum.net";
    return kids.util.getCookie(name);
}

var toggleClass = function(_obj , _cssOn , _cssOff){
	if(typeof _cssOn == "undefined" && typeof _cssOff == "undefined"){
		if (_obj.className.indexOf("_off") == -1) _obj.className = _obj.className.replace("_on", "_off") ;
		else _obj.className = _obj.className.replace("_off", "_on") ;
	}else{
		if (_obj .className == _cssOn) _obj .className = _cssOff;
		 else _obj.className = _cssOn;
	}
}

var byteChecker = function(_obj , _limitbytes, _textlimit){
	var commentLength = daum.String.byteLength(_obj.value);
	//var txtNode = document.createTextNode(commentLength);
	if(commentLength > _limitbytes){
		alert("최대 " + _limitbytes + "byte이므로 초과된 글자수는 자동으로 삭제됩니다.");
		_obj.value = daum.String.cutString(_obj.value,_limitbytes);
	}
	$(_textlimit).innerHTML = daum.String.byteLength(_obj.value);
}

var Tab=function(mname , tname , tabnum , _options){

	this.mname=mname;
	this.tname=tname;
	this.tabnum=tabnum;
	this.options={
		mouseEvent:"mouseover", //mouseover , click
		selectedClass:"on"
	}
	daum.extend(this.options, _options);

	for(var i=1,len = this.tabnum; i<=len; i++)
	{
		var menu=$(this.mname+"_"+i);
		var tab=$(this.tname+"_"+i);
		var menuclick = daum.Event.addEvent(menu , this.options.mouseEvent , daum.Function.bind(this.on , this , i) );
		this.on(1);
	}
}
Tab.prototype = {
	on : function(currentSeq){

		for(var i=1,len = this.tabnum; i <= len; i++)
		{
			var menu=$E(this.mname+"_"+i);
			var tab=$(this.tname+"_"+i);
			
			menu.removeClassName(this.options.selectedClass);
			tab.style.display = "none";
			this.open(currentSeq);
		}
	},

	open : function(currentSeq){
		this.currentSeq = currentSeq;
		var menu=$E(this.mname+"_"+this.currentSeq);
		var tab=$E(this.tname+"_"+this.currentSeq);
		menu.addClassName(this.options.selectedClass);
		tab.show();
	}

};

var Rolling = function(url , _option){
	this.url =  url;
	this.data = "";
	this.curIndex = 0;
	this.length = 0;
	this.options = {
		auto : _option.auto,
		interval : _option.interval,
		motion : _option.motion
	}

	window.setData = function(obj){
		return function(data){
			obj.setData(data);
		}
	}(this);
	this.requestData();
}

Rolling.prototype = {
	setData : function(data){
		this.data = data;
		this.length = this.data.length;
		if(this.data.length > 0) this.setUI();
	},
	setUI : function(){
		var container = document.createElement('ul');
		var liElementTemplate="<li id=\"#{ID}\" style=\"display:none\"><a href=\"#{URL}\" title=\"#{TITLE}\" target=\"#{TARGET}\"><img src=\"#{IMGURL}\" alt=\"#{ALT}\" /></a></li>";
		for (i =0 , len = this.length; i < len ;i++ ){
			var data = this.data[i];
			var liElement =  liElementTemplate.replace("#{ID}", "roll"+(i + 1)).replace("#{URL}", data.link).replace("#{TITLE}", data.title).replace("#{TARGET}",data.target).replace("#{IMGURL}", data.imageUrl).replace("#{ALT}" , data.alt);
			container.innerHTML += liElement;
		}
		$T("body")[0].appendChild(container);
		this.next();
		if(this.options.auto) var tid = daum.Function.interval(this.next.bind(this) , this.options.interval);
	},
	requestData : function(){
		daum.load(this.url, function(){});
	},
	prev : function(){
		$E("roll"+this.curIndex).hide();
		if(this.curIndex <= 1) this.curIndex = this.length + 1;
		$E("roll"+ (--this.curIndex)).show();

	},
	next : function(){
		if(this.curIndex != 0) $E("roll"+this.curIndex).hide();
		if(this.curIndex >= this.length){ this.curIndex = 0; }
		$E("roll"+ (++this.curIndex)).show();
	}
}

var Recommend = function(url,_option){
	this.url =  url;
	this.data = "";
	this.options = {
		totalWidth : _option.totalWidth
	}

	window.setReCommendData = function(obj){
		return function(data){
			obj.setData(data);
		}
	}(this);
	this.requestData();
}

Recommend.prototype = {
	setData : function(data){
		this.data = data;
		if(this.data.length > 0) this.setUI();
	},

	setUI : function(){
		var toFloat = kids.util.Number.toFloat;
		//var falseWidth = ( toFloat(this.options.totalWidth)*toFloat(this.data[0].false)) / ( toFloat( this.data[0].true)+toFloat(this.data[0].false));
		//$("barF").style.width = kids.util.String.px(falseWidth);
	},

	requestData : function(){
		daum.load(this.url, function(){});
	}
};

var setParentLocation = function(url){
	opener.location.href = url;
	window.close();
}

var openPopup = function(prevUrl, _width, _height, _options, redirectUrl){
	//소리제거
	setSoundOff();
	var options = {
		"name" : "openPopup",
		"scroll" : "no",
		"resize" : "no",
		"status" : "no"		
	}		
	daum.extend(options, _options || {}, true);

	if(_width == ""){
		window.open(prevUrl,"_blank");
	}else if(_width == "full"){
		window.open(prevUrl,"_blank", "fullscreen=yes");
	}else{
		window.open(prevUrl,"_blank","toolbar=no, location=no, status="+options.status+",scrollbars="+options.scroll+", resizable="+options.resize+", width=" + _width + ", height=" + _height);
	}
	
	if(redirectUrl){
		window.location.href=redirectUrl;
	}
};

var reload = function(url) {
	location.href = url;
}

var popupFullOpen = function(openUrl)	{
	var popupWidth = '100%';
	var popupHeight = '100%';

	if(screen.availWidth && screen.availHeight){
		var popupWidth = screen.availWidth;
		var popupHeight = screen.availHeight;
	}
	var popupOption = 'width='+popupWidth+',height='+popupHeight+',toolbar=no,location=no,status=no,menubar=no,top=0,left=0,scrollbars=no,resizable=no';

	/*if(navigator.appName == "Netscape"){  FIREFOX & SAFARI에서 Fullscreen 팝업이 적용안되는 문제 해결 
		window.open(openUrl,'fullPopup',popupOption);
	} else {
		window.open(openUrl,'fullPopup',popupOption + ',fullscreen');
	}*/

	window.open(openUrl,'fullPopup',popupOption);

}


// 모든 체크 해제
var  unCheckAllCheckBoxes = function() {
	var elements = $T("input");
	len = $T("input").length;
	for(i = 0; len > i ; i ++){
		if(elements[i].type == "checkbox")	{
			elements[i].checked = false;
			if (daum.Element.getNext(elements[i]).className.indexOf("_on") != -1) {
				daum.Element.getNext(elements[i]).className = daum.Element.getNext(elements[i]).className.replace("_on", "_off") ;
			}

		}
	}
}

// 모든 체크 선택
var  checkAllCheckBoxes = function() {
	var elements = $T("input");
	len = $T("input").length;
	for(i = 0; len > i ; i ++){
		if(elements[i].type == "checkbox")	{
			elements[i].checked = true;
			if (daum.Element.getNext(elements[i]).className.indexOf("_off") != -1) {
				daum.Element.getNext(elements[i]).className = daum.Element.getNext(elements[i]).className.replace("_off","_on") ;
			}
		}
	}
}

// 내 앨범 담기, 삭제
var applyCheckedMyAlbumContentIdList = function (url) {
	var contentIds = getCheckedList();
	url = url + "?contentIds=" + contentIds;
	window.open(url, '', 'width=400px, height=400px');
}

// 리스트에서 특정 컨텐츠 1개 이상 선택하여 해당 Id 반환
var  getCheckedList = function() {
	var contentIds = "";
	var elements = $T("input");
	len = $T("input").length;
	for(i = 0; len > i ; i ++){
		if(elements[i].type == "checkbox" && elements[i].checked == true)	{
			contentIds = contentIds + elements[i].value + ",";
		}
	}
	
	if( contentIds.length <= 0 ) {
		return "";
	}
	
	var length = contentIds.length - 1;
	contentIds = contentIds.substring(0, length)
	
	return contentIds;
}
	
// 선택 보기
var applyCheckedContentViewContentIdList = function (url) {
	var contentIds = getCheckedList();
		
	url = url + "&commaSeperatedIds=" + contentIds;
	if( contentIds == null || "" == contentIds ) {
		window.open(url, '', 'width=400px, height=400px');
	} else {
		popupFullOpen(url);
	}

}



// 로그인 페이지로 전환
var sendDaumLogin = function  () {
	topUrl = document.location.href;
	top.location = "http://www.daum.net/Mail-bin/login.html?category=kids&url=" + escape(topUrl);
}

// 부모창 기준 - 부모창을 리스트로 넘기고 새창 띄우기
var openPopupRedirectUrl = function (popupUrl, redirectUrl) {
	 popupFullOpen(popupUrl);
	window.location.href=redirectUrl;
}

/* =================================================================
== 여기까지 
===================================================================*/


/* == PNG 이미지 표시기 =======================================================
이 함수는 오직 MS의 IE6에서만 동작해야 합니다.
============================================================================ */
var loadAlphaImage = function (imageObj) {

	if (window.navigator.appVersion.indexOf("MSIE 6.0") > -1) {
		imageObj.width = imageObj.height = 1;
        imageObj.className = imageObj.className.replace(/\bAlphaImg\b/i,"");
		imageObj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+imageObj.src+"', sizingMethod='image') " ;
		imageObj.src = "http://image.kids.daum.net/images/common/blank.gif";

		return "" ;
	}
}

// 이미지 롤 오버
var  addRollOver = function(targetObj) {
	var _default = "_off" ;
	var _over = "_on" ;
	if (targetObj) {
		targetObj.onmouseover = function() {this.src = this.src.replace(_default, _over) ;} ;
		targetObj.onmouseout = function() {this.src = this.src.replace(_over, _default) ;} ;
		targetObj.onmouseover() ;
	}
}

// 플래시 생성
/*function createFlash(_options) {
	var container = document.createElement("div") ;
	var flashHTML = new String("") ;
	var sOptions = new Object() ;
	var dOptions = new Object() ;
	var uOptions = new Object() ;
	var pName ;
	var tmpDate = new Date() ;
	dOptions = {
		movie:"null" ,
		allowScriptAccess : "always" ,
		quality : "high" ,
		menu : "false" ,
		bgcolor : "#FFFFFF"
	} ;
	sOptions = {
		classID : "d27cdb6e-ae6d-11cf-96b8-444553540000" , // Class ID
		codeBase : "http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" , // Code base
		plugIn : "http://www.macromedia.com/go/getflashplayer" , // Plug in page (Netscape)
		type : "application/x-shockwave-flash" , // ActiveX type (Netscape)
		id:String.fromCharCode(Math.floor(Math.random()*26)+65) + tmpDate.getTime() ,
		width : "0" ,
		height : "0" ,
		align : "middle"
	} ;
	for (pName in _options) {
		if (sOptions[pName]) sOptions[pName] = (_options[pName]) ? _options[pName] : sOptions[pName] ;
		else if (dOptions[pName]) dOptions[pName] = (_options[pName]) ? _options[pName] : dOptions[pName] ;
		else uOptions[pName] = _options[pName] ;
	}
	flashHTML += '<object classid="clsid:'+sOptions.classID+'" codebase="'+sOptions.codeBase+'" width="'+sOptions.width+'" height="'+sOptions.height+'" id="'+sOptions.id+'" align="'+sOptions.align+'">\n' ;
	for (pName in dOptions) {
		flashHTML += '<param name="'+pName+'" value="'+dOptions[pName]+'" />\n' ;
	}
	for (pName in uOptions) {
		flashHTML += '<param name="'+pName+'" value="'+uOptions[pName]+'" />\n' ;
	}
	flashHTML += '<embed src="'+dOptions.movie+'" quality="'+dOptions.quality+'" bgcolor="'+dOptions.bgcolor+'" width="'+sOptions.width+'" height="'+sOptions.height+'" name="'+sOptions.id+'" align="'+sOptions.align+'" allowScriptAccess="'+dOptions.allowScriptAccess+'" type="'+sOptions.type+'" pluginspage="'+sOptions.plugIn+'" ' ;
	for (pName in uOptions) {
		flashHTML += ' '+pName+'="'+uOptions[pName]+'"' ;
	}
	flashHTML += '></embed>' ;
	flashHTML += '</object>' ;
	container.innerHTML = flashHTML ;
	document.write(container.innerHTML) ;
	return container.getElementsByTagName("object")[0] ;
}*/

var ListRolling = function(obj , count , _options){
	this.obj =  obj;
	this.count = count;
	this.curBlock = 0;
	
	this.options = {
		auto : _options.auto,
		interval : _options.interval,
		motion : _options.motion,
		prevBtn : _options.prevBtn,
		nextBtn : _options.nextBtn,
		element : _options.element || "li"
	}

	this.list = $(this.obj).getElementsByTagName(this.options.element);
	this.totalBlock = parseInt(this.list.length / this.count);
	if(this.list.length % this.count) this.totalBlock++;

	
	daum.extend(this.options, _options);
	this.setUI();
}

ListRolling.prototype = {
	setUI : function(){
		if(this.options.auto && this.options.interval) var tid = daum.Function.interval(this.next.bind(this), this.options.interval);
		if(this.options.prevBtn) daum.Event.addEvent($(this.options.prevBtn) , "click", this.prev.bindAsEventListener(this));
		if(this.options.nextBtn) daum.Event.addEvent($(this.options.nextBtn) , "click", this.next.bindAsEventListener(this));
		this.allHide();
		for(var i = 0 , len = this.count ; len > i ; i++) {
			if(i >= this.list.length) break;
			$E(this.list[i]).show();
		}		
	},

	prev : function(){
		this.allHide();
		--this.curBlock;
		if(this.curBlock < 0) this.curBlock = this.totalBlock - 1;
		for(var i = this.curBlock * this.count ,  len = this.curBlock * this.count + this.count ; len > i ; i++)	{
			if(i >= this.list.length) break;
			$E(this.list[i]).show();
		}
	},

	next : function(){
		this.allHide();
		++this.curBlock;
		if( this.curBlock >= this.totalBlock ) this.curBlock = 0;

		for(var i = this.curBlock * this.count , len = this.curBlock * this.count + this.count ; len > i ; i++) {
			if(i >= this.list.length) break;
			$E(this.list[i]).show();
		}
	},

	allHide : function(){
		for (i =0 , len = this.list.length; i < len ; i++ )  $E(this.list[i]).hide();
	}
}

kids.flash = {
	jsReady : false,
	loaded : function(){
		 return jsReady;
	},
	loadComplete : function(){
		 this.jsReady = true;
	},
	selectMovie : function(movie){
		return $(movie);
	}
};

//090624 ingpdw Ajax추가 
daum.Ajax = function(_options){
	this.options = {
		url : "",
		method : "GET",
		async : true,
		timeout : 5000,
		paramString : "",
		encoding : "euc-kr",
		onsuccess : function(){},
		onfailure : function(){},
		onloading : function(){},
		ontimeout : function(){}
	}
	daum.extend(this.options, _options || {});
	
	this.init();		
}
daum.Ajax.prototype = {
	init : function(){
		if(window.XMLHttpRequest){
			this.XHR = new XMLHttpRequest();
		}else if(window.ActiveXObject){		
			try{
				this.XHR = new ActiveXObject("Msxml2.XMLHTTP");			
			}catch(e){
				try{
					this.XHR = new ActiveXObject("Microsoft.XMLHTTP");				
				}catch(e){				
					this.XHR = null;
				}
			}
		}		
		
		if(!this.XHR) return false;
	},
	
	request : function(url, options){
		this.setOptions(options);
		var url = url || this.options.url;
				
		this.open(url);
	},
	
	open : function(url){

		this.XHR.open(this.options.method, url, this.options.async);		
		
		if(this.options.async) this.XHR.onreadystatechange = daum.Function.bindAsEventListener(this.stateHandle, this);
		
		this.options.timer = daum.Function.timeout(this.abort, this.options.timeout, this);

		this.XHR.setRequestHeader("charset", this.options.encoding);
		if(this.options.method.toUpperCase() == "POST"){
			this.XHR.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			this.XHR.send(this.options.paramString)
			if(!this.options.async) this.stateHandle();
		}else{
			this.XHR.send(null);
			if(!this.options.async) this.stateHandle();
		}
	},
	
	abort : function(){
		if(this.XHR){
			this.XHR.abort();
			this.callTimeout();
		}
	},
	
	stateHandle : function(e){
		switch(this.XHR.readyState){
			case 4:
				window.clearTimeout(this.options.timer);
				this.options.timer = null;
				
				if(this.XHR.status == 200 || this.XHR.status == 304){
					this.callSuccess();
				}else if(this.XHR.status >= 400){
					this.callFailure();
				}
				
				break;
				
			case 1:
				this.callLoading();
				
				break;			
		}			
	},
	
	callSuccess : function(){
		this.options.onsuccess(this.XHR);		
	},
	callFailure : function(){
		this.options.onfailure(this.XHR);		
	},
	callLoading : function(){
		this.options.onloading(this.XHR);		
	},
	callTimeout : function(){
		this.options.ontimeout(this.XHR);
	},
	setOptions : function(options){
		daum.extend(this.options, options || {});
	}
};

daum.Ajax.xmlToObject = function(xmlDocument){
	var root = xmlDocument.documentElement;

	var builder = function(node){
		var obj = {};
		var cNodes = daum.getChildElements(node);
		
		for(var i=0,loop=cNodes.length; i<loop; i++){
			var name = cNodes[i].nodeName;

			var value = (daum.getChildElements(cNodes[i]).length > 0)?builder(cNodes[i]):cNodes[i].firstChild.nodeValue;
			
			if(obj[name] != undefined || node.getElementsByTagName(name).length > 1){
				if(obj[name] == undefined){
					obj[name] = [];
				}
				
				obj[name].push(value);
			}else{
				obj[name] = value;
			}
		}
		
		return obj;
	};
	
	return builder(root);
}

daum.Ajax.jsonToObject = function(jsonStr){
	jsonStr = '[' + jsonStr + ']';
	
	var result = eval(jsonStr);
	
	return result.shift();
}

//달력 추가 090625 ingpdw
JIGU={};
JIGU.Calendar = function(year,month){
	var d=new Date();
	if(year) d.setFullYear(year);
	if(month) d.setMonth(month-1);

	this.day=d;
	this.day_sweek=-1;
	this.ymd=this.getYMD(d);
	this.today=new Date();
	this.today_ymd=this.getYMD(this.today);
	this.selday=null;
	this.selday_ymd="";
	this.selbox=null; 

	this.is_draw=0;
	this.is_show=0;
	this.show_el=null;

	this.parent = parent;


	this.pid = "JIGU_Calender"+daum.random(10000,100000);

};
JIGU.Calendar.prototype={

	setBox:function(num,ymd,type,date){ //type 1:prev,2:next,0:now // date 0:weekday,1:sun,2:sat
		var box=daum.$(this.pid+"_"+num);
		box.ymd=ymd;
		
		var tempCName = box.className;
		var tempCIndex = tempCName.indexOf("week");
		
		if(type==1) box.className = tempCName.substring(tempCIndex, tempCIndex + 5) + " nearPrev";
		else if(type==2) box.className = tempCName.substring(tempCIndex, tempCIndex + 5) + " nearNext";
		else box.className = tempCName.substring(tempCIndex, tempCIndex + 5);
		
		
		if(ymd==this.today_ymd) box.className += " today";
		
		box.innerHTML = '<a href="javascript:;">' + kids.util.String.toInt(ymd.substring(6,8)) + '</a>';
		var self = this;
		if(this.onClick) box.onclick=function(){ self.onClick(box) }; 
	},
	getYMD :function(date){
		var y=date.getFullYear();
		var m=date.getMonth()+1;
		if(m<10) m="0"+m;
		var d=date.getDate();
		if(d<10) d="0"+d;
		return y+""+m+""+d;
	},
	getLastDay :function(date){
		return new Date(date.getFullYear(),date.getMonth()+1,0).getDate();
	},
	getSweek:function(date){
		return new Date(date.getFullYear(),date.getMonth(),1).getDay();
	},
	goPrev:function(){
		this.draw(this.day.getFullYear(), this.day.getMonth()-1);
	},
	goNext:function(){
		this.draw(this.day.getFullYear(), this.day.getMonth()+1);
	},
	goToday:function(){
		this.draw(this.today.getFullYear(), this.today.getMonth());
	},
	setPosition:function(_el,posL,posT){
		var left=0,top=0;
		left = posL || 0;	
		top = posT || 0;
 		/*while(_el){
	 		left=_el.offsetLeft || 0;
 			top=_el.offsetTop || 0;
			_el=_el.offsetParent;
 		}*/
 		return {'x': left, 'y': top}
	},
	show:function(el , posL , posT){
		this.show_el=el;

		var pos = this.setPosition(this.show_el , posL , posT);
		
		var ifa=parent.document.getElementById('JIGUCalendarIfa');
		if(!this.is_show)
		{
			daum.Event.addEvent(parent.document, "mousedown", function(){ ifa.style.display='none' });
			this.is_show=1;
		}
		if(this.selbox)	this.selbox.className="JIGUCalendar_box";	

		var str=el.value.replace(/[^0-9]/g,"");		
		if(str.length==8)//
		{
			var selday=new Date(str.substring(0,4), str.substring(4,6)-1, str.substring(6,8));
			this.draw(selday.getFullYear(), selday.getMonth());
			
			var d=selday.getDate();
			var n1=Math.ceil((d+this.day_sweek)/7) - 1;
			var n2= d-(1+(7*n1)-this.day_sweek);
			this.selbox=daum.$(this.pid+"_"+n1+""+n2);
			this.selbox.className="JIGUCalendar_box_selday";
		}
		
		//ifa.style.top=daum.String.px(pos.y+el.offsetHeight);
		ifa.style.top= kids.util.String.px(pos.y);
		ifa.style.left= kids.util.String.px(pos.x);
		ifa.style.display="block";
	},
	print:function(){
		// calendar template
		var calT = new daum.Template('<div id="#{_pid}">#{_skin}</div>');
		document.write(calT.evaluate({_pid:this.pid, _skin:this.skin()}));
		
		var day=this.day;
		var selyear=daum.$(this.pid+"_selyear");
		var selmonth=daum.$(this.pid+"_selmonth");
		var btnprev=daum.$(this.pid+"_btnprev");
		var btnnext=daum.$(this.pid+"_btnnext");

		try{
			var self=this;
			daum.addEvent(selyear, "change", function(){
				self.draw(selyear.value, selmonth.value - 1);
			});
			daum.addEvent(selmonth, "change", function(){
				self.draw(selyear.value, selmonth.value - 1);
			});
			daum.addEvent(btnprev, "click", function(){self.goPrev()});
			daum.addEvent(btnnext, "click", function(){self.goNext()});
		}catch(e){}

		this.draw(day.getFullYear(), day.getMonth());
	},
	draw:function(year,month){
		var day=this.day;
		if(this.is_draw) if(year==day.getFullYear() && month==day.getMonth()) return;
		this.is_draw=1;
		day.setFullYear(year);
		day.setMonth(month);		
		this.day_sweek=this.getSweek(day);

		
		
		try{
			daum.$(this.pid+"_selyear").innerHTML=day.getFullYear();
			daum.$(this.pid+"_selmonth").innerHTML=day.getMonth()+1;
		}catch(e){}
		
		
		var d0=new Date(year,month,1);
		d0_lastday=this.getLastDay(d0);

		var d1=new Date(year,month-1,1);	//이전달 
		var d2=new Date(year,month+1,1);	//다음달 
		var d1_lastday=this.getLastDay(d1);
		
		var num=null;
		var d0_day=1,d2_day=1;
		for(var i=0; i<6; i++) 
		{			
			for(var j=0; j<7; j++) 
			{
				num=i+""+j;
				if(i==0 && j<this.day_sweek) //이전달 
				{
					d1.setDate( d1_lastday - (this.day_sweek-j) + 1 );
					this.setBox(num, this.getYMD(d1),1)					
				}
				else if(d0_day>d0_lastday)
				{
					d2.setDate(d2_day++);
					this.setBox(num, this.getYMD(d2),2)
				}
				else 
				{
					d0.setDate(d0_day++);
					this.setBox(num, this.getYMD(d0),0);
				}
			}
		}
	},
	skin:function(){

		var s='';

		s = '<table class="movieCal">'
		+'<thead class="navi">'
		+'		<tr>'
		+'			<td class="prev"><button id="'+this.pid+'_btnprev" title="이전달로 이동">이전달로 이동</button></td>'
		+'			<td><span class="calText"><span id="'+ this.pid +'_selyear"></span>. <span id="'+ this.pid +'_selmonth"></span></span></td>'
		+'			<td class="next"><button id="'+this.pid+'_btnnext" title="다음달로 이동">다음달로 이동</button></td>'
		+'		</tr>'
		+'</thead>'
		+'<tbody>'
		+'		<tr>'
		+'			<td class="cal" colspan="3" style="border">'
		+'				<table>'
		+'					<thead>'
		+'						<tr>'
		+'							<th class="head1">일</th>'
		+'							<th class="head2">월</th>'
		+'							<th class="head3">화</th>'
		+'							<th class="head4">수</th>'
		+'							<th class="head5">목</th>'
		+'							<th class="head6">금</th>'
		+'							<th class="head7">토</th>'
		+'						</tr>'
		+'					</thead>'
		+'					<tbody>';
		
		for(var i=0; i<6; i++){
			s += '<tr>';
			for(var j=0; j<7; j++){
				s += '	<td id="'+this.pid+'_' + i + j + '" class="week' + (j+1) + '"></td>'
			}
			s += '</tr>';
		}
		
		s += '				</tbody>'
		+'				</table>'
		+'			</td>'
		+'		</tr>'
		+'	</tbody>'
		+'</table>'
		
		
		return s;	
	}
};


//추천 추가 090624 ingpdw
var ajax = null;
var vote = function(url /*, select*/){
	var selected = daum.$A(arguments); selected.shift();
	ajax = new daum.Ajax();
	ajax.request( url , {
		onsuccess : function(xhr){
			
			var voteGood = $("voteGood");
			var voteBad = $("voteBad");
			var badBar = $("badBar");			
			
			var result = xhr.responseXML;
			var root = result.documentElement;
			var len = root.childNodes.length;
			var error;
			for(var i = 0 ;len > i ; i++){
				if(root.childNodes[i].nodeType == 1 && root.childNodes[i].nodeName == "vote"){
					(root.childNodes[i].getAttribute("count")) ? countValue = root.childNodes[i].getAttribute("count") : countValue = 0;
					(root.childNodes[i].getAttribute("up")) ? goodValue = root.childNodes[i].getAttribute("up") : goodValue = 0;
					(root.childNodes[i].getAttribute("down")) ? badValue = root.childNodes[i].getAttribute("down") : badValue = 0;
					break;
				}

				if(root.childNodes[i].nodeType == 1 && root.childNodes[i].nodeName == "message"){
					error = true;
				}
			}

			if(!error){
				if(selected != ""){
					if(selected == "kids_down") {
						badValue = countValue;
						goodValue = voteGood.innerHTML;
					}else{
						goodValue = countValue;
						badValue = voteBad.innerHTML;
					}
				}
			
				if(goodValue) voteGood.innerHTML = goodValue;
				if(badValue) voteBad.innerHTML = badValue;
				var badWidth = ( badValue * 100.0 )/( Number( goodValue ) + Number( badValue ) );
				if(badValue != "0" && goodValue == "0") badWidth = "100";
				if(badValue == "0" && goodValue == "0") badWidth = "50";
				if(!Number(badWidth)) badWidth = 0;
				
				daum.Element.setStyle(badBar,"width",badWidth+"%");
			}
		}
	});
}

	var voteSubmit = function(select, gameId, voteKey){
		vote("http://kids.daum.net/kids/do/common/vote?service="+select+"&voteId="+gameId+"&voteKey="+voteKey+"", select);
	}


//메뉴 사운드 추가 090625 ingpdw
var sound = function (url) { 
		music.src=url; 
}
var deleteSound = function () {
	if(!$("GNB_infant")) return;
	if(bgsound) document.body.removeChild(bgsound);
}

var setSoundElement = function(){
	if(daum.Browser.ie){
		bgsound = document.createElement("bgsound");
	}else{
		bgsound = document.createElement("embed");
	}
	bgsound.loop = "1";
	bgsound.id = "music";
	bgsound.style.width = 0;
	bgsound.style.height = 0;
	document.body.appendChild(bgsound);
}
var soundOff = false;
var soundFiles = ["","http://image.kids.daum.net/sound/study.mp3","http://image.kids.daum.net/sound/animation.mp3","http://image.kids.daum.net/sound/dinosaur.mp3","http://image.kids.daum.net/sound/play.mp3","http://image.kids.daum.net/sound/movie.mp3","http://image.kids.daum.net/sound/song.mp3","http://image.kids.daum.net/sound/dinoworld.mp3","http://image.kids.daum.net/sound/market.mp3"];
var setMenuSound = function(){
	if(!$("GNB_infant")) return;
	var menus = daum.$T("li" , $("GNB_infant"));
	if(menus.length < 6){
		return;
	}
	setSoundElement();
	/*temp code*/
	daum.Event.addEvent(menus[1], "mouseover", function(){if(!soundOff) $("music").src = soundFiles[1];});
	daum.Event.addEvent(menus[2], "mouseover", function(){if(!soundOff) $("music").src = soundFiles[2];});
	daum.Event.addEvent(menus[3], "mouseover", function(){if(!soundOff) $("music").src = soundFiles[3];});
	daum.Event.addEvent(menus[4], "mouseover", function(){if(!soundOff) $("music").src = soundFiles[4];});
	daum.Event.addEvent(menus[5], "mouseover", function(){if(!soundOff) $("music").src = soundFiles[5];});
	daum.Event.addEvent(menus[6], "mouseover", function(){if(!soundOff) $("music").src = soundFiles[6];});
	if(location.href.split("/").length <= 6){
	daum.Event.addEvent(menus[7], "mouseover", function(){if(!soundOff) $("music").src = soundFiles[7];});
	daum.Event.addEvent(menus[8], "mouseover", function(){if(!soundOff) $("music").src = soundFiles[8];});
	}
}

var setSoundOff = function(){
	soundOff = true;
}

var openSound = function(){
	var topSound = "http://image.kids.daum.net/sound/open.mp3";
	setSoundElement();
	$("music").src = topSound;
}

if(location.href.indexOf("http://kids.daum.net/kids/infant/") != -1 || location.href.indexOf("http://kids.daum.net/kids/do/infant") != -1){
	daum.Event.addEvent(window,"load",setMenuSound);
	daum.Event.addEvent(window,"unload",deleteSound);
}

// 탑페이지 로딩시 사운드 ingpdw
if(location.href.split("?")[0] == "http://kids.daum.net/"){
	daum.Event.addEvent(window,"load",openSound);
}



var card_Print = function(num) { window.open('http://kids.daum.net/kids/infant/marble/marbleCardPrint.html?cardId='+num,'marble','scrollbars=yes,toolbar=no,menubar=no,location=no,height=700,width=600'); }

//by ezsharp : frame tab에서 사용 ex)소설 왼쪽메뉴
var setClass = function(id, css) {
  document.getElementById(id).className = css;
}

// ZeroClipBoard
var ZeroClipboard = {
	
	version: "1.0.4",
	clients: {}, // registered upload clients on page, indexed by id
	moviePath: 'http://image.kids.daum.net/swf/infant/ZeroClipboard.swf', // URL to movie
	nextId: 1, // ID of next movie
	
	$: function(thingy) {
	
		// simple DOM lookup utility function
		if (typeof(thingy) == 'string') thingy = document.getElementById(thingy);
		if (!thingy.addClass) {
			// extend element with a few useful methods
			thingy.hide = function() { this.style.display = 'none'; };
			thingy.show = function() { this.style.display = ''; };
			thingy.addClass = function(name) { this.removeClass(name); this.className += ' ' + name; };
			thingy.removeClass = function(name) {
				this.className = this.className.replace( new RegExp("\\s*" + name + "\\s*"), " ").replace(/^\s+/, '').replace(/\s+$/, '');
			};
			thingy.hasClass = function(name) {
				return !!this.className.match( new RegExp("\\s*" + name + "\\s*") );
			}
		}
		return thingy;
	},
	
	setMoviePath: function(path) {
		// set path to ZeroClipboard.swf
		this.moviePath = path;
	},
	
	dispatch: function(id, eventName, args) {
		// receive event from flash movie, send to client		
		var client = this.clients[id];
		if (client) {
			client.receiveEvent(eventName, args);
		}
	},
	
	register: function(id, client) {
		// register new client to receive events
		this.clients[id] = client;
	},
	
	getDOMObjectPosition: function(obj) {
		// get absolute coordinates for dom element
		var info = {
			left: 0, 
			top: 0, 
			width: obj.width ? obj.width : obj.offsetWidth, 
			height: obj.height ? obj.height : obj.offsetHeight
		};

		while (obj) {
			info.left += obj.offsetLeft;
			info.top += obj.offsetTop;
			obj = obj.offsetParent;
		}

		return info;
	},
	
	Client: function(elem) {
		// constructor for new simple upload client
		this.handlers = {};
		
		// unique ID
		this.id = ZeroClipboard.nextId++;
		this.movieId = 'ZeroClipboardMovie_' + this.id;
		
		// register client with singleton to receive flash events
		ZeroClipboard.register(this.id, this);
		
		// create movie
		if (elem) this.glue(elem);
	}
};

ZeroClipboard.Client.prototype = {
	
	id: 0, // unique ID for us
	ready: false, // whether movie is ready to receive events or not
	movie: null, // reference to movie object
	clipText: '', // text to copy to clipboard
	handCursorEnabled: true, // whether to show hand cursor, or default pointer cursor
	cssEffects: true, // enable CSS mouse effects on dom container
	handlers: null, // user event handlers
	
	glue: function(elem) {
		// glue to DOM element
		// elem can be ID or actual DOM element object
		this.domElement = ZeroClipboard.$(elem);
		
		// float just above object, or zIndex 99 if dom element isn't set
		var zIndex = 99;
		if (this.domElement.style.zIndex) {
			zIndex = parseInt(this.domElement.style.zIndex) + 1;
		}
		
		// find X/Y position of domElement
		var box = ZeroClipboard.getDOMObjectPosition(this.domElement);
		
		// create floating DIV above element
		this.div = document.createElement('div');
		var style = this.div.style;
		style.position = 'absolute';
		style.left = '' + box.left + 'px';
		style.top = '' + box.top + 'px';
		style.width = '' + box.width + 'px';
		style.height = '' + box.height + 'px';
		style.zIndex = zIndex;
		
		// style.backgroundColor = '#f00'; // debug
		
		var body = document.getElementsByTagName('body')[0];
		body.appendChild(this.div);
		
		this.div.innerHTML = this.getHTML( box.width, box.height );
	},
	
	getHTML: function(width, height) {
		// return HTML for movie
		var html = '';
		var flashvars = 'id=' + this.id + 
			'&width=' + width + 
			'&height=' + height;
			
		if (navigator.userAgent.match(/MSIE/)) {
			// IE gets an OBJECT tag
			var protocol = location.href.match(/^https/i) ? 'https://' : 'http://';
			html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+protocol+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+width+'" height="'+height+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ZeroClipboard.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+flashvars+'"/><param name="wmode" value="transparent"/></object>';
		}
		else {
			// all other browsers get an EMBED tag
			html += '<embed id="'+this.movieId+'" src="'+ZeroClipboard.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+flashvars+'" wmode="transparent" />';
		}
		return html;
	},
	
	hide: function() {
		// temporarily hide floater offscreen
		if (this.div) {
			this.div.style.left = '-2000px';
		}
	},
	
	show: function() {
		// show ourselves after a call to hide()
		this.reposition();
	},
	
	destroy: function() {
		// destroy control and floater
		if (this.domElement && this.div) {
			this.hide();
			this.div.innerHTML = '';
			
			var body = document.getElementsByTagName('body')[0];
			try { body.removeChild( this.div ); } catch(e) {;}
			
			this.domElement = null;
			this.div = null;
		}
	},
	
	reposition: function(elem) {
		// reposition our floating div, optionally to new container
		// warning: container CANNOT change size, only position
		if (elem) {
			this.domElement = ZeroClipboard.$(elem);
			if (!this.domElement) this.hide();
		}
		
		if (this.domElement && this.div) {
			var box = ZeroClipboard.getDOMObjectPosition(this.domElement);
			var style = this.div.style;
			style.left = '' + box.left + 'px';
			style.top = '' + box.top + 'px';
		}
	},
	
	setText: function(newText) {
		// set text to be copied to clipboard
		this.clipText = newText;
		if (this.ready) this.movie.setText(newText);
	},
	
	addEventListener: function(eventName, func) {
		// add user event listener for event
		// event types: load, queueStart, fileStart, fileComplete, queueComplete, progress, error, cancel
		eventName = eventName.toString().toLowerCase().replace(/^on/, '');
		if (!this.handlers[eventName]) this.handlers[eventName] = [];
		this.handlers[eventName].push(func);
	},
	
	setHandCursor: function(enabled) {
		// enable hand cursor (true), or default arrow cursor (false)
		this.handCursorEnabled = enabled;
		if (this.ready) this.movie.setHandCursor(enabled);
	},
	
	setCSSEffects: function(enabled) {
		// enable or disable CSS effects on DOM container
		this.cssEffects = !!enabled;
	},
	
	receiveEvent: function(eventName, args) {
		// receive event from flash
		eventName = eventName.toString().toLowerCase().replace(/^on/, '');
				
		// special behavior for certain events
		switch (eventName) {
			case 'load':
				// movie claims it is ready, but in IE this isn't always the case...
				// bug fix: Cannot extend EMBED DOM elements in Firefox, must use traditional function
				this.movie = document.getElementById(this.movieId);
				if (!this.movie) {
					var self = this;
					setTimeout( function() { self.receiveEvent('load', null); }, 1 );
					return;
				}
				
				// firefox on pc needs a "kick" in order to set these in certain cases
				if (!this.ready && navigator.userAgent.match(/Firefox/) && navigator.userAgent.match(/Windows/)) {
					var self = this;
					setTimeout( function() { self.receiveEvent('load', null); }, 100 );
					this.ready = true;
					return;
				}
				
				this.ready = true;
				this.movie.setText( this.clipText );
				this.movie.setHandCursor( this.handCursorEnabled );
				break;
			
			case 'mouseover':
				if (this.domElement && this.cssEffects) {
					this.domElement.addClass('hover');
					if (this.recoverActive) this.domElement.addClass('active');
				}
				break;
			
			case 'mouseout':
				if (this.domElement && this.cssEffects) {
					this.recoverActive = false;
					if (this.domElement.hasClass('active')) {
						this.domElement.removeClass('active');
						this.recoverActive = true;
					}
					this.domElement.removeClass('hover');
				}
				break;
			
			case 'mousedown':
				if (this.domElement && this.cssEffects) {
					this.domElement.addClass('active');
				}
				break;
			
			case 'mouseup':
				if (this.domElement && this.cssEffects) {
					this.domElement.removeClass('active');
					this.recoverActive = false;
				}
				break;
		} // switch eventName
		
		if (this.handlers[eventName]) {
			for (var idx = 0, len = this.handlers[eventName].length; idx < len; idx++) {
				var func = this.handlers[eventName][idx];
			
				if (typeof(func) == 'function') {
					// actual function reference
					func(this, args);
				}
				else if ((typeof(func) == 'object') && (func.length == 2)) {
					// PHP style object + method, i.e. [myObject, 'myMethod']
					func[0][ func[1] ](this, args);
				}
				else if (typeof(func) == 'string') {
					// name of function
					window[func](this, args);
				}
			} // foreach event handler defined
		} // user defined handler for event
	}
	
};

//090703 ezsharp 추가 : top / 테마동영상 view
var displayRolling=function(cid,count,interval,n) {
	this.cid = cid;
	this.count = count;	
	this.n = (n)?n:"1";
	this.onchange = null;

	for(var k=1; k<=this.count; k++) daum.$(this.cid+"_"+k).style.display="none";
	daum.$(this.cid+"_"+this.n).style.display="block";

	this.div = daum.$(this.cid);
	this.div.onmouseover=function(){this.isover=true; }
	this.div.onmouseout=function() {this.isover=false;}
	this.btn_next = daum.$("btn_"+this.cid+"_next");
	this.btn_prev = daum.$("btn_"+this.cid+"_prev");

	var self=this;
	if(this.btn_next) this.btn_next.onclick=function(){self.next() }
	if(this.btn_prev) this.btn_prev.onclick=function(){self.prev() }
	if(interval>0) setInterval(function(){self.play()}, interval);
}
displayRolling.prototype = {
	play : function() {
		if(this.div.isover) return;
		this.next();
	},
	change :function(){
		if(this.onchange) this.onchange();
	},
	prev :function(){
		daum.$(this.cid+"_"+this.n).style.display="none";
		this.n=(this.n==1)?this.count:--this.n;
		daum.$(this.cid+"_"+this.n).style.display="block";
		this.change();
	},
	next :function(){
		daum.$(this.cid+"_"+this.n).style.display="none";
		this.n=(this.n==this.count)? 1:++this.n;
		daum.$(this.cid+"_"+this.n).style.display="block";
		this.change();
	},
	random : function() {
		var rn=Math.round((this.count-1)*Math.random());
		for(var i=0;i<rn;i++) this.next();
	}
};

//090705 ezsharp 추가 : left 활성화
var currentMenuId;
function setLeftMenu(id){
	
  if(id && $(id)){
    var obj = daum.Element.getFirstChild($(id));
    daum.Element.addClassName(obj,"on");
  }
}

var tiaraTrackerFrame = function(){
	var iframe1 = document.getElementById("tiara1");
	(arguments.length > 0) ? url = arguments[0] :  url = "kids.daum.net";
		iframe1.src = url;
}

var  kidsTiaraTracker = function(url){
	try {
		if (typeof __Tiara.__getTracker() != 'undefined') {
			__Tiara.__getTracker().__setTitle('kids');
			__Tiara.__getTracker().__setReferer(window.location.href);
			window.setTimeout('try { __Tiara.__getTracker().__trackPageview("'+url+'"); } catch(e) {}', 1);
		}
	} catch(e) { }
}

var  tiaraTracker = function(){
		var tiaraScript = document.createElement("script");
		tiaraScript.charset="UTF-8";
		tiaraScript.src = "http://track.tiara.daum.net/tracker/tiara.js";
		tiaraScript.type = "text/javascript";
		daum.$T("head")[0].appendChild(tiaraScript);

		var __pageTracker = {}; 
		if (typeof __Tiara != 'undefined' && typeof __Tiara.__getTracker != 'undefined') { 
			__pageTracker = __Tiara.__getTracker(); 
		} else { 
			__pageTracker.__trackPageview = function() {}; 
		} 
		window.setTimeout('try { __pageTracker.__trackPageview(); } catch(e) {}', 1); 
}

//popup tiara적용  ingpdw 090714

if(location.href.toLowerCase().indexOf("popup") != -1){
	//유아의 sound off
	parent.setSoundOff();
	//parent.soundOff = true;
	var soundOn = function(){
		parent.soundOff = false;
	}
	daum.Event.addEvent(window,"unload",soundOn);

	/*var tiaraTrackerPopUp = function(){
		tiaraTracker();
	}()*/
}

// popupFullOpen : resolutionChk
var resolutionChk = function (parObjId,flaUrl,flashVars){
	if(!parObjId || !screen.availWidth || !screen.availHeight)	return false;

	//플래시 호출 영역(div)
	var parObj = document.getElementById(parObjId);
	if(!parObj)	return false;

	//해상도에 맞게 플래시 기본사이즈 셋팅
	if(window.innerWidth || window.innerHeight){
		var flaWidth = parseInt(window.innerWidth);
		var flaHeight = parseInt(window.innerHeight) - 117;
	} else {/* IE availWidth, availHeight으로 대체 */
		var flaWidth = parseInt(screen.availWidth);
		var flaHeight = parseInt(screen.availHeight) - 117;
	}

	//해상도에 맞게 플래시 사이즈 조정
	if(flaWidth < flaHeight*4/3){
		flaHeight = flaWidth*3/4;
	} else {
		flaWidth = flaHeight*4/3;
	}

	//플래시 호출 영역(div) 사이즈 리셋
	if(window.innerHeight){
		parObj.style.height = parseInt(window.innerHeight) - 117;
	} else {
		parObj.style.height = parseInt(screen.availHeight) - 117;
	}

	//조정된 크기로 플래시 호출
	//daumFlash('http://image.kids.daum.net/play/swf/sample.swf','100%','100%','fullPopupFla');
		daum.showFlash(flaUrl,flaWidth,flaHeight,parObjId);
}


var resizeToFullPop = function(){
	//console.debug(screen.availWidth);
	//console.debug(screen.availHeight);
	daum.Browser.resizePop( parseInt(screen.availWidth), parseInt(screen.availHeight));
}

function getNavigatorType(){
           if(navigator.appName == "Microsoft Internet Explorer")
                     return 1;
           else if(navigator.appName == "Netscape")
                     return 2;
           else
                     return 0;
}

function setSelBox(event){
           var _event;
           switch (getNavigatorType()) {
                     case 1 : // IE
                                _event = window.event;
                                node = _event.srcElement;
                                nodeName = _event.srcElement.className;
                                break;
                     case 2 : // Netscape
                                _event = event;
                                node = _event.target;
                                nodeName = _event.target.className;
                                break;
                     default :
                                nodeName = "None";
                                break;
           }

           try{
                     document.getElementById("hFrame").contentWindow.eventHandlerBody(event);
           }catch(e){}
}

function setFocusQBox(event){
           var textbox;
           var _event;
           textbox = document.SearchService.q;
           switch(getNavigatorType()){
                     case 1 : // IE
                                _event = window.event;
                                node = _event.srcElement;
                                nodeName = _event.srcElement.nodeName;
                                break;
                     case 2 : // Netscape
                                _event = event;
                                node = _event.target;
                                nodeName = _event.target.nodeName;
                                break;
                     default :
                                nodeName = "None";
                                break;
           }
           key = _event.keyCode;

           if(!(nodeName=="INPUT"||nodeName=="SELECT"||nodeName=="TEXTAREA"||(_event.ctrlKey&&key!=86))){
                     if(key==8||(key>32&&key<41)||(key!=21&&key<32)||_event.altKey||key==91||key==92||_event.metaKey){
                     }else if(key==32){
                                if(_event.shiftKey){
                                          textbox.focus();
                                          textbox.style.imeMode ="active";
                                          textbox.select();
                                          _event.returnValue=false;
                                }
                     }else if(key == 21){
                                scrollTo(0,0);
                                textbox.focus();
                                textbox.style.imeMode ="active";
                                textbox.select();
                                _event.returnValue=false;
                     }else if(node!=textbox){
                                scrollTo(0,0);
                                textbox.focus();
                                textbox.style.imeMode ="inactive";
                                textbox.select();
                     }
           }

           try{
                     document.getElementById("hFrame").contentWindow.eventHandler(event);
           }catch(e){}
}

function SchSug_setcoor(){
	document.getElementById("set_sugicn").innerHTML = '<img src="http://imgsrc.search.daum-img.net/search_all/2008_new/ico_01.gif" width="7" height="4" style="cursor:pointer" id="sugicn" alt="">';
	document.getElementById("set_sugicnUP").innerHTML = '<img src="http://imgsrc.search.daum-img.net/search_all/2008_new/ico_02.gif" width="7" height="4" style="cursor:pointer" id="sugicnUP" alt="">';
}