try{document.domain='daum.net';}catch(e){};
try{document.execCommand("BackgroundImageCache",false,true);}catch(e){};
try{document.write('<div id="__tempContainer"></div>');}catch(e){};
var pageLoaded = false;
var _MSG_DEL = "삭제 하시겠습니까?\n";
var _MSG_LOGIN = "먼저 로그인 하셔야 합니다.\n로그인 페이지로 이동 하시겠습니까?\n";
var _MSG_LOGIN_ADULT = "성인 확인이 필요 합니다.\n로그인 페이지로 이동 하시겠습니까?\n";
var _MSG_IMSORRYBUTILUVU = 'Daum 다운로드 서비스는 윈도우즈 XP 이상,\n인터넷 익스플로러 6.0 이상에서만 정상 사용 가능합니다.\n'
var getPageLoaded = function() {
	return pageLoaded;
};
var UI={};
function $A(iterable) {
	if (!iterable) return [];
	var results=[];
	for (var i=0,length=iterable.length; i<length; i++)	results.push(iterable[i]);
	return results;
};
Object.extend=function(a, b){
  for (var property in b) a[property] = b[property];
  return a;
};
Function.prototype.bind = function() {
	var __method = this, args = $A(arguments), object = args.shift();
	return function() {
		return __method.apply(object, args.concat($A(arguments)));
	};
};
Function.prototype.bindAsEventListener = function() {
	var __method = this, args = $A(arguments), object = args.shift();
	return function(event) {
		return __method.apply(object, [event || window.event].concat(args));
	}
}
UI.$ = function(id) {if(typeof(id)!="object") return document.getElementById(id); else return id;};
UI.$C = function(node) { $C(node); };
UI.$T = function(node) { $T(node); };
function $C(node){return document.createElement(node);}
function $T(text){return document.createTextNode(text);}
UI.trim=function(s) {return s.replace(/(^\s*)|(\s*$)/g, "") };
UI.toggle=function(id) { UI.$(id).style.display=(UI.getStyle(UI.$(id),'display')=='none') ? 'block':'none' };
UI.show=function(id) {try{UI.$(id).style.display = 'block';}catch(e){}};
UI.hide=function(id) {try{UI.$(id).style.display = 'none';}catch(e){}};
UI.getEl=function(e){var E=UI.getE(e);return E.target || E.srcElement};
UI.getE=function(e){return e || window.event};
UI.random=function(min, max){ return Math.floor(Math.random() * (max - min + 1) + min) };
UI.setWindowTitle=function(str) { try {	document.title = str; }catch(e){} };
UI.getURL=function(){return document.location.href};
UI.go=function(url){document.location.href = url};
UI.smoothToggle=function(_id, _duration) {
	var obj = UI.$(_id);
	if(!obj || obj.status == 'tweening') {return false};
	var now = Date.now || function(){return new Date};
	var date, point, intVal;
	var duration = _duration || 400;
	var status = UI.getStyle(obj, 'display');
	var startOpa = (UI.getStyle(obj, 'display')=='none') ? 0 : 100;
	var endOpa = (startOpa==0) ? 100 : 0;
	var currentOpa = startOpa;
	var getTransition = function(p)	{
		if(startOpa==0) {
			return 1 - Math.sin(Math.acos(p));
		} else {
			return 1 - Math.sin((1 - p) * Math.PI / 2);
		}
	};
	var setOpacity = function() {
		date = date || now();
		point = (now() - date < duration) ? (now() - date)/duration : 1;
		if(point == 1) { window.clearInterval(intVal); obj.status = ''; };
		currentOpa = (endOpa - startOpa) * getTransition(point) + startOpa;
		UI.setOpacity(obj, currentOpa);
		if(currentOpa==0) {obj.style.display = 'none';} else {obj.style.display = 'block';};
	};
	obj.status = 'tweening';
	intVal = setInterval(setOpacity, 50);
};
UI.setBgPos=function(obj,pos){
	var bgPos=UI.getStyle(obj,"backgroundPosition").split(" ");
	if( pos.x )bgPos[0]=pos.x;
	if( pos.y )bgPos[1]=pos.y;
	obj.style.backgroundPosition=bgPos.join(" ");
};
UI.mouseOut=function(e, obj){
	var to = !!e.relatedTarget?e.relatedTarget:event.toElement;
	while(to) {
		if(to == obj) return false;
		to = to.parentNode;
	} return true;
	UI.stopEvent((e)?e:event);
};
UI.isNumber=function(form) {
	var input = form.value;
	var re = new RegExp("^[0-9]+$");
	if (Boolean(input.match(re))) return true;
	return false;
};
UI.addClassName = function(e, className){
	var e = UI.$(e);
	try {
		if (e.className.indexOf(className) == -1) {
			e.className += " " + className
		};
	} catch(e) {}
};
UI.replaceClassName = function(e, oldName, newName) {
	var e = UI.$(e);
	try {
		if(e.className.indexOf(e.className)!=-1) {
			e.className = e.className.replace(oldName,newName);
		}
	} catch(e) {}
};
UI.removeClassName = function(e, className) {
	var e = UI.$(e);
	try {
		if(e.className.indexOf(e.className)!=-1) {
			e.className = UI.trim(e.className.replace(className,""));
		}
	} catch(e) {}
};
UI.toggleClassName = function(e, className) {
	var e = UI.$(e);
	try {
		if(e.className.indexOf(className) == -1) {
			UI.addClassName(e, className);
		} else {
			UI.removeClassName(e, className);
		}
	} catch(e) {}
};
UI.debug = function(text) {
	if(!UI.$('__UI_DEBUG')) {
		debugCount = 0;
		var oDiv = $C('div');
		oDiv.id = '__UI_DEBUG';
		oDiv.style.position = 'absolute';
		oDiv.style.width = '100%';
		oDiv.style.height = '100px';
		oDiv.style.overflow = 'scroll';
		oDiv.style.border = '2px solid #ff9933';
		oDiv.style.backgroundColor = '#ffffff';
		oDiv.style.padding = '0 0 25px 0';
		oDiv.style.zIndex = 99999;
		UI.$('__tempContainer').appendChild(oDiv);
	}
	UI.$('__UI_DEBUG').innerHTML = (debugCount+=1) + ':' + text + '<br>' + UI.$('__UI_DEBUG').innerHTML;
};
UI.addEvent=function(object, type, listener) {
	if(object.addEventListener) {if(type=='mousewheel')type='DOMMouseScroll'; object.addEventListener(type, listener, false)}
	else { object.attachEvent("on"+type, listener); }
};
UI.delEvent=function(object, type, listener){
	if (object.removeEventListener) {if(type=='mousewheel')type='DOMMouseScroll'; object.removeEventListener(type, listener, false)}
	else object.detachEvent('on'+type, listener);
};
UI.stopEvent=function(event) {
	var e=event || window.event;
	if(e.preventDefault) {e.preventDefault(); e.stopPropagation(); }
	else {e.returnValue = false; e.cancelBubble = true;}
};
UI.getEventWheel=function(e){
	var delta=0;
	if(e.wheelDelta) delta=e.wheelDelta/120;
	else if(e.detail) delta=-e.detail/3;
	return delta;
};
UI.getBrowser=function(){
	var ua=navigator.userAgent.toLowerCase();
	var opera=/opera/.test(ua)
	UI._browser={
		ie:!opera && /msie/.test(ua),
		ie_ver: parseFloat(((ua.split('; '))[1].split(' '))[1]),
		opera:opera,
		ff:/firefox/.test(ua),
		gecko:/gecko/.test(ua)
	};
	return UI._browser;
};
UI.findParent=function(el, tagName, name) {
	var t = tagName.toLowerCase();
	var n = name.toLowerCase();
	var p = el;
	if(n!="") {
		do {
			if(p.nodeType != 1) { p = null; break; } else {	p = p.parentNode; }
		} while(!(p.nodeName.toLowerCase() == t && (p.className.toLowerCase() == n || p.id.toLowerCase() == n)))
	} else {
		do {
			if(p.nodeType != 1) { p = null; break; } else {	p = p.parentNode; }
		} while(p.nodeName.toLowerCase() != t)
	}
	return p;
};
UI.cleanNode=function(el){
    var child = el.firstChild;
    while (child){
        var nextNode = child.nextSibling;
        if (child.nodeType == 3 && !/\S/.test(child.nodeValue)){ el.removeChild(child); }
        child = nextNode;
    }
    return el;
};
UI.resizeIframe=function(iframe_id) {
	var h = (self.innerHeight) ? document.documentElement.offsetHeight : document.body.scrollHeight;
	try{parent.UI.$(iframe_id).style.height = h+"px";}catch(e){}
};
UI.rollOver=function(s) {
	var img=(typeof(s)=="string") ? img=UI.$(s):s;
	img.onmouseover=function() { UI.rollOver.over(img) }
	img.onmouseout=function() { UI.rollOver.out(img) }
};
UI.rollOver.over=function(img){ var src=img.src; img.src=src.replace("_off.","_on."); };
UI.rollOver.out=function(img){ var src=img.src; img.src=src.replace("_on.","_off."); };
UI.popUp=function(url,name,w,h,scroll,resize,status,center){
	if(!scroll) scroll=0;
	if(!resize) resize=0;
	if(!status) status=1;
	if(center)
	{
		var x = (screen.width - w) / 2;
		var y = (screen.height - h) / 2;
		center = ",top="+y+",left="+x;
	}
	return window.open(url,name,"width="+w+",height="+h+",status="+status+",resizable="+resize+",scrollbars="+scroll+center+"location=0");
};
UI.setCookie=function(name, value, expires, path, domain, secure){
	if(expires)//day로 설정
	{
		var d=new Date(); d.setDate(d.getDate()+expires);
		expires = d.toGMTString();
	}
	document.cookie = name + "=" + escape(value) +
	  ((expires) ? "; expires=" + expires : "") +
	  ((path) ? "; path=" + path : "") +
	  ((domain) ? "; domain=" + domain : "") +
	  ((secure) ? "; secure" : "");
};
UI.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 "";
};
UI.embedSWF=function(f,w,h,options){
	var param={	id:"UIswf_"+f,quality:'high',bgcolor:'#ffffff',allowScriptAccess:'sameDomain',allowFullScreen:'true'}
	Object.extend(param, options);

	var id='id="'+param.id+'"';
	var name = 'name="'+param.id+'"';
	var p='',e='';

	for(i in param)
	{
		if(i=='id')continue;
		p+='<param name="'+i+'" value="'+param[i]+'">\n';
		e+=i+'="'+param[i]+'" ';
	}
	var s='<object '+id+' width="'+w+'" height="'+h+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0">';
	s+='<param name="movie" value="'+f+'">'+ p;
	s+='<embed '+name+' src="'+f+'" width="'+w+'" height="'+h+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" '+e+'/>';
	s+='</object>';
	if(param.containerId) {
		UI.$(param.containerId).innerHTML = s;
	} else {
		document.write(s);
	}
	return s;
};
UI.embedWMP=function(f,w,h,options){
	var param={	id:"UIwmp_"+f,autostart:'0',showstatusbar:'-1',transparentatstart:'1',displaybackcolor:'0',uimode:'full'}
	Object.extend(param, options);

	var id='id="'+param.id+'" name="'+param.id+'"';
	var p='',e='';
	for(i in param)
	{
		if(i=='id')continue;
		p+='<param name="'+i+'" value="'+param[i]+'">\n';
		e+=i+'="'+param[i]+'" ';
	}
	var s='<object '+id+' width="'+w+'" height="'+h+'" classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject" style="filter:gray();">';
	s+='<param name="filename" value="'+f+'">'+ p;
	s+='<embed '+id+' src="'+f+'" width="'+w+'" height="'+h+'" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows/mediaplayer/" '+e+' />';
	s+='</object>';
	document.write(s);
};
UI.getStyle=function(el, style) {
	var value = el.style[style];
	if(!value)
	{
		if(document.defaultView && document.defaultView.getComputedStyle && !UI.getBrowser().opera)
		{
			var css = document.defaultView.getComputedStyle(el, null);
			value = css ? css[style] : null;
		}
		else if (el.currentStyle) value = el.currentStyle[style];
	}
	return value == 'auto' ? null : value;
};
UI.getPosition=function(el)
{
	var left=0,top=0;
	while(el)
	{
		left+=el.offsetLeft || 0;
		top+=el.offsetTop || 0;
		el=el.offsetParent;
	}
	return {'x': left, 'y': top}
};
UI.getScroll=function () {
	if(document.all && typeof document.body.scrollTop != "undefined")
	{
		var cont=document.compatMode!="CSS1Compat"?document.body:document.documentElement;
		return {left:cont.scrollLeft, top:cont.scrollTop, width:cont.clientWidth, height:cont.clientHeight}
	}
	else
		return {left:window.pageXOffset, top:window.pageYOffset, width:window.innerWidth, height:window.innerHeight}
};
UI.submit=function(f) {
	var form=UI.$(f)||document.forms[f];
	if(form.onsubmit && !form.onsubmit()) return;
	form.submit();
};
UI.focus=function(n) {
	var s=null;
	s = UI.$(n)||document.getElementsByName(n)[0];
	s.focus();
};
UI.$F=function(n) {
	var s=null;
	s = UI.$(n)||document.getElementsByName(n)[0];
	if(s!=undefined) {
		if(s.type=="checkbox")
		{
			var c=[];
			var r=document.getElementsByName(n);
			for(var i=0;i<r.length; i++) if(r[i].checked) c.push(r[i].value);
			return (c.length>0)?c:"";
		}
		else if(s.type=="radio")
		{
			var r=document.getElementsByName(n);
			for(var i=0;i<r.length; i++) if(r[i].checked) return r[i].value;
			return "";
		}

		return s.value;
	} else {
		return ;
	}
};
UI.length=function(str,len,tail){
	if(!tail) tail="";
	var l=0, c=0, l2=0, u="", s="";
	if(len>0) l2=len;
	for(var i=0;u=str.charCodeAt(i);i++)
	{
		if (u>127) l+=2;
		else l++;
		if(l2) {
			s+=str.charAt(i);
			if(l>=l2)
			{
				if(l>l2) s=s.slice(0,-1);
				return s+tail;
			}
		}
	}
	return l2 ? s:l;
};
UI.html2str=function(s,m){
	var s1=["&amp;","&#39;","&quot;","&lt;","&gt;"];
	var s2=["&","'","\"","<",">"];
	var s3=[];
	if(m) {s3=s1;s1=s2;s2=s3;}
	for(var i in s1) s=s.replace(new RegExp(s1[i],"g"), s2[i]);
	return s;
};
UI.setOpacity=function(el,value){
	el.style.filter="alpha(opacity="+value+")";
	el.style.opacity=(value/100);
	el.style.MozOpacity=(value/100);
	el.style.KhtmlOpacity=(value/100);
};
UI.indexOf=function(arr,s){
	for(var i=0;i<arr.length; i++) if(arr[i]==s) return i;
	return -1;
};
UI.resizeImage=function(img,w,h){
	var t = new Image();
	t.src=img.src;
	if(t.width==0 || t.height==0) return;
	if(t.width>w || t.height >h)
	{
		img.width=w;img.height=h;
		if((t.width/w) > (t.height/h) )	img.height=Math.round(t.height * (w / t.width));
		else img.width = Math.round(t.width *  (h / t.height));
	}
	else
	{
		img.width=t.width;
		img.height=t.height;
	}
	if(img.width==0 || img.height==0) setTimeout(function(){UI.resizeImage(img,w,h)},500);
};
UI.StringBuffer=function(){this.buffer=new Array()}
UI.StringBuffer.prototype={append:function(s){this.buffer.push(s)},toString:function(){return this.buffer.join("")}};
UI.parseQuery=function(s){
	var str=s||location.search.substr(1);
	var r={},t=[];
	var a=str.split('&');
	for(var i=0;i<a.length;i++){t=a[i].split("=");r[t[0]] = t[1];}
	return r;
};
UI.addComma=function(s){
	s+='';
	var re = new RegExp('(-?[0-9]+)([0-9]{3})');
	while(re.test(s)) s = s.replace(re, '$1,$2');
	return s;
};
/*
2007-07-10

2007-10-10
기능개선
2007-12-04
form으로 value안넘어가는 문제해결 (input 명 중복)
2007-12-11
print() html string 변수 선언 수정

2008-01-17
전체적인 소스변경 (키보드 조작가능,접근성 강화)
*/
UI.Select = function(id,skin){
	this.skin={
		topbox:'border:1px solid #808080;width:200px;',
		subbox:'border:1px solid #808080;width:200px;background-color:#fff',
		default_txt:'color:#000;background-color:#fff;',
		selected_txt:'color:#fff;background-color:#446688;',
		arrow:'<img src="http://img-section.hanmail.net/sports2/arrow_select02.gif" width="15" height="14" border="0">',
		padding:2
	};
	Object.extend(this.skin, skin);

	this.input=UI.$(id);
	this.length=this.input.length;
	this.id=id;
	this.list=[];
	this.isopen=0;
	this.selectedIndex=0;
	this.prevSelectedIndex=0;
	this.moveSelectedIndex=0;//keydown
	this.value='';
	this.topBox= null;
	this.subBox= null;
	this.selBox= null;

	this.print();
};
UI.Select.prototype={
	close:function(){
		if(!this.isopen) return;
		this.subBox.style.display='none';
		this.isopen=0;
		this.focus();
	},
	blur:function(){
		this.selBox.className='default_txt';
	},
	focus:function(){
		if(this.isopen) return;
		this.selBox.className='selected_txt';
	},
	open:function(){
		if(this.isopen) return;
		if(UI.Select._openObj)
		{
			UI.Select._openObj.close();
			UI.Select._openObj.blur();
		}
		this.subBox.style.display='block';
		this.blur();
		this.subBox.getElementsByTagName('DIV')[this.selectedIndex].className='selected_txt';
		this.moveSelectedIndex=this.selectedIndex;
		UI.Select._openObj=this;
		this.isopen=1;
	},
	toogle:function(e){
		if(this.isopen)	this.close();
		else this.open();
		UI.stopEvent(e);
	},
	subOver:function(e){
		this.el=UI.getEl(e)
		this.subBox.getElementsByTagName('DIV')[this.selectedIndex].className='default_txt';
		this.el.className='selected_txt';
	},
	subOut:function(e){
		this.el=UI.getEl(e)
		this.el.className='default_txt';
	},
	onchange:function(){
		if(this.prevSelectedIndex != this.selectedIndex && this.input.onchange)
		{
			this.input.onchange.call(this);
		}
	},
	selected:function(isChange){
		this.value=this.list[this.selectedIndex].value;
		this.selBox.value=this.list[this.selectedIndex].text;
		UI.$(this.id).value=this.list[this.selectedIndex].value; //select input
		if(isChange) this.onchange();
		this.prevSelectedIndex=this.selectedIndex;
	},
	subClick:function(e){
		this.el=UI.getEl(e);
		this.selectedIndex=this.el.index;
		this.selected(true);
		this.close();
		UI.stopEvent(e);
	},
	keyMove:function(e){
		var e=UI.getE(e);
		var prev_index=-1;
		if(e.keyCode==38 && this.selectedIndex>0)
		{
			prev_index=this.selectedIndex--;
			UI.stopEvent(e);
		}
		else if(e.keyCode==40 && this.selectedIndex < this.length-1)
		{
			prev_index=this.selectedIndex++;
			UI.stopEvent(e);
		}
		else if(e.keyCode==13)
		{
			this.close();
			if(this.moveSelectedIndex != this.selectedIndex && this.input.onchange) this.input.onchange.call(this);
			this.moveSelectedIndex=this.selectedIndex;
		}
		if(prev_index>-1)
		{
			this.subBox.getElementsByTagName('DIV')[prev_index].className='default_txt';
			this.subBox.getElementsByTagName('DIV')[this.selectedIndex].className='selected_txt';
			this.selected((this.isopen) ? false:true);
		}
	},
	print:function(){
		var id=this.id;
		var opt=this.input.options;
		var sb = new UI.StringBuffer();
		for(var i=0; i<opt.length; i++)
		{
			this.list[i]={text:opt[i].text,value:opt[i].value};
			sb.append('<div style="width:100%;padding:'+this.skin.padding+'px">'+opt[i].text+'</div>');
		}
		this.value=this.list[0].value;

		var s='<style type="text/css">input.default_txt,div.default_txt{'+this.skin.default_txt+'} input.selected_txt,div.selected_txt{'+this.skin.selected_txt+'}</style>'
		+'<div id="UISelectTop_'+id+'" style="position:relative;'+this.skin.topbox+'">'
			+'<input class="default_txt" id="UISelectSel_'+id+'" type="text" value="'+this.list[0].text+'" style="width:100%;border:none;margin:0;padding:'+this.skin.padding+'px" readonly="readonly">'
			+'<div style="position:absolute;right:0;top:0">'+this.skin.arrow+'</div>'
		+'</div>'
		+'<div id="UISelectSub_'+id+'" style="display:none;position:absolute;'+this.skin.subbox+'">'+sb.toString()+'</div>';

		this.input.style.display='none';
		document.write(s);

		this.topBox= UI.$('UISelectTop_'+id);
		this.subBox= UI.$('UISelectSub_'+id);
		this.selBox= UI.$('UISelectSel_'+id);

		var self=this;
		UI.addEvent(this.topBox, "mousedown", function(e) { self.toogle(e) } );
		UI.addEvent(this.topBox, "keydown", function(e) {self.keyMove(e)});

		UI.addEvent(this.selBox, "blur", function() { self.close(); self.blur(); });
		UI.addEvent(this.selBox, "focus", function() { self.focus(); });
		UI.addEvent(document, "mousedown", function() { self.close();self.blur(); } );

		UI.addEvent(this.subBox, "mousedown", function(e) { UI.stopEvent(e) } );
		var sub=this.subBox.getElementsByTagName('div');
		for(var i=0; i<sub.length; i++)
		{
			sub[i].index=i;
			UI.addEvent(sub[i], "mouseover", function(e) { self.subOver(e) } );
			UI.addEvent(sub[i], "mouseout",  function(e) { self.subOut(e) } );
			UI.addEvent(sub[i], "mousedown", function(e) { self.subClick(e) } );
		}
	}
};
// option
UI.initOption=function(obj){obj.length=0;};
UI.createOption=function(text,value){
	var objOpt=document.createElement("OPTION"); // create object
	objOpt.text=text; // Text(Keyword)
	objOpt.value=value; // Value
	return objOpt;
};
UI.addOption=function(selectObj,keyword,value){
	if(selectObj==null)return;
	// add option
	var option = UI.createOption(keyword ,value);
	selectObj.options.add(option);
	return option;
};
/* thanks for music */
UI.TabStatic=function(_id,_opts){
	var obj=UI.$(_id);
	if(!obj){return false;}
	var opts={
		index:0,
		elTag:"li",
		lnTag:"a",
		autoPos:true,
		autoBgPos:true,
		wt:0
	}
	Object.extend(opts,_opts);
	var list=obj.getElementsByTagName(opts.elTag);
	var width = 0;
	if( list.length==0 )return false;

	for ( var i=0,j=list.length; i<j; i++ ){
		var anc=list[i].getElementsByTagName(opts.lnTag)[0];
		var w=parseInt(UI.getStyle(anc,"width"));
		width+=w;
		if( isNaN(w) ) w=0;
		var val=(opts.wt*-1)+"px 100%";
		if( i==opts.index ){
			val=(opts.wt*-1)+"px 0%";
			anc.style.position="relative";
			anc.style.zIndex="99";
			anc.className += " on";
		};
		if( i>0 ){
			anc.style.marginLeft="-1px";
		};
		anc.style.backgroundPosition=val;
		anc.style.display="block";
		if( opts.autoPos == true ){
			opts.wt+=w-1;
		};
	};
	// IE6 Bug Fix
	if( UI.getBrowser().ie_ver==6 && parseInt(UI.getStyle(anc.parentNode.parentNode, "width")) < width ) {
		anc.parentNode.style.marginRight="-3px";
	};
};
UI.TabDynamic=function(_id,_opts){
	if(!UI.$(_id)) {
		return false;
	};
	this.opts={
		evtType:"click",// event type on active [focus,mouseover]
		btnId:"tabBtn_",
		bodyId:"tabBody_",
		index:0, //index
		focusBlur:false,
		mode:"img",//img|css
		disType:"block",
		autoPos:true,
		autoBgPos:true,
		wt:0,
		ptn:/((tab)[0-9]{1,2})(_on)*/ig // tab1,tab1_on,tab2,tab2_on ,...
	};
	Object.extend(this.opts,_opts);

	this.focusTab = null;
	this.cid=_id; // root container id
	this.index=null; // current list index
	this.keyword=[];
	this.init();
};
UI.TabDynamic.prototype = {
	init:function(){UI.addEvent(UI.$(this.cid),this.opts.evtType,this.action.bind(this));},
	addKey:function(name){this.keyword.push(name);},
	setIndex:function(val){this.index=val;},
	hiddenBody:function(){
		for( var i=0,j=this.keyword.length; i<j ; i++ ){
			var obj=UI.$(this.opts.bodyId+this.keyword[i]);
			if( obj )obj.style.display="none";
		}
	},
	render:function(){
		if( this.index==null ){
			if( this.opts.index == null ){
				this.index=this.keyword[0];
			} else if( isNaN( this.opts.index ) == true ){
				this.index=this.opts.index;
			} else {
				this.index=this.keyword[this.opts.index];
			}
		}
		this.resetPos();
		this.hiddenBody();
		this.on(this.index);
	},
	resetPos:function(){
		for( var i=0,j=this.keyword.length; i<j ; i++ ){
			var obj=UI.$(this.opts.btnId+this.keyword[i]);
			//UI.addEvent( obj, "focus", this.changeFocusIndex.bind( this, obj ));
			obj.href = "javascript:;";
			var w=parseInt(UI.getStyle(obj,"width"));
			if( isNaN(w) ) w=0;
			var val=(this.opts.wt*-1)+"px 100%";
			if( this.keyword[i]==this.index ){
				val=(this.opts.wt*-1)+"px 0%";
				//if( UI.getStyle(obj,"position") != "absolute" && UI.getStyle(obj,"position") != "relative" ){obj.style.position="relative";}
				obj.style.zIndex="10";
			} else {
				obj.style.zIndex="5";
			}
			if( i>0 ){

				//obj.style.marginLeft="-1px";
			}
			if( this.opts.autoBgPos==true ){obj.style.backgroundPosition=val;}
			if( this.opts.autoPos==true ){obj.style.top="0px";obj.style.left=this.opts.wt+"px";}
			obj.style.display=this.opts.disType;
			this.opts.wt+=w-1;
		}
	},
	action:function(evt) {
		var el = evt.target || evt.srcElement;
		var offsParent = el.offsParent;
		var offsDepth = 3;
		var isNothing = true;
		var trg = el;

		for ( var i=offsDepth; i>0 ; i-- ){
			if(trg.id.indexOf(this.opts.btnId)> -1) {
				var idx = trg.id.replace(this.opts.btnId, '');
				this.on(idx);
				isNothing = false;
				UI.stopEvent(evt);
				break;
			} else if ( trg == offsParent ){
				break;
			}
			trg = trg.parentNode;
		}
	},
	changeFocusIndex : function( obj ){
		if( this.focusTab ){
			this.focusTab.style.zIndex = 5;
		}
		obj.style.zIndex = 10;
		this.focusTab = obj;
	},
	on:function(index) {
		if(!UI.$(this.opts.btnId+index) || !UI.$(this.opts.bodyId+index)) {
			return false;
		}
		// set prev
		if (this.index==-1){
			return false;
		} else if (this.index != null){
			var preBtn = UI.$(this.opts.btnId+this.index);
			var preBody = UI.$(this.opts.bodyId+this.index);

			if( this.opts.mode=="img")UI.setBgPos(preBtn,{y:"bottom"});
			else if( this.opts.mode=="css")preBtn.className=preBtn.className.replace(this.opts.ptn,"$1");
			preBody.style.display="none";
			preBtn.style.zIndex="5";
			preBtn.className = preBtn.className.replace("tabOn","");
		}
		// set current
		var curBtn = UI.$(this.opts.btnId+index);
		var curBody = UI.$(this.opts.bodyId+index);
		if( this.opts.mode=="img")UI.setBgPos(curBtn,{y:"top"});
		else if( this.opts.mode=="css")curBtn.className=curBtn.className.replace(this.opts.ptn,"$1_on");
		curBody.style.display="block";
		curBtn.style.zIndex="10";
		curBtn.className += " tabOn";


		this.index = index;
		if (this.opts.focusBlur==true){
			curBtn.blur();
		}
	}
};
/**
2007-07-10

2007-09-10
CSS탭기능, 사용법 업그레이드

2007-12-26
*/
UI.Tab=function(cid,count,options){
	this.options={
		snum:1,					//시작번호
		event_type:'mouseover', //mouseover,click
		menu_type:'img',		//img,css
		class_over:'on',		//over 시 css
		onChange:null			//변경될때 이벤트
	}
	Object.extend(this.options, options);
	this.cid=cid;
	this.count=count;
	var menu;
	for(var i=1; i<=count; i++)
	{
		menu=UI.$("menu_"+cid+"_"+i);
		menu.n=i;
		menu.css=menu.className;
		var self=this;
		menu['on'+this.options.event_type]=function(){ self.on(this.n);return false; }
		if(this.options.event_type=="click"){menu['onfocus']=function(){ self.on(this.n); }}
	}
	this.on(this.options.snum);
}
UI.Tab.prototype = {
	on : function(n){
		this.n=n;
		var type=this.options.menu_type;
		for(var k=1; k<=this.count; k++)
		{
			UI.$("div_"+this.cid+"_"+k).style.display="none";
			if(type=='img')	UI.$("menu_"+this.cid+"_"+k).src=UI.$("menu_"+this.cid+"_"+k).src.replace("_on.","_off.");
			else UI.$("menu_"+this.cid+"_"+k).className=UI.$("menu_"+this.cid+"_"+k).css;

		}
		UI.$("div_"+this.cid+"_"+n).style.display="block";
		if(type=='img')	UI.$("menu_"+this.cid+"_"+n).src=UI.$("menu_"+this.cid+"_"+n).src.replace("_off.","_on.");
		else UI.$("menu_"+this.cid+"_"+n).className= UI.$("menu_"+this.cid+"_"+n).css +' '+this.options.class_over;
		if(this.options.onChange) this.options.onChange.call(this);
	}
};
// Scrolling from "JES UI.Move"
/* 2007-07-10 */
UI.Move=function(id) {
	this.id=id;
	this.div=UI.$(id);
	this.x= parseInt(UI.getStyle(this.div,'left'))||0;
	this.y= parseInt(UI.getStyle(this.div,'top'))||0;
};
UI.Move.prototype={
	slide:function(pos) {
		this.pos=pos;
		this.pos_n=0;
		this.speed=0.45;
		this.inteval=10;
		this.setPos();
		this.playing =true;
		var self=this;
		this.tid=setInterval(function(){self.play()},this.inteval);
	},
	play:function() {
		this.x += (this.x2-this.x)*this.speed;
		this.y += (this.y2-this.y)*this.speed;
		this.set(this.x,this.y);
		if(Math.round(this.x)==this.x2 && Math.round(this.y)==this.y2)
		{
			this.x=Math.round(this.x);
			this.y=Math.round(this.y);
			this.set(this.x,this.y);
			if(this.pos_n>=this.pos.length)	{this.playing=false; clearInterval(this.tid)}
			else this.setPos();
		}
	},
	setPos:function(){
		var arr=this.pos[this.pos_n].split(",");
		this.x2=arr[0];
		this.y2=arr[1];
		this.pos_n++;
	},
	set:function(x,y){
		this.div.style.left=x+"px";
		this.div.style.top=y+"px";
	}
};
/**
2007-09-18
*/
UI.Modal=function(url,options){
	if(!pageLoaded) { return false; }
	this.options={
		type:'image',
		alt:'',
		loading:false,
		opacity:30,
		width:0,height:0
	};
	Object.extend(this.options, options);
	var options=this.options;

	if(!UI.$('UIModalB')) UI.Modal.print();
	UI.setOpacity(UI.$('UIModalB'), options.opacity);
	UI.setOpacity(UI.$('UIModalBIframe'), 0);

	UI.Modal.setB();
	if(options.loading) UI.Modal.center(UI.$('UIModalL'));

	if(options.type=='image')
	{
		options.alt = '';
		UI.$('UIModalF').innerHTML = '<img id="UIModalImage" src="'+url+'" alt="'+options.alt+'" />';
		if(options.loading) UI.$('UIModalImage').style.display='none';
		var _cursor = 'http://img-contents.daum-img.net/movie/2008_home/photoview/zoomout2.cur';
		UI.setCursor(UI.$('UIModalImage'), 'url(' + _cursor + '), pointer');
		UI.addEvent(UI.$('UIModalImage'), 'load', UI.Modal.onload);
	}
	else if(options.type=='iframe')
	{
		UI.$('UIModalF').innerHTML = '<iframe name="UIModalIframe" id="UIModalIframe" src="'+url+'" '+options.status+'></iframe>';
		if(options.loading)
		{
			UI.$('UIModalIframe').style.display='none';
			UI.addEvent(UI.$('UIModalIframe'), 'load', UI.Modal.onload);
		}
		UI.Modal.center(UI.$('UIModalF'));
	}
	UI.Modal.self=this;
	UI.addEvent(UI.$('UIModalB'), 'click', UI.Modal.reset);
	if(options.type=='image') UI.addEvent(UI.$('UIModalImage'), 'click', UI.Modal.reset);
	UI.addEvent(window,'resize', UI.Modal.onresize);
	UI.addEvent(window,'scroll', UI.Modal.onscroll);
};
UI.Modal.self={};
UI.Modal.onload=function(){
	UI.$('UIModalL').style.display='none';
	var pos=UI.getScroll();
	UI.Modal.center(UI.$('UIModalF'));
	if(UI.Modal.self.options.type=='image')
	{
		UI.$('UIModalImage').style.display='block';
		if(UI.$('UIModalImage').width > pos.width) {
			UI.resizeImage(UI.$('UIModalImage'),pos.width,pos.height);
		}
	}
	else
	{
		UI.$('UIModalIframe').style.display='block';
	}
	UI.Modal.center(UI.$('UIModalF'));
};
UI.Modal.print=function(){
	// deemed layer size setting
	if (window.innerHeight && window.scrollMaxY) {
		this.UIModalB_height = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		this.UIModalB_height = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		this.UIModalB_height = document.body.offsetHeight;
	}
	var d=document.createElement('div');
	var s='';
	s+='<iframe style="z-index:99997;width:100%;height:'+this.UIModalB_height+';position:absolute;left:0;top:0;" name="UIModalBIframe" id="UIModalBIframe"></iframe><div id="UIModalB" style="z-index:99998;width:100%;height:'+this.UIModalB_height+'px;position:absolute;display:none;background-color:#000;"></div>';
	s+='<div id="UIModalF" style="z-index:99999;position:absolute;display:none;background-color:#fff;"></div>';
	s+='<div id="UIModalL" style="z-index:99999;display:none;position:absolute;border:2px solid gray;">로딩중..</div>';
	d.innerHTML=s;
	document.getElementsByTagName('body')[0].appendChild(d);
};
UI.Modal.setB=function(){
	var w=UI.$('UIModalB');
	w.style.top='0px';
	w.style.left='0px';
	w.style.display='block'
	UI.$('UIModalBIframe').style.display='block';
};
UI.Modal.center=function(el){
	el.style.display='block';
	var pos=UI.getScroll();
	el.style.left=pos.width/2-el.offsetWidth/2+pos.left+'px';
	el.style.top=pos.height/2-el.offsetHeight/2+pos.top+'px';
	if(UI.$('UIModalF').offsetTop < 0)el.style.top = 10+'px';
};
UI.Modal.reset=function(){
	UI.Modal.self=null;
	UI.$('UIModalF').innerHTML='';
	UI.$('UIModalB').style.display='none';
	UI.$('UIModalBIframe').style.display='none';
	UI.$('UIModalF').style.display='none';
	UI.$('UIModalL').style.display='none';
	UI.delEvent(window,'resize',UI.Modal.onresize);
	UI.delEvent(window,'scroll',UI.Modal.onscroll);
};
UI.Modal.onresize=function(){
	var pos=UI.getScroll();
	if(UI.Modal.self.options.type=='image') UI.resizeImage(UI.$('UIModalImage'),pos.width,pos.height);
	UI.Modal.center(UI.$('UIModalF'));
	UI.Modal.setB();
};
UI.Modal.onscroll=function(){
	//UI.Modal.onresize();
};
UI.smoothFocus=function(_id, _topMargin, _duration) {
	if(!!!UI.$(_id)) {return false};
	var iTopMargin = _topMargin || 0;
	var oCurrentNode = UI.$(_id);
	var now = Date.now || function(){return new Date};
	var date, point, intVal;
	var duration = _duration || 300;
	var iTop = 0;
	while(oCurrentNode.tagName!="BODY" && oCurrentNode.tagName!="HTML") {
		iTop+=oCurrentNode.offsetTop;
		oCurrentNode=oCurrentNode.offsetParent;
	};
	var startPosY = UI.getScroll().top;
	var endPosY = iTop - iTopMargin;
	var currentPosY = startPosY;
	var getTransition = function(p)	{ return 1 - Math.sin(Math.acos(p)); }
	var moveFocus = function() {
		date = date || now();
		point = (now() - date < duration) ? (now() - date)/duration : 1;
		if(point == 1) { window.clearInterval(intVal); };
		currentPosY = (endPosY - startPosY)*getTransition(point)+startPosY;
		scrollTo(0, currentPosY);
	};
	intVal = setInterval(moveFocus, 20);
}
UI.smoothMove = function(id, distance, direction, duration) {
	var Layer = UI.$(id); // 이동시킬 element
	var dist = distance; // 이동거리 pixel
	var d = direction; // 이동방향
	var duration = duration * 1000; // 이동시간
	var now = Date.now || function(){return +new Date};
	var date, point, intVal;
	var startPosX = parseInt(UI.getStyle(Layer, 'left'))
	var endPosX = (d=='left') ? startPosX - dist : startPosX + dist;
	var currentPosX = startPosX;
	if(Layer.status == 'moving') { return false; }
	Layer.status = 'moving';
	Layer.style.left = currentPosX + 'px';
	var getTransition = function(p)	{
		return 1 - Math.sin((1 - p) * Math.PI / 2);
	};
	var moveLayer = function() {
		date = date || now();
		point = (now() - date < duration) ? (now() - date)/duration : 1;
		if(point == 1) { window.clearInterval(intVal); Layer.status = 'stop'};
		currentPosX = (endPosX - startPosX)*getTransition(point)+startPosX;
		Layer.style.left = currentPosX + 'px';
	};
	intVal = setInterval(moveLayer, 20);
}
function Paging(prefix, lpp, total, imgs) {
	var currentPage = 1;
	var rest = 0;
	document.getElementById(prefix+'Prev').onclick = function(addPage){paginate(-1);}
	document.getElementById(prefix+'Next').onclick = function(addPage){paginate(1);}

	var paginate = function(addPage) {
		var page = currentPage + addPage;
		rest = total - lpp * page;
		if (page < 1 || rest <= lpp * -1) {return;}
		for(var i=0;i<total;i++) {
			try {
				if((lpp * (page - 1) <= i && lpp * page > i )) {
					if(document.getElementById(prefix + '_img_' + (i + 1))) {
						if(document.getElementById(prefix + '_img_' + (i + 1)).src.indexOf('noimg_')>-1) {
							document.getElementById(prefix + '_img_' + (i + 1)).src = imgs[i];
						}
					}
					document.getElementById(prefix + '_slide_' + (i + 1)).style.display = 'block';
				} else {
					document.getElementById(prefix + '_slide_' + (i + 1)).style.display = 'none';
				}
			} catch(e){}
		}
		currentPage = page;
		setButton();
	}
	var setButton = function() {
		document.getElementById(prefix+'Prev').className = "on btn";
		document.getElementById(prefix+'Next').className = "on btn";

		if (currentPage == 1) {
			document.getElementById(prefix+'Prev').className = "off btn";
		}

		if (rest > lpp * -1 && rest <= 0) {
			document.getElementById(prefix+'Next').className = "off btn";
		}
	}
	paginate(0);
}
function SmoothPaging(prefix, lpp, datas, distance, duration) {
	var total = datas.length;
	var datas = datas;
	var currentPage = 1;
	var startIndex = (currentPage-1)*lpp;
	var endIndex = (currentPage-1)*lpp+lpp;
	var rest = 0;
	var direction = null;
	var distance = distance || 0;
	var duration = duration || 0.5;
	var Layer = UI.$(prefix+'Layer');
	Layer.status = 'stop';
	UI.addEvent(UI.$(prefix+'Prev'), 'click', function(){paginate(-1)});
	UI.addEvent(UI.$(prefix+'Next'), 'click', function(){paginate(1)});
	var paginate = function(addPage) {
		var page = currentPage + addPage;
		rest = total - lpp * page;
		if (page < 1 || rest <= lpp * -1) {return;}
		if(Layer.status == 'stop') {
			makeThumb(page);
			moving(page);
			currentPage = page;
			setButton();
		}
	};
	var makeThumb = function(page) {
		startIndex = (page-1)*lpp;
		endIndex = (total > (page-1)*lpp+lpp) ? (page-1)*lpp+lpp : total;
		var cont = UI.$(prefix+'Layer');
		var oSPAN = $C('SPAN');
		if(!UI.$(prefix+'_slide_'+startIndex)) {
			for(var i = startIndex ; i < endIndex ; i++) {
				var oLI = $C('LI');
				var oA = $C('A');
				var oIMG = $C('IMG');
				oLI.id = prefix + '_slide_'+i;
				oA.href = datas[i].link;
				oIMG.id = prefix + '_img_'+i;
				oIMG.onabort = function(img) {
					return function() {
					    this.src = img;
					};
				}(datas[i].img);
				oIMG.onerror = function(img) {
					return function() {
						this.src = img;
					};
				}(datas[i].img);
				oIMG.width = 93;
			    oIMG.height = 70;
				oIMG.src = datas[i].img;

				oA.appendChild(oIMG);
				if(!!datas[i].etc) {
					oA.innerHTML += datas[i].etc;
				}
				oLI.appendChild(oA);
				var setImage = (function(cont, oLI) {
			    	setTimeout(function() {
			    		cont.appendChild(oLI);
			    	},0);
			    })(cont, oLI)
			}
		};
	};
	var moving = function(page) {
		if((currentPage-page) != 0) {
			direction = ((currentPage-page) > 0) ? 'right' : 'left';
			if(!!direction) {
				UI.smoothMove(prefix+'Layer', distance, direction, duration)
			}
		}
	};
	var setButton = function() {
		var prevBtn = UI.$(prefix+'Prev');
		var nextBtn = UI.$(prefix+'Next');
		prevBtn.className = "prev on btn";
		nextBtn.className = "next on btn";

		if (currentPage == 1) {// 첫 page일 경우 prev를 disabled로
			prevBtn.className = "prev off btn";
		}

		if (rest > lpp * -1 && rest <= 0) { // 마지막 page일 경우
			nextBtn.className = "next off btn";
		}
	}
	paginate(0);
};
UI.tween={};
UI.tween.easeIn = function(p)	{
	return 1 - Math.sin(Math.acos(p));;
};
UI.tween.easeInOut = function(p)	{
	return 1 - Math.sin((1 - p) * Math.PI / 2);
};
/**
 *	슬라이드 네비게이션
 *	@param1	id		id
 *  @param2 cnt		전체개수
 *	@param3	start	시작번호(생략가능)
 *  @param4 term	자동 롤링(간격:초)
 */
