/* 
2007-07-10 

2007-07-11
rollOver ÇÔ¼ö ÀÌ¹ÌÁö¸í±ÔÄ¢ º¯°æ
2007-07-19
UI.toogle() ÇÔ¼ö ¼öÁ¤
2007-07-31
rollOver ÇÔ¼ö ¼Ò½º¼öÁ¤
Object.extend Ãß°¡
2007-08-03
UI.copyText »èÁ¦
2007-08-13
UI.getEl() UI.getE() ÇÔ¼öÃß°¡
UI.random() ÇÔ¼öÃß°¡
2007-08-14
UI.embedSWF(),UI.embedWMP()  optionsÀÎÀÚ ¼öÁ¤, id ÀÎÀÚ options·Î 

2007-09-03
UI.indexOf() Ãß°¡

2007-09-04
UI.embedSWF(),UI.embedWMP() ¹ö±×¼öÁ¤

2007-09-14
UI.resizeImage()Ãß°¡
2007-09-27
UI.StringBuffer() Ãß°¡
2007-10-11
UI.parseQuery() Ãß°¡
2007-11-19
addEvent(),delEvent() mousewheel DOMMouseScroll Ãß°¡
UI.getEventWheel() Ãß°¡

2007-11-26
UI.length() ¹ö±×¼öÁ¤ (¸Ç³¡±ÛÀÚ°¡ ÇÑ±ÛÀÏ°æ¿ì 1byte±æ°Ô Àß¸²¹®Á¦)

2007-12-10
UI.addComma() Ãß°¡

2007-12-11
UI._browser ±âº»¼Ó¼º »èÁ¦
UI.resizeIframe() ¼Ò½º°³¼±

2007-12-13
UI.length() ¹ö±×¼öÁ¤

2008-01-08
UI.setCookie() ¼öÁ¤
2008-02-21
UI.parseQuery ¼öÁ¤
*/

var UI={};
Object.extend=function(a, b){
  for (var property in b) a[property] = b[property];
  return a;
};

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.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);
};
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:'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="";
	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) } );
		}
	}
};
/**
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) }
	}
	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);
	}
};
/**
2007-09-18
*/
UI.Modal=function(url,options){
	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.Modal.setB();
	if(options.loading) UI.Modal.center(UI.$('UIModalL'));

	if(options.type=='image')
	{
		UI.$('UIModalF').innerHTML = '<img id="UIModalImage" src="'+url+'" alt="'+options.alt+'" />';
		if(options.loading) UI.$('UIModalImage').style.display='none';
		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);
	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';
		UI.resizeImage(UI.$('UIModalImage'),pos.width,pos.height);	
	}
	else 
	{
		UI.$('UIModalIframe').style.display='block';
	}
	UI.Modal.center(UI.$('UIModalF'));
};
UI.Modal.print=function(){
	var d=document.createElement('div');
	var s='';
	s+='<div id="UIModalB" style="z-index:99998;width:100%;height:100%;position:absolute;display:none;background-color:#000;"></div>';
	s+='<div id="UIModalF" style="z-index:99999;position:absolute;display:none;"></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');
	var pos=UI.getScroll();
	w.style.top=pos.top+'px';
	w.style.left=pos.left+'px';
	if(document.all)
	{
		w.style.width=pos.width+'px';
		w.style.height=pos.height+'px';
	}
	w.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';
};
UI.Modal.reset=function(){
	UI.Modal.self=null;
	UI.$('UIModalF').innerHTML='';
	UI.$('UIModalB').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();
};
/* 
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 */
UI.CheckBox = function()
{
	this.img_on = "img/checkbox_on.gif";
	this.img_off = "img/checkbox_off.gif";
	this.checkbox = {};
	var self=this;

	var chk=null,img=null;
	var cid="";
	for(var i=0; i<arguments.length; i++)
	{
		chk=UI.$(arguments[i]);
		cid=chk.id;
		if(!chk) continue;
		img=chk.parentNode.insertBefore(document.createElement('img'), chk);
		img.src = (chk.checked) ? this.img_on:this.img_off;
		
		img.cid = cid;
		img.onclick = function() {
			self.select(this.cid);
			if(self.checkbox[this.cid].chk.onclick) self.checkbox[this.cid].chk.onclick();
		};
		chk.style.display="none";
		//chk.style.position = "absolute";
		//chk.style.left = "-1000";
		this.checkbox[cid] = {chk:chk, img:img};
	}
};
UI.CheckBox.prototype={
	select : function(cid) {
		this.checkbox[cid].img.src = (this.checkbox[cid].chk.checked) ? this.img_off:this.img_on;
		this.checkbox[cid].chk.checked = !this.checkbox[cid].chk.checked;
	},
	showValue : function() {
		var value = new Array();
		var chk = null;
		for(cid in this.checkbox)
		{
			chk=this.checkbox[cid].chk;
			if(chk.checked) value[value.length]=chk.value; 
		}
		return value;
	},
	checked : function() {
		var cid="";
		if(arguments[0]=="all")
		{	
			for(cid in this.checkbox)this.checked(cid)	
			return;
		}		
		for(var i=0; i<arguments.length; i++)
		{
			cid = arguments[i];
			if(!this.checkbox[cid]) continue;
			this.checkbox[cid].img.src = this.img_on;
			this.checkbox[cid].chk.checked=true;
		}
	},
	unchecked : function() {
		var cid="";
		if(arguments[0]=="all")
		{	
			for(cid in this.checkbox) this.unchecked(cid)	
			return;
		}	
		for(var i=0; i<arguments.length; i++)
		{
			cid = arguments[i];
			if(!this.checkbox[cid]) continue;
			this.checkbox[cid].img.src = this.img_off;
			this.checkbox[cid].chk.checked=false;			
		}
	}
};
/* 
2007-07-10 

2007-07-11
move_mode ¼Ó¼ºÃß°¡ (ÁÂ¿ì,»óÇÏ ¹æÇâÀ¸·Î¸¸ ¿òÁ÷ÀÏ¼öÀÖ°Ô)
limit_top,limit_bottom,limit_left,limit_right ¼Ó¼ºÃß°¡
¼Ò½º°³¼±

2007-11-20
¼Ò½º°³¼±
*/
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;
};
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;
};

