var UI={
	_browser : null
};
Object.extend=function(a, b){
  for (var property in b) a[property] = b[property];
  return a;
};
//전역변수
var _uiDrag={};

UI.$=function(s) { return document.getElementById(s) };
UI.trim=function(s) {return s.replace(/(^\s*)|(\s*$)/g, "") };
UI.toogle=function(id) { UI.$(id).style.display=(UI.getStyle(UI.$(id),'display')=='none') ? 'block':'none' };
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.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.resizeIframe=function(iframe_id) {
	var h = (self.innerHeight) ? document.documentElement.offsetHeight : document.body.scrollHeight;
	try{parent.document.getElementById(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);
};
UI.setCookie=function(name,value,expires){
	var d = new Date();	var day="";
	if(expires)
	{
		d.setDate(d.getDate()+expires);
		day = "expires="+d.toGMTString()+";";
	}
	document.cookie = name+"="+escape(value)+"; path=/;domain=cartoon.media.daum.net;"+day;
};
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:'always'}
	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>';
	document.write(s);
	return s;
};
UI.embedWMP=function(f,w,h,options){
	var param={	id:"UIwmp_"+f,autostart:'1',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) 
		{
			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.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;
};
UI.length=function(str,len,tail){
	if(!tail) tail="";
	str=UI.html2str(str);
	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.substring(0,l2-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(){
	var r=[],t=[];
	var a=location.search.substr(1).split('&');
	for(i=0;i<a.length;i++){t=a[i].split("=");r[t[0]] = t[1];}
	return r;
};

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) }
	}
	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);
	}
};

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);
			}				
		}
	}
};
UI.Drag=function(drag, options){

	var el=UI.$(drag);
	el.options={
		handle:'',
		container:'',
		move_mode:'',	//1:horizontal 2,vertical
		limit_top:-1,
		limit_bottom:-1,
		limit_left:-1,
		limit_right:-1,
		onStart:null,
		onStop:null,
		onDrag:null
	}
	Object.extend(el, el.options);
	Object.extend(el, options);

	el.isdrag=true;
	el.width=0;el.height=0;
	el.area_width=0;el.area_height=0;
	
	UI.Drag.setXY(el);
	
	if(el.handle)
	{
		el.handle=UI.$(el.handle);
		el.isdrag=false;
		el.handle.isdrag=true;
		el.handle.target=el;
	}
	if(el.container)
	{
		UI.$(el.container).style.position="relative";
		el.width=parseInt(UI.getStyle(el,"width")) || el.offsetWidth;
		el.height=parseInt(UI.getStyle(el,"height")) || el.offsetHeight;
		el.area_width=parseInt(UI.getStyle(UI.$(el.container),"width")) || UI.$(el.container).offsetWidth;
		el.area_height=parseInt(UI.getStyle(UI.$(el.container),"height")) || UI.$(el.container).offsetHeight;	
	}
	this.obj=el;
};
UI.Drag.setXY=function(el){
	var pos=UI.getPosition(el);
	el.x=parseInt(UI.getStyle(el,"left"));
	el.y=parseInt(UI.getStyle(el,"top"));
	if(isNaN(el.x)) el.x=pos.x;
	if(isNaN(el.y)) el.y=pos.y;
};
UI.Drag.start=function(event){
	var e=event || window.event; var el=e.target || e.srcElement;
		
	if(el.sliderKnob) el=UI.$(el.sliderKnob);//UI.Slider
	if(!el.isdrag) return;
	if(el.target) el=el.target;
	
	_uiDrag.obj=el;
	UI.Drag.setXY(el);

	_uiDrag.gx = e.clientX;
	_uiDrag.gy = e.clientY;

	if(el.onStart) el.onStart.call(el);
	if(el.onStop) _uiDrag.onStop=el.onStop;
	if(el.onDrag) _uiDrag.onDrag=el.onDrag;
};
var _uiDrag={};	
UI.Drag.move=function(event){

	var drag=_uiDrag.obj;
	if(!drag) return;

	var e=event || window.event; var el=e.target || e.srcElement;
	var top =drag.y + e.clientY - _uiDrag.gy;
	var left=drag.x + e.clientX - _uiDrag.gx;

	if(drag.area_width && drag.area_height)
	{
		if(top<=0) top=0;
		else if(top >= drag.area_height-drag.height) top=drag.area_height-drag.height; 
		if(left<=0) left=0;
		else if(left >= drag.area_width-drag.width) left=drag.area_width-drag.width; 
	}
	if(drag.limit_top>-1 && top<drag.limit_top) top=drag.limit_top;
	if(drag.limit_bottom>-1 && top>drag.limit_bottom) top=drag.limit_bottom;
	if(drag.limit_left>-1 && left<drag.limit_left) left=drag.limit_left;
	if(drag.limit_right>-1 && left>drag.limit_right) left=drag.limit_right;
	
	if(!drag.move_mode || drag.move_mode==2) drag.style.top = top+"px";
	if(!drag.move_mode || drag.move_mode==1) drag.style.left = left+"px";	

	if(_uiDrag.onDrag) _uiDrag.onDrag.call(drag);
};
UI.Drag.end=function(event){
	if(_uiDrag.onStop) _uiDrag.onStop.call(_uiDrag.obj);
	_uiDrag.obj=null;	
	_uiDrag.onStop=null;
	_uiDrag.onDrag=null;
};