var slideNavi = function(id, cnt, start, term) {
	this.id = id;
	this.max = cnt;
	this.start = (start == undefined || start < 1)?1:start;
	this.index = this.start;
	this.term = (term == undefined)?0:term*1000;
	this.play = true;
	this.prevIndex = 0;
	this.layers = new Array();
	this.layers.push(null);
	if(UI.$(this.id+"_btns")!=null) {
		this.btns = UI.$(this.id+"_btns").getElementsByTagName("img");
	}
	for (var i=1 ; i<=this.max ; i++) {
		this.layers.push(UI.$(this.id+"_"+i));
		if(i==this.index) {
			this.layers[i].style.display = "block";
		} else {
			this.layers[i].style.display = "none";
		}
		if(this.term!=0) {
			UI.addEvent(this.layers[i], "mouseover", function() {self.play = false;});
			UI.addEvent(this.layers[i], "mouseout", function() {self.play = true;});
		}
	}
	this.build();
	if(this.term!=0) {
		this.rolling = window.setInterval(function(){self.next()}, this.term);
	}
	var self = this;
}
slideNavi.prototype = {
	build : function() {
		if(this.prevIndex!=0) {
			this.layers[this.prevIndex].style.display = "none";
			try {
				this.btns[this.prevIndex-1].src=this.btns[this.prevIndex-1].src.replace("_on","_off");
			} catch(e) {}
		}
		this.layers[this.index].style.display = "block";
		try {
			this.btns[this.index-1].src=this.btns[this.index-1].src.replace("_off","_on");
		} catch(e) {}
		this.prevIndex = this.index;
	},
	next : function() {
		if(this.play) {
			this.index++;
			if(this.index > this.max) {
				this.index=1;
				this.build();
				//alert("마지막 입니다.");
			} else {
				this.build();
			}
		}
	},
	prev : function() {
		this.index--;
		if(this.index < 1) {
			this.index=this.max;
			this.build();
			//alert("처음 입니다.");
		} else {
			this.build();
		}
	},
	getIndex : function(i) {
		this.index=i;
		this.build();
	}
}