//Àü¿ªº¯¼ö
var _uiDrag={};
UI.addEvent(document, "mousedown", UI.Drag.start );
UI.addEvent(document, "mousemove", UI.Drag.move );
UI.addEvent(document, "mouseup", UI.Drag.end );
/* 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.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";
	}
};
/* 2007-07-10 */
UI.Radio = function(name)
{
	this.img_on = "img/radio_on.gif";
	this.img_off = "img/radio_off.gif";
	this.radio = {};
	this.checked_id = "";
	var self=this;

	var ra = null,img=null;
	var cid = "";
	for(var i=0; i<document.getElementsByName(name).length; i++)
	{
		ra = document.getElementsByName(name)[i];
		cid =ra.id;
		img=ra.parentNode.insertBefore(document.createElement('img'), ra);

		img.src = this.img_off;
		if(ra.checked)
		{
			img.src = this.img_on;
			this.checked_id = cid;
		}
		
		img.cid = cid;
		img.onclick = function() {
			self.select(this.cid);
			if(self.radio[this.cid].ra.onclick) self.radio[this.cid].ra.onclick();
		};
		ra.style.display="none";
		this.radio[cid] = {ra:ra, img:img};
	}
};
UI.Radio.prototype={
	select : function(cid) {
		this.radio[cid].img.src = this.img_on;
		this.radio[cid].ra.checked=true;
		if(this.checked_id && this.checked_id!=cid) this.radio[this.checked_id].img.src = this.img_off;
		this.checked_id=cid;
	},
	showValue : function() {
		return this.radio[this.checked_id].ra.value;
	}
};
/* 2007-07-10 */
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();
	}
};
/* 2007-07-10 */
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);
	}
};
/*
2007-07-10

2007-07-11
UI.Drag.js ¿¡¼­ move_mode ¼Ó¼º Ãß°¡¿¡ µû¶ó mode¿¡ µû¸¥ Ãß°¡ÀÛ¾÷

2007-11-20
¸¶¿ì½ºÈÙ½ºÅ©·ÑÃß°¡, ÀÌµ¿¸Þ¼Òµå Ãß°¡
*/
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);
	}
};
/*
2007-07-11 


*/
UI.Sortable=function(ul, param){

	this.ul=UI.$(ul);
	this.drag_li=null;
	this.init_drag=false;
	this.ghost=UI.$(ul+"_ghost");
	this.arr_li=new Array();
	this.arr_li_ch=new Array();
	this.prev_top=0;
	this.prev_id=0;
	this.ghost_css="";
	this.move_mode=0;
	
	var limit_top=-1, limit_bottom=-1, limit_left=-1, limit_right=-1;

	if(typeof param=="object")
	{
		if(param.ghost_css) this.ghost_css=param.ghost_css;
		if(param.move_mode) this.move_mode=param.move_mode;
		if(param.limit_top) limit_top=param.limit_top;
		if(param.limit_bottom) limit_bottom=param.limit_bottom;
		if(param.limit_left) limit_left=param.limit_left;
		if(param.limit_right) limit_right=param.limit_right;

		if(typeof param.onStart=="function") this.onStart=param.onStart;
		if(typeof param.onStop=="function") this.onStop=param.onStop;
		if(typeof param.onChange=="function") this.onChange=param.onChange;
	}

	//Drag»ý¼º
	var li=this.ul.getElementsByTagName("li");
	var self=this;
	for(var i=0; i<li.length; i++)
	{
		li[i].index=i;
		new UI.Drag(li[i].id, {
			limit_top:limit_top,
			limit_bottom:limit_bottom,
			limit_left:limit_left,
			limit_right:limit_right,
			move_mode:this.move_mode,
			onStart:function(){ self.startDrag() },
			onDrag:function(){ self.moveDrag() },
			onStop:function(){ self.stopDrag() }			
		});
	}
	
	li=document.createElement("li");
	li.id=ul+"_last";
	li.style.display="none";
	this.ul.appendChild(li);
	
	//±âº»°ª ¼¼ÆÃ
	this.setLi();
};
UI.Sortable.prototype={

	startDrag:function() {
		var li=_uiDrag.obj;//Àü¿ªº¯¼ö
		this.drag_li=li;
		UI.setOpacity(li,70);
	},
	initDrag:function() {		
		var li=_uiDrag.obj;
		this.drag_li=li;

		this.setGhost(li,1);
		li.style.width=li.offsetWidth;
		li.style.position="absolute";
		li.style.zIndex=1001;
		//document.body.insertBefore(li, document.body.lastChild);
		
		if(this.onStart) this.onStart.call(this);
		this.init_drag=1;		
	},
	moveDrag:function() {
		if(!this.init_drag) this.initDrag();
		var li=_uiDrag.obj;
		this.drag_li=li;

		//±âÁØ
		var y=this.getBaseTop(li);
		if(!y.top) return;

		//drop ¿µ¿ªÃ¼Å©
		var drop_num=this.arr_li_ch.length-1;
		for(var i=0; i<this.arr_li_ch.length; i++)
		{
			if(y.top < this.arr_li_ch[i])
			{
				drop_num=i;
				break;
			}
		}
		
		var id = this.arr_li[drop_num];
		if(this.prev_id != id && id!=li.id)
		{
			this.setGhost(UI.$(id));
			this.setLi(li.id);		
			this.prev_id=id;
		}
		if(this.onDrag) this.onDrag.call(this);
		this.prev_top=parseInt(li.style.top);
	},
	stopDrag:function() {
		var li=_uiDrag.obj;
		this.drag_li=li;
		li.removeAttribute("style");

		if(!this.init_drag) return;

		this.ul.replaceChild(li, this.ghost);
				
		this.setLi();
		if(this.ghost.init_index != li.index)
		{				
			if(this.onChange) this.onChange.call(this);
		}

		this.ghost=null;
		this.init_drag=0;
		if(this.onStop) this.onStop.call(this);
	},
	setGhost:function(el,init) {
		if(!this.ghost)
		{
			this.ghost=document.createElement("div");
			this.ghost.id="ghost";
			this.ghost.init_index = el.index;
		}
		if(init)
		{
			this.ghost.style.height=el.offsetHeight+"px";
			this.ghost.style.width="100%";
			var mb = UI.getStyle(el,'marginBottom')
			if(mb) this.ghost.style.marginBottom=mb;
			this.ghost.className = this.ghost_css;
		}
		el.parentNode.insertBefore(this.ghost, el);
	},
	getBaseTop:function(el){
		var top = parseInt(el.style.top);
		var t = top - this.prev_top;
		var dir="";
		if(t>0) { t=top + el.offsetHeight; dir="down"}
		else if(t<0) { t=top; dir="up"}
		else return "";

		return {top:t, dir:dir};
	},
	setLi:function(id) {
		var li=this.ul.getElementsByTagName("li");

		for(var j=0,i=0; j<li.length; j++)
		{
			if(id && li[i].id==id) continue;

			li[i].index=i;
			this.arr_li[i]=li[i].id;
			this.arr_li_ch[i]=this._ch(li[i]);
			i++;
		}
	},
	_ch:function(el){
		return UI.getPosition(el).y + (el.offsetHeight/2);
	},
	value:function(){
		/*
		var ul=this.ul.id;
		var s="";var li=null;
		for(i in this.arr_li)
		{
			li=this.arr_li[i];
			if(li==ul+"_last") break;
			s+=ul+"[]="+ li.substring(li.indexOf("_")+1,li.length)+"&";
		}
		s=s.substring(0,s.length-1);		
		return s;
		*/
		var ul=this.ul.id;
		var arr=new Array();
		for(i in this.arr_li)
		{
			li=this.arr_li[i];
			if(li==ul+"_last") break;
			arr[i]=li.substring(li.indexOf("_")+1,li.length);
		}
		return arr;
	}
};
/* 
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);	
};
/**
2007-07-18
2007-12-11
skin() html string º¯¼ö ¼±¾ð ¼öÁ¤
*/
UI.Calender = 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.pid = "UI_Calender"+String(Math.random()).substring(2,6);

};
UI.Calender.prototype={

	setBox:function(num,ymd,type){ //type 1:prev,2:next,0:now
		var box=UI.$(this.pid+"_"+num);
		box.ymd=ymd;
					
		if(type==1) box.className="UICalender_box_prev";
		else if(type==2) box.className="UICalender_box_next";
		else 
		{
			box.className="UICalender_box";			
			if(ymd==this.today_ymd) box.className="UICalender_box_today";
		}
		box.innerHTML=ymd.substring(6,8);
		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());
	},
	show:function(el){
		this.show_el=el;
		var pos=UI.getPosition(el);
		var ifa=parent.document.getElementById('UICalenderIfa');

		if(!this.is_show)
		{
			UI.addEvent(parent.document,"mousedown",function(){ ifa.style.display='none' })
			this.is_show=1;
		}
		if(this.selbox)	this.selbox.className="UICalender_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=UI.$(this.pid+"_"+n1+""+n2);
			this.selbox.className="UICalender_box_selday";
		}
		ifa.style.top=pos.y+el.offsetHeight+"px";
		ifa.style.left=pos.x+"px";
		ifa.style.display="block";
	},
	print:function(){
		var s=this.skin();
		document.write('<div id="'+this.pid+'">'+s+'</div>');
		
		var day=this.day;
		var selyear=UI.$(this.pid+"_selyear");
		var selmonth=UI.$(this.pid+"_selmonth");
		var btnprev=UI.$(this.pid+"_btnprev");
		var btnnext=UI.$(this.pid+"_btnnext");

		try{
			var self=this;
			UI.addEvent(selyear, "change", function(){
				self.draw(selyear.value, selmonth.value - 1);
			});
			UI.addEvent(selmonth, "change", function(){
				self.draw(selyear.value, selmonth.value - 1);
			});
			UI.addEvent(btnprev, "click", function(){self.goPrev()});
			UI.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{
			UI.$(this.pid+"_selyear").value=day.getFullYear();
			UI.$(this.pid+"_selmonth").value=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='';
		//-------------------------------------------------------------------------
		//htmlº¯°æ°¡´É
		s='<table border="1">'
		+'<tr>'
		+'	<td>ÀÏ</td>'
		+'	<td>¿ù</td>'
		+'	<td>È­</td>'
		+'	<td>¼ö</td>'
		+'	<td>¸ñ</td>'
		+'	<td>±Ý</td>'
		+'	<td>Åä</td>'
		+'</tr>'
		+'<tr>'
		+'	<td colspan="7">'
		+'	<span id="'+this.pid+'_btnprev">¢¸</span>'
		+'	<select id="'+this.pid+'_selyear">'
		+'	<option value="2006">2006</option>'
		+'	<option value="2007">2007</option>'
		+'	<option value="2008">2008</option>'
		+'	<option value="2009">2009</option>'
		+'	</select>³â'
		+'	<select id="'+this.pid+'_selmonth">'
		+'	<option value="1">1</option>'
		+'	<option value="2">2</option>'
		+'	<option value="3">3</option>'
		+'	<option value="4">4</option>'
		+'	<option value="5">5</option>'
		+'	<option value="6">6</option>'
		+'	<option value="7">7</option>'
		+'	<option value="8">8</option>'
		+'	<option value="9">9</option>'
		+'	<option value="10">10</option>'
		+'	<option value="11">11</option>'
		+'	<option value="12">12</option>'
		+'	</select>¿ù'
		+'	<span id="'+this.pid+'_btnnext">¢º</span>'
		+'	</td>'
		+'</tr>'
		+'<tr>'
		+'	<td id="'+this.pid+'_00"></td>'
		+'	<td id="'+this.pid+'_01"></td>'
		+'	<td id="'+this.pid+'_02"></td>'
		+'	<td id="'+this.pid+'_03"></td>'
		+'	<td id="'+this.pid+'_04"></td>'
		+'	<td id="'+this.pid+'_05"></td>'
		+'	<td id="'+this.pid+'_06"></td>'
		+'</tr>'
		+'<tr>'
		+'	<td id="'+this.pid+'_10"></td>'
		+'	<td id="'+this.pid+'_11"></td>'
		+'	<td id="'+this.pid+'_12"></td>'
		+'	<td id="'+this.pid+'_13"></td>'
		+'	<td id="'+this.pid+'_14"></td>'
		+'	<td id="'+this.pid+'_15"></td>'
		+'	<td id="'+this.pid+'_16"></td>'
		+'</tr>'
		+'<tr>'
		+'	<td id="'+this.pid+'_20"></td>'
		+'	<td id="'+this.pid+'_21"></td>'
		+'	<td id="'+this.pid+'_22"></td>'
		+'	<td id="'+this.pid+'_23"></td>'
		+'	<td id="'+this.pid+'_24"></td>'
		+'	<td id="'+this.pid+'_25"></td>'
		+'	<td id="'+this.pid+'_26"></td>'
		+'</tr>'
		+'<tr>'
		+'	<td id="'+this.pid+'_30"></td>'
		+'	<td id="'+this.pid+'_31"></td>'
		+'	<td id="'+this.pid+'_32"></td>'
		+'	<td id="'+this.pid+'_33"></td>'
		+'	<td id="'+this.pid+'_34"></td>'
		+'	<td id="'+this.pid+'_35"></td>'
		+'	<td id="'+this.pid+'_36"></td>'
		+'</tr>'
		+'<tr>'
		+'	<td id="'+this.pid+'_40"></td>'
		+'	<td id="'+this.pid+'_41"></td>'
		+'	<td id="'+this.pid+'_42"></td>'
		+'	<td id="'+this.pid+'_43"></td>'
		+'	<td id="'+this.pid+'_44"></td>'
		+'	<td id="'+this.pid+'_45"></td>'
		+'	<td id="'+this.pid+'_46"></td>'
		+'</tr>'
		+'<tr>'
		+'	<td id="'+this.pid+'_50"></td>'
		+'	<td id="'+this.pid+'_51"></td>'
		+'	<td id="'+this.pid+'_52"></td>'
		+'	<td id="'+this.pid+'_53"></td>'
		+'	<td id="'+this.pid+'_54"></td>'
		+'	<td id="'+this.pid+'_55"></td>'
		+'	<td id="'+this.pid+'_56"></td>'
		+'</tr>'
		+'</table>';
		//-------------------------------------------------------------------------
		return s;	
	}
};
/*
2008-02-20 Å©·Î½ºµµ¸ÞÀÎ¹®Á¦ ÇØ°á swfÆÄÀÏº¯°æ
*/
UI.setClip=function(s,m){
	try{
		var swf=(navigator.appName.indexOf("Microsoft")!=-1)?window['UIclipSwf']:document['UIclipSwf'];
		swf.setClip(s);alert(m);
	}catch(e){
		alert("ÇØ´ç ºê¶ó¿ìÀú¿¡¼­´Â Áö¿øÇÏÁö ¾Ê½À´Ï´Ù.");
	}
}
UI.setClip.url='/media/jes/clip8.swf'; //ÇØ´ç ¼­ºñ½º¼­¹ö¿¡ ¾÷·ÎµåÇÏ¿© »ç¿ëÇØ ÁÖ¼¼¿ä~~

UI.setClip.print=function()
{
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="1" height="1" id="UIclipSwf"><param name="allowScriptAccess" value="always" /><param name="movie" value="'+UI.setClip.url+'" /><embed src="'+UI.setClip.url+'" width="1" height="1" name="UIclipSwf" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
}
/**
2007-12-18
*/
UI.InputComma=function(id){
	this.input=UI.$(id);
	this.value='';

	var self=this;
	UI.addEvent(self.input,'keyup',function(event){ self.check(event) });
	UI.addEvent(self.input,'keydown',function(event){ self.check(event) });
};
UI.InputComma.prototype={
	isAllowKey:function(e){
		if      (!e.shiftKey && e.keyCode >= 48 && e.keyCode <= 57)  { return true; } //keyboard's num
		else if (!e.shiftKey && e.keyCode >= 96 && e.keyCode <= 105) { return true; } //pad's num
		else 
		{
			switch(e.keyCode) {
				case 8 : //back  
				case 35: //end   
				case 36: //home  
				case 37: //left
				case 38: //top
				case 39: //right
				case 40: //bottom
				case 45: //insert
				case 46: //delete
				case 9 : //tab
				case 13 : //enter
				return true;
			}
		}
		return false;
	},
	check:function(e){
		e = UI.getE(e);

		if(!this.isAllowKey(e))
		{
			UI.stopEvent(e);
			return;
		}
		var value=this.input.value;
		value = value.replace(/,/g,'');
		
		if(value!=this.value)
		{
			this.value=value;
			this.input.value = UI.addComma(value);
		}		
	}
};
/**
2007-09-03
*/
UI.TagChecker=function(id){
	this.input = UI.$(id);
	this.filter = ' /';
	this.maxNum = 20;

	var self=this;
	this.input.onkeyup=function(){self.check();}
	this.input.onblur=function(){self.blur()}
}
UI.TagChecker.prototype={
	check:function(){
		
		var val = this.input.value;
		for(var i=0; i<this.filter.length; i++)
			val = val.replace(new RegExp(this.filter.charAt(i),'ig'),'' );
		var last = val.lastIndexOf(',');
		var val2 = val.substring(0,last);
		var tail = val.substring(last,val.length);
		var a=val2.split(',')

		var len=a.length;				
		if(len>1)
		{
			var a1=[];
			var loop=(len>this.maxNum) ?this.maxNum:len;
			for(var i=0; i<loop; i++)
			{
				if(!a[i]) continue;
				if(UI.indexOf(a1,a[i])==-1) a1.push(a[i])
			}
			val = a1.toString()
			if(len < this.maxNum) val += tail;
		}
	
		if(val != this.input.value)	this.input.value=val;
	},
	blur:function(){
		this.input.value+=','
		this.check();
		var val = this.input.value;
		if(val.lastIndexOf(',')==val.length-1)
		{
			this.input.value=val.substring(0,val.length-1);
		}		
	}
};
/**
2007-09-11

2007-11-26
this.isAlert ¼Ó¼ºÃß°¡

*/

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;		
	}
}