UI.addEvent(document, "mousedown", UI.Drag.start );
UI.addEvent(document, "mousemove", UI.Drag.move );
UI.addEvent(document, "mouseup", UI.Drag.end );

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.3;
		this.inteval = 20;
		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";
	}
};

UI.Rolling=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++) UI.$(this.cid+"_"+k).style.display="none";
	UI.$(this.cid+"_"+this.n).style.display="block";

	this.div = UI.$(this.cid);//전체div
	this.div.onmouseover=function(){this.isover=true; }
	this.div.onmouseout=function() {this.isover=false;}
	this.btn_next = UI.$("btn_"+this.cid+"_next");
	this.btn_prev = UI.$("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);
}
UI.Rolling.prototype = {
	play : function() {
		if(this.div.isover) return;
		this.next();
	},
	change :function(){
		if(this.onchange) this.onchange();
	},
	prev :function(){
		UI.$(this.cid+"_"+this.n).style.display="none";
		this.n=(this.n==1)?this.count:--this.n;
		UI.$(this.cid+"_"+this.n).style.display="block";
		this.change();
	},
	next :function(){
		UI.$(this.cid+"_"+this.n).style.display="none";
		this.n=(this.n==this.count)? 1:++this.n;
		UI.$(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();
	}
};

UI.yScrolling=function(cid, millisec1,millisec2, speed, height)
{
	this.cid= cid;
	this.millisec1 = millisec1;	//처음시작 텀
	this.millisec2 = millisec2; //실행 텀
	this.speed = speed;			//한번에 이동할 px
	this.height = height;
	
	this.h =0;
	this.div = UI.$(this.cid);
	this.htmltxt = this.div.innerHTML;
	this.div.innerHTML = this.htmltxt+this.htmltxt;
	this.div.isover=false;
	this.div.onmouseover=function(){ this.isover=true; }
	this.div.onmouseout=function(){	this.isover=false; }
	var self =this;
	window.setTimeout(function(){self.play()}, this.millisec1);
}
UI.yScrolling.prototype={
	play : function(){
		var self =this;
		if(!this.div.isover)
		{	
			this.div.scrollTop += this.speed;
			if(this.div.scrollTop >= this.div.scrollHeight/2) 
			{
				this.div.scrollTop=0;
				//this.h=0;
			}
			else(this.height)
			{
				this.h += this.speed;
				if(this.h>=this.height)
				{
					if(this.h>this.height)
					{
						this.div.scrollTop -= this.h % this.height;
						//window.status = this.div.scrollTop +" : "+this.h % this.height;
					}
					this.h=0;
					window.setTimeout(function(){self.play()}, this.millisec1);					
					return;
				}
			}
		}		
		window.setTimeout(function(){self.play()}, this.millisec2);
	}
};
UI.xScrolling=function(cid, millisec1,millisec2, speed)
{
	this.cid= cid;
	this.millisec1 = millisec1;	//처음시작 텀
	this.millisec2 = millisec2; //실행 텀
	this.speed = speed;			//한번에 이동할 px

	this.div = UI.$(this.cid);
	this.htmltxt = this.div.innerHTML;
	this.div.innerHTML = '<div style="white-space:nowrap">'+this.htmltxt+this.htmltxt+'<\/div>';
	this.div.isover=false;
	this.div.onmouseover=function(){ this.isover=true; }
	this.div.onmouseout=function(){	this.isover=false; }
	var self =this;
	window.setTimeout(function(){self.play()}, this.millisec1);
}
UI.xScrolling.prototype={
	play : function(){
		if(!this.div.isover)
		{	
			this.div.scrollLeft += this.speed;		
			if(this.div.scrollLeft > this.div.scrollWidth/2) this.div.scrollLeft =0;//원위치			
		}
		var self =this;
		window.setTimeout(function(){self.play()}, this.millisec2);
	}
};

UI.Slider=function(area,knob,options) {
	this.options={
		onSlide:null,
		onChange:null,
		max_value:100,
		move_value:5,
		value:0,
		wheel_area:'',	//마우스휠동작 감지영역
		mode:1			//1:horizontal 2,vertical
	}
	Object.extend(this.options, options);

	this.value=this.options.value;
	this.max_value=this.options.max_value;

	this.area=UI.$(area);
	this.knob=UI.$(knob);
	this.area.width=parseInt(UI.getStyle(this.area,"width"));
	this.area.height=parseInt(UI.getStyle(this.area,"height"));
	this.knob.width=parseInt(UI.getStyle(this.knob,"width"));
	this.knob.height=parseInt(UI.getStyle(this.knob,"height"));

	this.track_length = (this.options.mode==1) ? this.area.width-this.knob.width:this.area.height-this.knob.height;

	var self=this;
	this.drag=new UI.Drag(knob, {
		container:area,
		move_mode:this.mode,
		onDrag:function(){self.slide()},
		onStop:function(){self.change()}
	});
	
	this.area.sliderKnob=knob;
	UI.addEvent(this.area, "mousedown", function(event){ self.moveKnobClientXY.call(self,event) });
	UI.addEvent(this.area, 'mousewheel',function(event){ self.wheelScroll.call(self,event) });
	if(this.options.wheel_area)	UI.addEvent(UI.$(this.options.wheel_area), 'mousewheel',function(event){ self.wheelScroll.call(self,event) });

	if(this.value>0)
	{
		if(this.options.mode==1) this.knob.style.left=this.val2pos()+"px";
		else this.knob.style.top=this.val2pos()+"px";
	}
};

UI.Slider.prototype={
	pos2val:function() {
		var val=Math.floor( parseInt(this.getKnobPos()) * this.max_value / this.track_length);
		if(val<0) val=0;
		else if(val>this.max_value) val=this.max_value;
		this.value=val;
		return val;
	},
	val2pos:function(value) {
		if(!value) value=this.value;
		var pos=Math.floor( value * this.track_length / this.max_value);
		return pos;
	},
	getKnobPos:function(){
		return (this.options.mode==1) ? this.knob.style.left:this.knob.style.top;
	},
	setKnobPos:function(pos){
		if(this.options.mode==1) this.knob.style.left=pos+'px';
		else this.knob.style.top=pos+'px';
	},
	moveKnobClientXY:function(event){
		var e=event || window.event; var el=e.target || e.srcElement;
		var pos=0;
		var scroll = UI.getScroll();

		if(this.options.mode==1) 
		{
			pos=e.clientX-UI.getPosition(this.area).x+scroll.left-(this.knob.width/2);
			if(pos<0) pos=0;
			else if(pos>this.area.width-this.knob.width) pos=this.area.width-this.knob.width;
			this.setKnobPos(pos);
		}
		else
		{
			pos=e.clientY-UI.getPosition(this.area).y+scroll.top-(this.knob.height/2);
			if(pos<0) pos=0;
			else if(pos>this.area.height-this.knob.height) pos=this.area.height-this.knob.height;
			this.setKnobPos(pos);
		}
		this.change();
	},
	moveKnob:function(type,event){
		if(type=='up' && this.value<this.max_value)//value up
		{
			this.value+=this.options.move_value;
			if(this.value>this.max_value) this.value=this.max_value; 
			this.setKnobPos(this.val2pos());
			this.change();
			if(event)UI.stopEvent(event);
		}
		else if(type=='down' && this.value>0) //value down
		{
			this.value-=this.options.move_value;
			if(this.value<0) this.value=0; 
			this.setKnobPos(this.val2pos());
			this.change();
			if(event)UI.stopEvent(event);
		}	
	},
	wheelScroll:function(event){
		var delta=UI.getEventWheel(event);
		var type = (delta<0)? 'up':'down';
		this.moveKnob(type,event);
	},
	down:function(el){
		var self=this;
		self.moveKnob('down');
		UI.s_interval=setInterval( function(){self.moveKnob('down')}, 100);
		if(!el.isMouseup)
		{
			UI.addEvent(el, "mouseup",  function(){clearInterval(UI.s_interval)});
			UI.addEvent(el, "mouseout", function(){clearInterval(UI.s_interval)});
			el.isMouseup=true;
		}
	},
	up:function(el){
		var self=this;
		self.moveKnob('up');
		UI.s_interval=setInterval( function(){self.moveKnob('up')}, 100);
		if(!el.isMouseup)
		{
			UI.addEvent(el, "mouseup",  function(){clearInterval(UI.s_interval)});
			UI.addEvent(el, "mouseout", function(){clearInterval(UI.s_interval)});
			el.isMouseup=true;
		}
	},
	slide:function(){
		this.pos2val();
		if(this.options.onSlide) this.options.onSlide.call(this);
	},
	change:function(){
		this.pos2val();
		if(this.options.onChange) this.options.onChange.call(this);
	}
};
/* 현래 추가 */
function tab_sec(num) {
	var imgurl = "http://img-media.hanmail.net/media2/common/w_tab_sec";
	var obj = UI.$("img_section_tab")
	obj.src = imgurl + num + ".gif";
	
	for(var i=1;i<4;i++){
	
		if(num == i){
			UI.$("div_section_"+i).style.display = "block";
		}else{
			UI.$("div_section_"+i).style.display = "none";
		}
	}
}	

function DisplayMenu(id,index,loop) {
for (i=1; i<=loop; i++)				
	if (index == i) {
		thisMenu = document.getElementById(id + index);
		thisMenu.style.display = "block";
		//alert(index);
	} 
	else {
		otherMenu = document.getElementById(id + i);
		otherMenu.style.display = "none";
	}
}
function daum_paging_rollover(obj, img, type) {
	var imgurl = "http://img-section.hanmail.net/webtoon/board/";
	var tmp
	if (type == "on") {
		obj.src = imgurl + img + "_over.gif";
	} else {
		obj.src = imgurl + img + ".gif";
	}
}	

/* 080528_ezsharp 추가 */
urlParamValue = function(fullurl,findparam) {
  var fullfindparam="";
  var findparamvalue="";
  if(fullurl.indexOf(findparam) > 0) {
    temp1 = fullurl.substring(0,fullurl.indexOf(findparam))
    temp2 = fullurl.substring(fullurl.indexOf(findparam),fullurl.length)
    if(temp2.indexOf("&") == 0) {
      temp2 = temp2.substring(1,temp2.length);
    }

    fullfindparam = (temp2.indexOf("&") > 0)?temp2.substring(0,temp2.indexOf("&")):temp2.substring(0,temp2.length);
    findparamvalue = fullfindparam.replace(findparam+"=","");
  }
    return findparamvalue;
}

UI.HLtab=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) }
  }
  this.on(this.options.snum);
  }
  UI.HLtab.prototype = {
  on : function(n){
    this.n=n;
    var type=this.options.menu_type;
    for(var k=1; k<=this.count; k++)
    {
      UI.$(this.cid+"_"+k).className = "";
      UI.$("dpimg_" + this.cid+"_"+k).style.display = "none";
      UI.$("onbox_" + this.cid+"_"+k).style.display = "none";
      
    }
    UI.$(this.cid+"_"+this.n).className = "on";
    UI.$("dpimg_" + this.cid+"_"+this.n).style.display = "block";
    UI.$("onbox_" + this.cid+"_"+this.n).style.display = "block";
    if(this.options.onChange){ this.options.onChange.call(this); }
  }
  };