UI.ByteChecker=function(id,len){
	this.input = UI.$(id);
	this.isAlert=false;
	this.cid=id;
	this.len=len;
	var self=this;
	UI.addEvent(this.input,'keyup', function(){self.check()})
}
UI.ByteChecker.prototype={
	check:function(){
		var el=this.input;
		var len = UI.length(el.value);
		if(len > this.len && !this.isAlert)
		{
			this.isAlert=true;
			alert("최대 "+this.len+"Byte까지 가능합니다. 초과된 내용은 자동으로 삭제됩니다.");
			this.isAlert=false;
			//this.input.focus();
			el.value=UI.length(el.value, this.len);
			len=this.len;
		}
		UI.$(this.cid+"_byteinfo").innerHTML = len;
	}
}

function chk_searchForm() {
	var SearchKeyword = document.getElementById("SearchKeyword");
	if(SearchKeyword.value == "") {
		alert("검색어를 입력해 주세요.");
		return false;
	} else {
		gLink(null, "SBTM", "1", "1");
		//gUSRXLink(null,"SBTO","1","1","","","","","","","","",event);
		document.getElementById("GNB_searchForm").submit();
	}
}

/*
2007-07-10

2007-07-31
기능개선

2007-08-29
기본 method='GET' 으로 변경
*/
UI.Ajax = function(options) {
	this.options={
		method:'GET',
		param:'',
		onComplete:null,
		onError:null,
		asynchronous: true,
		contentType: 'application/x-www-form-urlencoded',
		encoding:'UTF-8'
	}
	Object.extend(this.options, options);
	if(this.options.url) this.send();
};
UI.Ajax.prototype={
	getReq:function(){
		var req=null;
		try { req = new XMLHttpRequest(); }
		catch(e)
		{
			try { req = new ActiveXObject("Msxml2.XMLHTTP"); }
			catch(e)
			{
				try { req = new ActiveXObject("Microsoft.XMLHTTP"); }
				catch(e) { }
			}
		}
		return req;
	},
	send:function(){
		this.req = this.getReq();
		var op=this.options;
		var url=op.url;
		var param=op.param;
		var method=op.method.toUpperCase();
		if(method=='GET' && param) url=url+"?"+param;
		this.req.open(method, url, op.asynchronous);
		this.req.setRequestHeader('Content-Type', op.contentType+';charset='+op.encoding);

		var self = this;
		this.req.onreadystatechange = function() { self.onStateChange.call(self) }
		this.req.send(method=='POST'?param:null);
	},
	onStateChange: function() {
		if(this.req.readyState==4)
		{
			if(this.req.status=="200") this.options.onComplete(this.req);
			else
			{
				if(this.options.onError) this.options.onError(this.req);
				else alert("서버에러입니다! 잠시후에 다시 시도하세요! "+this.req.status);
			}
		}
	}
};