/**
2007-12-10
*/
UI.DynamicScript=function(url,enc){
	this.url=url||'';
	this.enc=enc||'';
	this.head=document.getElementsByTagName("head").item(0);
	if(this.url) this.call(this.url);
};
UI.DynamicScript.prototype={
	noCacheParam:function(){
		var b=(this.url.indexOf('?')==-1) ? '?':'&';
		return b+'nOcAchE='+(new Date()).getTime();
	},
	call:function(url){
		try{this.head.removeChild(this.script)}catch(e){};
		this.url=url;
		this.script = document.createElement("script");
		this.script.setAttribute("type", "text/javascript");   
		this.script.setAttribute("src", this.url+this.noCacheParam());
		if(this.enc) this.script.setAttribute("charset", this.enc);
		this.head.appendChild(this.script);
	}
};
/**
2008-01-04
*/
UI.AnimateImage=function(id,options){
	this.options={
		frame:0,		//ÀüÃ¼ frame¼ö
		dir:'x',		//ÀÌµ¿¹æÇâ  (x|y)
		rate:100,		//frame rate (1000=1ÃÊ)
		loop:false,		//¹Ýº¹ ¿©ºÎ
		move:0			//ÇÑ¹ø¿¡ ¿òÁ÷ÀÏ px
	};
	Object.extend(this.options, options);

	this.box=UI.$(id);
	this.currentFrame=0;	//ÇöÀç frame
	this.tid=0;				//setTimeout id
	this.isPlay=false;
	this.totalFrame=this.options.frame;	
	this.options.dir = (this.options.dir=='x') ? 'scrollLeft':'scrollTop';

	this.frame_position=[];
	for(var i=0; i<this.options.frame; i++)	this.frame_position[i]= this.options.move * i;
};
UI.AnimateImage.prototype={
	
	play:function(type){
		if(this.isPlay) return;
		this.isPlay=true;
		this.move(type);
	},
	stop:function(){		
		clearTimeout(this.tid);
		this.isPlay=false;
	},
	move:function(type){
		var self=this;

		if(!type)
		{
			if(this.options.loop && this.currentFrame==this.totalFrame-1) this.currentFrame=0;
			else if(this.currentFrame==this.totalFrame-1) {this.stop(); return;}
			else this.currentFrame++;
		}
		else
		{
			if(this.options.loop && this.currentFrame==0) this.currentFrame=this.totalFrame;
			else if(this.currentFrame==0) {this.stop(); return;}
			else this.currentFrame--;
		}
		
		this.box[this.options.dir] = this.frame_position[this.currentFrame];
		this.tid=setTimeout(function(){self.move(type)}, self.options.rate);
	}
};
/**
2008-01-14

2008-01-18
±â´É¼öÁ¤

*/
UI.HomePage=function(){	
	if(!this.isIE()) return true;		
	document.domain='daum.net';
	/*
	var d=document.createElement('div');	
	d.innerHTML = '<iframe name="JESHomePage" id="JESHomePage" frameborder=0 marginwidth=0 marginheight=0 width=0 height=0 noresize src="http://www.daum.net/doc/ishome.html"></iframe>';
	document.body.appendChild(d);
	*/
};
UI.HomePage.prototype={
	get:function(){			
		if(!this.isIE()) return true;
		
		if( JESHomePage && JESHomePage.isHomeVerify()) return true;
		else return false;
	},
	set:function(code){
		if(!this.isIE()) return true;
		if(this.get()) return true;

		if(JESHomePage)	
			return JESHomePage.setDaumHome(code);
	},
	isIE:function(){
		if(navigator.userAgent.indexOf("MSIE")>-1) return true;
		else return false;
	}
};
/*
2008-02-28
*/
UI.FlashAjax = function(options) {
	this.options={
		url:'',
		method:'GET',
		param:'',
		onLoad:'',
		contentType: 'application/x-www-form-urlencoded',
		encoding:'UTF-8',
		timeout:1000
	}
	Object.extend(this.options, options);
	this.data=[];
	if(this.options.url) this.send();
}
UI.FlashAjax.swf_url = "http://ui.daum.net/media/jes/FlashAjax.swf"; //ÇÃ·¡½Ã urlº¯°æ