/*
2007-07-10

2008-02-11
ie 버그수정, 기능개선
*/
UI.toolTip=function(event, options) {

	var e=event || window.event;
	var el= e.target || e.srcElement;

	el.options={
		className:'UItoolTip',
		mousemove:UI.toolTip.mousemove
	};
	Object.extend(el.options, options);

	if(!el.UItoolTip)
	{
		el.stitle = el.alt || el.title || el.stitle;
		el.title = el.alt = "";
		if(!el.stitle) return;

		var d = document.createElement("DIV");
		d.className = el.options.className;
		d.style.position="absolute";
		UI.$('JESToolTip').appendChild(d);

		el.UItoolTip=d;
		el.UItoolTip.innerHTML=el.stitle;
	}
	var scroll = UI.getScroll();
	var x = (e.clientX+scroll.left+10) + "px";
	var y = (e.clientY+scroll.top+10) + "px";
	el.UItoolTip.style.left = x;
	el.UItoolTip.style.top =  y;
	el.UItoolTip.style.visibility="visible";

	UI.addEvent(el,'mouseout',UI.toolTip.mouseout);
	if(el.options.mousemove) UI.addEvent(document, "mousemove", el.options.mousemove);
}

document.write('<div id="JESToolTip"></div>');
UI.toolTip.seq = 1;
UI.toolTip.mousemove=function(event){
	var e=event || window.event; var el= e.target || e.srcElement;
	var scroll = UI.getScroll();
	el.UItoolTip.style.left=(e.clientX+scroll.left)+"px";
	el.UItoolTip.style.top=(e.clientY+scroll.top+20)+"px";
};
UI.toolTip.mouseout=function(event){
	var e=event || window.event; var el= e.target || e.srcElement;
	if(!el.UItoolTip) return;
	el.UItoolTip.style.visibility="hidden";
	if(el.options.mousemove) UI.delEvent(document, "mousemove",  el.options.mousemove);
};
UI.DOMLoaded=function(init_func){
	if(document.addEventListener) {
		document.addEventListener("DOMContentLoaded", function(){eval(init_func);}, false);
	} else {
		document.write('<sc'+'ript id="__ie_onload" defer src="javascript:void(0)"></sc'+'ript>');
		var _script = document.getElementById("__ie_onload");
		_script.onreadystatechange = function() {
			if(this.readyState == "complete") { eval(init_func); }
		};
	}
};
UI.setCursor = function(obj, type) {
	obj.style.cursor = type;
};
/*
 * userReport
 *	@param1	url		report url
 */
function printUserReportBanner(type) {
	var strHtml = '<div class="daum_banner">';
	strHtml+='<img src="http://img-contents.daum-img.net/movie/2008_home/new_detail/r_bt_banner_1.gif" width="250" height="78" alt="" usemap="#daum_banner">';
	strHtml+='<map name="daum_banner">';
	strHtml+='<area shape="rect" coords="0,0,250,78" href="javascript:;" onClick="goUserReportBanner();" title="이 정보에 직접 참여">';
	strHtml+='</map>';
	strHtml+='</div>';
	if(type=="return") {
		return strHtml;
	} else {
		document.write(strHtml);
	}
}

function goUserReportBanner() {
	new UI.popUp('http://aggregate.movie.daum.net/user_db_reports?call_url='+document.URL,'popupReport',380,262,1,0,0,1);
}

function getBanner(size, type, opt) {
	var rand = Math.random().toString();
	var ordval = rand.substring(2,rand.length);
	var clintAgent = navigator.userAgent;
	var couple_ordval = ordval;
	var banner = new UI.StringBuffer();
	switch(size) {
		case 250 : {
			banner.append('<div id="EXTENSIBLE_BANNER_WRAP"><div id="EXTENSIBLE_BANNER"></div></div>');
			banner.append('<iframe src="http://amsv2.daum.net/ad/adview?secid=03L13" width="250" height="250" border="0" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" allowTransparency="true" id="AMS_250exp" title="배너 영역"></iframe>');
			banner.append('<div id="TAKEOVER"><script src="http://amsv2.daum.net/ad/adview?secid=03L16" type="text/javascript"></script></div>');
			break;
		}
		case 300 : {
			banner.append('<iframe src="http://amsv2.daum.net/ad/adview?secid=03L14" width="300" height="250" border="0" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" allowTransparency="true" id="AMS_300" title="배너 영역"></iframe>');
			banner.append('<div id="TAKEOVER"><script src="http://amsv2.daum.net/ad/adview?&secid=03L17" type="text/javascript"></script></div>');
			break;
		}
		case "moving" : {
			banner.append('<div class="DaumUI__banner">');
			if(!!banners.length) {
				var bannerNo = Math.floor(Math.random()*banners.length);
				bannerNo = (banners[bannerNo])?bannerNo:bannerNo-1;
				var target = (banners[bannerNo].link.indexOf('movie.daum.net') > -1) ? "_self" : "_blank";
				banner.append('<a href="'+banners[bannerNo].link+'" target="'+target+'"><img src="' + banners[bannerNo].img + '" border="0" alt=""></a>');
			} else {
				banner.append('<iframe src="http://amsv2.daum.net/ad/adview?secid=03L21" width="200" height="39" border="0" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"></iframe>');
			}
			banner.append('</div>');
			break;
		}
		case "countdown" : {
			banner.append('<iframe src="http://amsv2.daum.net/ad/adview?secid=03L19" width="168" height="18" border="0" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"></iframe>');
			break
		}
		case "right" : {
			banner.append('<iframe src="http://amsv2.daum.net/ad/adview?secid=03L20" width="130" height="250" border="0" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" allowTransparency="true" title=""></iframe>');
			break;
		}
		case "gmarket" : {
			(function() {
				var XMLURL = 'http://movie.daum.net/xml/shopping/banner.xml';				 
				var render = function(req) {					
					var datas = UI.cleanNode(req.responseXML.getElementsByTagName('data'));
					var len = datas.length;
					var getNodeValue = function (obj,tag) {
						return obj.getElementsByTagName(tag)[0].firstChild.nodeValue;
					};
					var getRandom = function(max) {
						return Math.floor(Math.random() * (max - 1 + 1) + 1)
					};
					var createBanner = (function() {
						var idx = getRandom(len)-1;						
						var HTML = '<a href="'+getNodeValue(datas[idx], 'linkurl')+'" target="_blank"><img src="'+getNodeValue(datas[idx], 'imgurl')+'"></a>';
						banner.append(HTML);
						if(type=="return") {							
							if( !!opt ){
								if( opt.callAfterFunc ){									
									opt.callAfterFunc( banner.toString() );
								}
							}
						} else {
							UI.$('gmarket_AD').innerHTML = banner.toString();
						}
					})();									
				};
				var ajax = new UI.Ajax( { url:XMLURL, onComplete:render } );
			})();
			break;
		}
		default : {break;}
	}
	if(type=="return") {
//		alert("11" + banner.toString());
		return banner.toString();
	} else {
		document.writeln(banner.toString());
	}
}
function extBannerOver() {
	UI.$('EXTENSIBLE_BANNER').style.overflow = 'visible';
}
function extBannerOut() {
	UI.$('EXTENSIBLE_BANNER').style.overflow = 'hidden';
}