UI.FlashAjax.prototype={
	send:function(){
		this.setParam();
		var swf=(navigator.appName.indexOf("Microsoft")!=-1)?window['JESFlashAjax']:document['JESFlashAjax'];
		swf.httpRequest(this);
	},
	setParam:function(){
		if(this.options.param=="") return;
		this.data=UI.parseQuery(this.options.param);
	}
};
UI.FlashAjax.checkHTTP=function(data){
	var responseText=data.responseText;
	var httpStatus=data.httpStatus;
	//ie¸¸ httpstatus°ª °¡Á®¿À±â¶§¹®¿¡
	if((document.all && httpStatus!="200") || (!document.all && responseText==undefined))
	{
		alert("HTTP ¿À·ùÀÔ´Ï´Ù!\n\nÀá½ÃÈÄ¿¡ ´Ù½Ã ½ÃµµÇÏ¼¼¿ä!");
		return false;
	}
	return true;
};
UI.FlashAjax.checkJSON=function(data){
	var responseText=data.responseText;
	var checkVariable=data.checkVariable;
	//µ¥ÀÌÅ¸°ËÁõ
	try{
		var result = eval('(' + responseText + ')');
		if(checkVariable && !result[checkVariable]) throw 'checkVariable';  
	}catch(e){
		alert("µ¥ÀÌÅ¸ ¿À·ùÀÔ´Ï´Ù!\n\nÀá½ÃÈÄ¿¡ ´Ù½Ã ½ÃµµÇÏ¼¼¿ä!\n\n"+e);
		return false;
	}

	return result; 
};
UI.FlashAjax.print=function(){
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="0" height="0" id="JESFlashAjax"><param name="allowScriptAccess" value="always" /><param name="movie" value="'+UI.FlashAjax.swf_url+'" /><embed src="'+UI.FlashAjax.swf_url+'" width="0" height="0" name="JESFlashAjax" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');	
};