function sethFrameUrl(event) {
	var hFrameSrc = UI.$("hFrame").src;
	var cate = UI.$F("SearchCategory");
	var clickCode = 1;
	switch(cate) {
		case "all" : {clickCode=1;break;}
		case "movie" : {clickCode=2;hFrameSrc = "http://suggest.movie.daum.net/movie/movie_title_script.html";break;}
		case "tv" : {clickCode=9;hFrameSrc = "http://suggest.movie.daum.net/movie/tv_title_script.html";break;}
		case "play" : {clickCode=10;hFrameSrc = "http://suggest.movie.daum.net/movie/play_title_script.html";break;}
		case "person" : {clickCode=3;hFrameSrc = "http://suggest.movie.daum.net/movie/movie_people_script.html";break;}
		case "photo" : {clickCode=4;break;}
		case "video" : {clickCode=5;break;}
		case "news" : {clickCode=6;break;}
		case "bbs" : {clickCode=7;break;}
		case "review" : {clickCode=8;break;}
		default : {hFrameSrc = "http://suggest.movie.daum.net/movie/movie_script.html";break;}
	}
	/* suggest_init & click_log */
	try {
		UI.$("hFrame").src = hFrameSrc;
		gUSRXLink(null,"SDTM","1",clickCode,"","","","","","","page_num","result_cnt",event);
	} catch(e) {}
}

UI.addEvent(window, "error", function() { pageLoaded=true; });
UI.addEvent(window, "load", function() { pageLoaded=true; });

/* click log */
var sec; var kw; var ks; var sss; var uco=0; var uda2; var usr4;
var URL="http://log.search.daum.net/cgi-bin/";
var etlImg=new Image();
var isFF = (navigator.appName.indexOf("Netscape") != -1);
if(isFF) document.captureEvents(Event.MOUSEMOVE);

function init(s,keyw,keys,ss){
	sec = s;
	var index = keyw.indexOf("%2F");
	if(index>0){
		kw = unescape(keyw);
	}else{
		kw = keyw;
	}
	ks = keys;
	sss = ss;
}
function cPosChk(e){
    var pos;
    x = (isFF) ? e.pageX : event.clientX + document.body.scrollLeft;
    y = (isFF) ? e.pageY : event.clientY + document.body.scrollTop;
    pos = x + "_" + y;
    return pos;
}
function openWin(u1,u2){
	var url = u1+"&uco="+(++uco)+u2+"&usr4="+usr4;
	etlImg.src = url;
	uda2 = null;
	return true;
}
function cU1(a,scope,r,p,ext){
	return URL+"s="+sec+"&a="+a+scope+"&q="+kw+"&k="+ks+"&r="+r+"&p="+p+"&ext="+ext;
}
function cU2(o,u1,u2,u3){
	var u = "NONE";
	if(o != null) u = o.href;
	if(uda2 != null) u2 = uda2;
	return "&usr1="+u1+"&usr2="+u2+"&usr3="+u3+"&t=D&u="+u;
}
function gLink(o,a,r,p) {
	var scope="&ss="+sss+"&as=";
	var u1=cU1(a,scope,r,p,""); var u2=cU2(o,"","","");
	return openWin(u1,u2);
}
function gExtraLink(o,a,ext){
	var scope = "&ss="+sss+"&as=";
	if(o != null) u = o.href;
	var u1 = cU1(a,scope,"","",ext);
	var u2 = cU2(o,"","","");
	return openWin(u1,u2);
}
function gUSRXLink(o,a,r,p,as,usr1,usr2,usr3,ext,ext1,ext2,ext4,e){
    if(o != null) var u = o.href;
    var pos = cPosChk(e);
    var fullUrl = URL + "s="+sec+"&a="+a+"&ss="+sss+"&as="+as+"&q="+kw+"&k="+ks+"&r="+r+"&p="+p+"&ext="+ext+"&uco="+(++uco)+"&usr1="+usr1+"&usr2="+usr2+"&usr3="+usr3+"&t=D&u="+u+"&usr4="+usr4+"&ext1="+ext1+"&ext2="+ext2+"&ext3="+pos+"&ext4="+ext4;
    etlImg.src = fullUrl;
    return true;
}
function gSetUSR4(v){
	usr4 = v;
}
function gUSRXLinkWrap(o, a, r, p){
	return gUSRXLink(o, a, r, p, '', '', '', '', '', '', '', '', '');
}
init("TM", "", "-1", "@@@");
/* click log */

/* 광고용 플래시 호출 스크립트 */
function AmsFlash(f,w,h,options){
	var param={id:"UIswf_"+f,quality:'high',bgcolor:'#ffffff',allowScriptAccess:'always',allowFullScreen:'true'}
	Object.extend(param, options);

	var id='id="'+param.id+'"';
	var name = 'name="'+param.id+'"';
	var p='',e='';

	for(i in param)
	{
		if(i=='id')continue;
		p+='<param name="'+i+'" value="'+param[i]+'">\n';
		e+=i+'="'+param[i]+'" ';
	}
	var s='<object '+id+' width="'+w+'" height="'+h+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0">';
	s+='<param name="movie" value="'+f+'">'+ p;
	s+='<embed '+name+' src="'+f+'" width="'+w+'" height="'+h+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" '+e+'/>';
	s+='</object>';
	if(param.containerId) {
		document.getElementById(param.containerId).innerHTML = s;
	} else {
		document.write(s);
	}
	return s;
}

function clickCheck(s) {
	try {
		var frame = UI.$('daumMovieDummyFrame');
		frame.src = 'about:blank';
		frame.src = 'http://movie.daum.net/_html/common/dummy.html?s='+s;
	} catch(e) {
		frame = $C('iframe');
		frame.id = 'daumMovieDummyFrame';
		frame.width = 0;
		frame.height = 0;
		frame.src = 'about:blank';
		frame.src = 'http://movie.daum.net/_html/common/dummy.html?s='+s;
		document.body.appendChild(frame);
	}
};
/*check login*/
UI.checkLogin = function(focus, location) {
	if(confirm(_MSG_LOGIN)){
		var loc = location || document.location;
		top.location = "http://www.daum.net/Mail-bin/login.html?url=" + escape(loc);
	}else{
		if (!!focus) {
			UI.$(focus).focus();
		}
		else {
			return false;
		}
	}
};
UI.checkLogin.adult = function(location) {
	if(confirm(_MSG_LOGIN_ADULT)){
		var loc = location || document.location;
		top.location = "http://www.daum.net/Mail-bin/login.html?url=" + escape(loc) + "&service=adult_service";
	}
};
/* include drag search */
(function() {
	try {		
		var URL = UI.getURL();
		var reg = new RegExp(/((view.html)|(tv|play)(.*detail.*)+main|(tv|play)(.*detail.*)+(description|castcrew|episode)|(moviedetail|movieperson)+(main|moviedetailStory|biography)|((\/)?read)).(do|\?)?/ig);
		if(Boolean(URL.match(reg))) {document.write('<sc'+'ript id="DragSearchJs" type="text/javascript" src="http://img.search.daum-img.net/front/js/searchDragSelection.js?nil_ch=movie" charset="euc-kr"></sc'+'ript>');}
	} catch(e) {}
})();
/* 포토뷰어용 navigation 나중에 viewer.js 로 따로 빼야함. */
UI.photoViewer = function(_photoId, _contId, _prevLink, _nextLink, _opts) {
	this.photoId = _photoId;
	this.photo = UI.$(this.photoId);
	this.contId = _contId;
	this.cont = UI.$(this.contId);
	this.prevPhotoLink = _prevLink || null;
	this.nextPhotoLink = _nextLink || null;
	this.isIE = UI.getBrowser().ie;
	this.direction;
	this.opts = {
		prevBtnId: 'prevPhoto',
		nextBtnId: 'nextPhoto',
		prevCursor: 'http://img-contents.daum-img.net/movie/2008_home/new_detail/cur/btn_prev.cur.ico',
		nextCursor: 'http://img-contents.daum-img.net/movie/2008_home/new_detail/cur/btn_next.cur.ico'
	};
	Object.extend(this.opts, _opts);
	UI.addEvent(this.photo, 'load', this.mousemoveHandler.bindAsEventListener(this));
	this.initialize();
};
UI.photoViewer.prototype = {
	initialize:function() {
		this.setLayer();
	},
	setImageCursor : function(obj, cursor, type) {
		var imgUrl = (this.direction=='prev') ? this.opts.prevCursor : this.opts.nextCursor;
		if(type=='not-allowed') {imgUrl = imgUrl.replace(/\.cur\.ico$/, '_no.cur.ico');};
		if(this.isIE) {	imgUrl = imgUrl.replace(/\.cur\.ico$/, '_ie.cur.ico');}
		var img = 'url(' + imgUrl + '), ' + type;
		var style = UI.getStyle(obj,'cursor') || 'dummy';
		if(style.indexOf(imgUrl) == -1) { UI.setCursor(obj, img); }
	},
	setLayer:function() {
		UI.addEvent(this.cont, 'click', this.clickHandler.bindAsEventListener(this));
		UI.addEvent(this.cont, 'mousemove', this.mousemoveHandler.bindAsEventListener(this));
	},
	getCurrentDirection:function(e, el) {
		var targetEl = UI.getEl(e);
		var varOffsetLeft = (targetEl != el) ? targetEl.offsetLeft : 0;
		var width = el.offsetWidth || this.cont.clientWidth;
		var offsetX = e.offsetX || e.layerX;
		return ((offsetX+varOffsetLeft) < parseInt(width/2)) ? 'prev' : 'next';
	},
	clickHandler:function() {
		var e = arguments[0];
		var link = (this.getCurrentDirection(e, this.cont) == 'prev') ? this.prevPhotoLink : this.nextPhotoLink;
		if(!!link) {
			location.href = link
		} else {
			if(this.direction=='prev') {
				alert('처음 사진 입니다.');
			} else {
				if(confirm('마지막 사진 입니다.\n처음 사진으로 돌아 가시겠습니까?')) {
					var URL = location.href.replace(/(photoId=)\d+/, '$1');
					URL = URL.replace(/(page=)\d+/i,'$11');
					UI.go(URL);
				}
			}
		}
		UI.stopEvent(e);
	},
	mousemoveHandler:function() {
		var e = arguments[0];
		var currentDirection = this.getCurrentDirection(e, this.cont);
		if(currentDirection == 'prev') {
			this.direction = 'prev';
			var link = this.prevPhotoLink;
			var cursor = this.opts.prevCursor;
			var type = 'w-resize';
		} else {
			this.direction = 'next';
			var link = this.nextPhotoLink;
			var cursor = this.opts.nextCursor;
			var type = 'e-resize';
		}
		if(!link) {
			type = 'not-allowed';
		}
		this.setImageCursor(this.cont, cursor, type);
	}
};
UI.blogRegPopup = function(type, id) {
	new UI.popUp('http://user.csm.daum.net/'+type+'/trackbacks/new/'+id,'blog_feed',380,262,1,0,0,0);
	this.setImageCursor(this.cont, cursor, type);
};
UI.resizePopup = function(id, center) {
	var baseElement = UI.$(id)
	var width = (!!window.innerWidth) ? window.innerWidth : document.getElementsByTagName('HTML')[0].clientWidth;
	var height = (!!window.innerHeight) ? window.innerHeight : document.getElementsByTagName('HTML')[0].clientHeight;
	var x = (screen.width - width) / 2;
	var y = (screen.height - (height+70)) / 2;
	width = baseElement.offsetWidth - width;
	height = baseElement.offsetHeight - height;
	window.resizeBy( width, height );
	if(width != 0) {
		setTimeout(UI.resizePopup.bind(this, id), 500);
	}
	self.moveTo(x, y);
	self.focus();
};
UI.blogRegPopup = function(type, id) {
	new UI.popUp('http://user.csm.daum.net/'+type+'/trackbacks/new/'+id,'blog_feed',380,262,1,0,0,1);
};
var openDownloader = function(itemId) {
	if(UI.getBrowser().ie) {
		UI.popUp('http://movie.daum.net/vod/download.do?itemId=' + itemId, 'downloader', 700, 600, 1, 0, 0, 1);
		//var Layer = new UI.Modal('http://movie.daum.net/vod/download.do?itemId=' + itemId,{type:'iframe',status:'width=700 height=600 frameborder=0 scrolling=no style=\'padding:0;\'' });return false;
	} else {
		alert(_MSG_IMSORRYBUTILUVU);
	}
	return false;
};

// 뉴스에서 섬네일 이미지가 깨졌을 경우 예외처리
UI.chkImgErr = function(id, tag, code){
	var errorHandler = function(e){
	    if(!e.target){ // ie
			e.target = e.srcElement;
		}
		e.target.src = code;
	};
	var container = UI.$(id);
	try{
		var eles = container.getElementsByTagName(tag);
		for(var i in eles){
			if(typeof eles[i] == 'object'){
		    	UI.addEvent(eles[i], "error", errorHandler);
			}
		}
	}catch(e){ }
};

// 특정 Element 하위에 있는 image 크기 width 조절 하는 스크립트
var resizeArticleImg = function(elementId, width) {
	var element = UI.$(elementId);
	var width = width || 559;
	var atcimg = element.getElementsByTagName("IMG");
	for ( var i = 0, len = atcimg.length; i < len; ++i) {
		if (parseInt(atcimg[i].width) > width || parseInt(atcimg[i].style.width) > width) {
			atcimg[i].style.width = width + 'px';
			atcimg[i].style.float = "none";
			atcimg[i].style.display = "block";
		}
	}
};

UI.Layer = function(_id, _contId, _opts) {
	try {
		this.id = _id;
		this.contId = _contId;	
		if (!!UI.$(this.contId)) {
			this.cont = UI.$(this.contId);
		}
		else {
			throw ("컨테이너를 찾을 수 없습니다.");
		}	
		this.contents = $T(_id + ' 레이어가 생성 되었습니다.');						
		this.opts = {		
			zIndex : 99999,
			top : this.cont.offsetHeight + 2,
			left : 0,
			padding : 0,
			width : 'auto',
			height : 'auto',		
			display : 'block',
			template : null
		};
		Object.extend(this.opts, _opts );
		this.oDiv = this.opts.template;
		this.init();
	} catch(e) {this.error(e)}
}
UI.Layer.prototype = {
	init : function() {
		if(this.oDiv==null) {
			this.oDiv = $C('DIV');
			this.oDiv.id = this.id;			
			this.oDiv.style.position = 'absolute';
			this.oDiv.style.border = '2px solid #e6e6e6';
			this.oDiv.style.borderLeft = 'none';
			this.oDiv.style.borderTop = 'none';
			this.oDiv.style.zIndex = this.opts.zIndex;			
			this.oDiv.style.backgroundColor = '#ffffff';
			this.oDiv.style.top = this.opts.top + 'px';
			this.oDiv.style.left = this.opts.left + 'px';
			this.oDiv.style.padding = this.opts.padding + 'px';			
			this.oDiv.style.width = this.opts.width + 'px';
			this.oDiv.style.height = this.opts.height + 'px';			
			this.oDiv.style.display = this.opts.display;
		}
	},
	render : function() {		
		if (!!this.contents) {
			if(typeof(this.contents)=='string')
				this.oDiv.innerHTML = this.contents;
			else if(typeof(this.contents)=='object') 
				this.oDiv.appendChild(this.contents);
			this.cont.appendChild(this.oDiv);			
		} else {
			throw('contents 오류. content는 HTML 또는 DOM 이어야 합니다.')
		}
	},
	addToggle : function(_obj, _opts) {
		var obj = _obj;
		var opts = {
			evtType : 'click',			
			display : 'none'
		}
		Object.extend(opts, _opts);
		this.oDiv.style.display = opts.display;
		if(!!UI.$(obj))obj = UI.$(obj);
		bToggle = this.toggle.bind(this);
		UI.addEvent(obj, opts.evtType, bToggle);
		bMouseout = this.mouseout.bindAsEventListener(this);
		UI.addEvent(this.oDiv, 'mouseout', bMouseout);
	},
	toggle : function() {
		this.oDiv.style.display = (this.oDiv.style.display != 'block') ? 'block' : 'none';
	},
	hide : function() {
		this.oDiv.style.display = 'none';
	},
	mouseout : function() {		
		if(UI.mouseOut(arguments[0], this.oDiv)) { this.oDiv.style.display = 'none'; }
	},
	error : function(e) {
		//alert(e);
		return false;
	}	
};
