Unc = {
	version:'3.3',
	creator:'GoodBug',
	updated:'2009.12.17'
};

Web.namespace("Unc.tag");

Unc.alice = {
	hash: new Hash	
};

Unc.tag.select = {
	selectedIndex:0,
	apply: function(id, w,h) {
		var obj = $(id);		
		var i1 = id+'-1';
		var i2 = id+'-2';
		var i3 = id+'-3';
		h = h||19;
		obj.style.display = 'none';

		var txt = ""+
			"<table width='"+w+"' cellspacing=0 cellpadding=0 style=position:absolute;cursor:default;>"+
				"<tr height=1><td></td></tr><tr><td>"+
					"<table border=0 cellspacing=0 cellpadding=0 style=\"width:100%;height:"+h+";border:1px solid #c0c0c0;line-height:117%;font-family:vernada;font-size:9pt;\" "+
							"onmouseover=\"Unc.tag.select.overMainlayer(this, '"+i3+"','"+i2+"')\" "+
							"onmouseout=\"Unc.tag.select.outMainlayer(this , '"+i3+"')\" >"+ 
						"<tr onclick=\"Unc.tag.select.showSublayer('"+i2+"','"+i1+"')\">"+
							"<td id='"+i1+"' onblur=\"Unc.tag.select.blur(this)\">&nbsp;"+obj.options[obj.selectedIndex].text+"</td>"+
							"<td align=right width=10 bgcolor=#eeeeee><img id='"+i3+"' src='./img/skin/default/dot.gif' style=\"vertical-align:middle;filter:gray()\"></td></tr>"+
					"</table>"+
					"<table id='"+i2+"' cellspacing=2 cellpadding=2 onblur=\"Unc.tag.select.hide(this)\" style=\"display:none;width:100%;border:1px solid #c0c0c0;font-family:vernada;font-size:9pt;background-color:#ffffff;\">";
		for (var i = 0 ; i < obj.length; i++) {
			txt += "<tr height=18 onclick=\"Unc.tag.select.change('"+obj.id+"',"+i+",this,'"+i2+"','"+i1+"')\">"+
						"<td width='"+w+"' style=";
			if (obj.selectedIndex == i) {
				txt += "'background-color:#225588;color:#ffffff;'";
			} else {
				txt += "'background-color:#ffffff;color:#000000;'";
			}
			txt += "onmouseover=\"Unc.tag.select.overSublayer(this)\" onmouseout=\"Unc.tag.select.outSublayer(this)\">&nbsp;"+
					obj.options[i].text+"</td></tr>";
		}
		txt += "</table></td></tr></table><img src='./img/common/board/empty.gif' width='"+w+"' height=0>";
		
		Web.Html.appendHtml(txt, id);
	},
	
	overSublayer: function(obj) {
		obj.style.backgroundColor = '#225588';
		obj.style.color = '#ffffff';
	},
	outSublayer: function(obj) {
		obj.style.backgroundColor = '#ffffff';
		obj.style.color = '#000000';
	},
	
	change: function(id, i, tr, i2, i1) {
		this.selectedIndex = i;
		var obj = $(id);
		var o2 = $(i2);
		var o1 = $(i1);
		
		obj.value = obj.options[i].value;
		o2.style.display = 'none';
		o1.update("&nbsp;"+obj.options[i].text);
		o1.style.backgroundColor = '#225588';
		o1.style.color = '#ffffff';
		if (Web.isIE) {
			o1.focus();
		}
		this.list();
	},
	
	list: function() {
		if ($('unc-category-list') && $('unc-category-list').present()) {
			categoryList($('unc-category-list').value);	
		}
	},
	
	hide: function(obj) {
		if (obj.style.display != 'none') {
			setTimeout("$(\""+obj.id+"\").style.display = 'none';" , 1000);
		}
	},
	
	showSublayer: function(i2, i1) {
		var o2 = $(i2);
		var o1 = $(i1);
		if(o2.style.display == 'none') {
			o1.style.background = '#ffffff';
			o1.style.color = '#000000';	
			o2.style.display = 'block';
			if (Web.isIE) {
				o2.focus();
			}
		} else {
			o1.style.background = '#225588';
			o1.style.color = '#ffffff';
			o2.style.display = 'none';
		}
	},
	
	overMainlayer: function(obj, i3, i2) {		
		var o2 = $(i2);
		var o3 = $(i3);
		if (o2.style.display == 'none') {
			obj.style.border = '1px solid #225588';
			o3.style.filter = '';
		}
	},
	
	outMainlayer: function(obj, i3) {
		var o3 = $(i3);
		obj.style.border = '1px solid #c0c0c0';
		o3.style.filter = 'gray()';
	},
	
	blur: function(obj) {
		obj.style.background = '#FFFFFF';
		obj.style.color = '#000000';
	}
};

Unc.scroll = {
	form: new Hash,
	boundaryMax: 0,
	direction: 'UP',
	lock: false,

	init: function() {
		this.form = Web.Form.loadForm('unc-cash');
		if (Web.Location.current() == 'search.do') {
			this.form['boardSkin'] = this.form['commonSkin'];
		}
		else {
			this.form['boardSkin'] = this.form['defaultBoardSkin'];	
		}		
	
		if ($('unc-scr-box')) {
			if ($('unc-scr-page-no')) {	
				$('unc-scr-page-no').update(Web.Math.format(this.form['page']));
			}

			if (Web.isIE) {
				$('unc-scr-box').attachEvent('onmousewheel', Unc.scroll.start);
			} 
			else {
				$('unc-scr-box').addEventListener('DOMMouseScroll', Unc.scroll.start, false);
			}

			//this.middle();
		}
	},
	
	start: function(e) {
		var list = $('unc-scr-box');
		var amount = 0;
		if (Web.isIE) {
			amount = event.wheelDelta;
		}
		else {
			amount = -e.detail;
		}
		
		if (amount > 0) {
			Unc.scroll.up();
		}
		else {
			Unc.scroll.down();
		}
	},
	
	up: function() {
		this.direction = 'UP';
		this.roll($('unc-scr-box').scrollTop-150, -10);
		this.middle();
	},
	
	down: function() {
		this.direction = 'DOWN';
		var list = $('unc-scr-box');
		this.roll(list.scrollTop+150, 10);
	
		var content = $('unc-scr-content');
		if ((content.offsetHeight*9/10) < (list.scrollTop+list.offsetHeight) &&
			this.boundaryMax < list.scrollTop) {
			this.process();
		}
		this.middle();
	},
	
	roll: function(to, off) {
		if ((off > 0 && this.direction == 'UP') || (off < 0 && this.direction == 'DOWN')) return;
		var list = $('unc-scr-box');
		var now = list.scrollTop;
		if ((off > 0 && now < to) ||
			(off < 0 && now > to)
		) {
			if (off > 0 && (to - now < 20)) off = 1;
			else if (off < 0 && (now - to < 20)) off = -1;
			else if (off > 0 && (to - now < 40)) off = 2;
			else if (off < 0 && (now - to < 40)) off = -2;
			else if (off > 0 && (to - now < 60)) off = 3;
			else if (off < 0 && (now - to < 60)) off = -3;
			list.scrollTop += off;
			setTimeout("Unc.scroll.roll("+to+","+off+")", 25);
		} 
	},
	
	move: function(diff) {
		var list = $('unc-scr-box');
		var content = $('unc-scr-content');
		var total = parseInt(content.offsetHeight);
		if (diff > 0) {
			this.direction = 'DOWN';
		}
		else {
			this.direction = 'UP';
		}
		var offset = 8 * total*diff / 100;
		this.roll(list.scrollTop+(total * diff), parseInt(offset));
		if (this.direction == 'DOWN' &&
		    (content.offsetHeight*9/10) < (list.scrollTop+list.offsetHeight) &&
			this.boundaryMax < list.scrollTop) {
			this.process();
		}
		else if (diff == 1) {
			setTimeout("Unc.scroll.process()", 500);
		}
		else if (diff == -1) {
			this.top();
		}		
	},
	
	process: function() {
		var list = $('unc-scr-box');
		if (this.boundaryMax < list.scrollTop) {
			this.boundaryMax = list.scrollTop;
		}
		if (parseInt(this.form['page']) < parseInt(this.form['totalPage'])) {
			this.middle();
	
			if (this.lock) {
				return;
			}
			this.synchronize(true);
			this.form['page']++;
			$('unc-scr-page-no').update(Web.Math.format(this.form['page']));

			if ((typeof this.form['searchAndKey'] == 'undefined' ||	typeof this.form['searchOrKey'] == 'undefined' || typeof this.form['searchNotKey'] == 'undefined') ||
				(this.form['searchAndKey'].empty() && this.form['searchOrKey'].empty() && this.form['searchNotKey'].empty())) {
				Web.Ajax.invoke({action:'ajax-list.do', params:'boardId='+this.form['boardId']+'&page='+this.form['page']+'&totalRecords='+this.form['totalRecords'], handler:'Unc.scroll.parsing'});
			} 
			else {
				Web.Ajax.invoke({action:'ajax-search.do',params:'command=DETAIL&boardId='+this.form['boardId']+'&page='+this.form['page']+'&thumbnailSize='+this.form['thumbnailSize']+'&pageScale='+this.form['pageScale']+'&searchType='+encodeURIComponent(this.form['searchType'])+'&searchAndKey='+encodeURIComponent(this.form['searchAndKey'])+'&searchOrKey='+encodeURIComponent(this.form['searchOrKey'])+'&searchNotKey='+encodeURIComponent(this.form['searchNotKey']),handler:'Unc.scroll.parsing'});				
			}
		}
	},
	
	middle: function() {
		var ifrm = window.frames["unc-scr-iframe"];
		ifrm.moveScrollMiddle();
	},
	
	top: function() {
		this.direction = 'UP';		
		this.roll(0, -10);
	},
	
	synchronize: function(bul) {
		this.lock = bul;
	},
	
	parsing: function(xml) {
		var root = xml.getElementsByTagName("articles")[0];
		if (root != null) {
			var articles = root.getElementsByTagName("article");
			for (var i = 0; i < articles.length; i++) {
				var article = articles[i];
				var row = article.getElementsByTagName("row")[0].firstChild.nodeValue;
				var selected = article.getElementsByTagName("selected")[0].firstChild.nodeValue;
				var boardno = article.getElementsByTagName("boardno")[0].firstChild.nodeValue;
				var boardpoint = article.getElementsByTagName("boardpoint")[0].firstChild.nodeValue;
				var memocnt = article.getElementsByTagName("memocnt")[0].firstChild.nodeValue;
				var thumbnailborder = article.getElementsByTagName("thumbnailborder")[0].firstChild.nodeValue;
				var presentthumbnail = article.getElementsByTagName("presentthumbnail")[0].firstChild.nodeValue;
				var thumbnail = article.getElementsByTagName("thumbnail")[0].firstChild.nodeValue;
				var boardbestfg = article.getElementsByTagName("boardbestfg")[0].firstChild.nodeValue;
				var boardicon = article.getElementsByTagName("boardicon")[0].firstChild.nodeValue;
				var boarddep = article.getElementsByTagName("boarddep")[0].firstChild.nodeValue;
				var recent = article.getElementsByTagName("recent")[0].firstChild.nodeValue;
				var upgrade = article.getElementsByTagName("upgrade")[0].firstChild.nodeValue;
				var readover = article.getElementsByTagName("readover")[0].firstChild.nodeValue;
				var categoryname = article.getElementsByTagName("categoryname")[0].firstChild.nodeValue;
				var subject = article.getElementsByTagName("subject")[0].firstChild.nodeValue;
				var contents = article.getElementsByTagName("contents")[0].firstChild.nodeValue;
				var user = article.getElementsByTagName("user")[0].firstChild.nodeValue;
				var register = article.getElementsByTagName("register")[0].firstChild.nodeValue;
				var read = article.getElementsByTagName("read")[0].firstChild.nodeValue;
				var tagid = article.getElementsByTagName("tagid")[0].firstChild.nodeValue;
				var tagname = article.getElementsByTagName("tagname")[0].firstChild.nodeValue;
				var tagcnt = article.getElementsByTagName("tagcnt")[0].firstChild.nodeValue;
		
				this.append(row, selected, boardno, boardpoint, memocnt, thumbnailborder, presentthumbnail, thumbnail, boardbestfg, boardicon, boarddep, recent, upgrade, readover, categoryname, subject, contents, user, register, read, tagid, tagname, tagcnt);
			}	
		}
		this.synchronize(false);		
	},
	
	append: function(row, selected, boardno, boardpoint, memocnt, thumbnailborder, presentthumbnail, thumbnail, boardbestfg, boardicon, boarddep, recent, upgrade, readover, categoryname, subject, contents, user, register, read, tagid, tagname, tagcnt) {
		var skin = this.form['boardSkin'];
		var tbl = $('unc-scr-record');
		var html1 = "<span onclick=checkArticle(this) id=unc-check-box name=unc-check-box checkeditem=N  value='"+boardno+"'>"+
						(this.form['multiView_yn'] == 'Y' ? "<img src=./img/skin/"+skin+"/i_nox.gif class=unc-bsc>":"")+
					"</span>";
		var html2 = ""+
					"<nobr id=unc-nobr name=unc-nobr>"+
					"<div style=\"padding:0 0 0 "+(boarddep == 1? 0 : boarddep*15)+"\">"+
						"<div class=unc-scr-title>"+
						(this.form['titleNo_yn'] == 'Y' ? 
							(selected == 'true' ?
								"<img src=./img/skin/"+skin+"/i_selected.gif class=unc-bsc>"
								:"<span class=unc-scr-no>"+row+"</span>"
							):""
						)+
						" "+
						(this.form['titleCategory_yn'] == 'Y' && this.form['category_yn'] == 'Y' ? categoryname : "")+
						" "+
						(this.form['titleIcon_yn'] == 'Y' ?
							(boardbestfg == 'Y' ? "<img src=./img/skin/"+skin+"/i_best.gif class=unc-bsc>" :
								(boardicon =='A' ? "<img src=./img/skin/"+skin+"/i_doc.gif class=unc-bsc>" : "")+
								(boardicon =='B' ? "<img src=./img/skin/"+skin+"/i_file.gif class=unc-bsc>" : "")+
								(boardicon =='C' ? "<img src=./img/skin/"+skin+"/i_poll.gif class=unc-bsc>" : "")+
								(boardicon =='D' ? "<img src=./img/skin/"+skin+"/i_secret.gif class=unc-bsc>" : "")
							):""
	           			)+
	           			" " +
						(boarddep != 1 ? "[re]" : "")+
						(this.form['titlePoint_yn'] == 'Y' && boardpoint > 0 ? "<span class=unc-point>[$"+boardpoint+"]</span>" : "")+
						" "+
						(this.form['titleTag_yn'] == 'Y' ? "<span class=unc-scr-tag onmouseover=this.calssName='unc-scr-tag-over' onmouseout=this.className='unc-scr-tag' onclick=viewTagList('"+tagid+"')>"+tagname+"</span>":"")+
						" "+
						"<strong><a href=\"javascript:readSearchArticle('"+boardno+"')\" target=\"_self\" class=\"unc-main\">"+subject+"</a></strong>"+
						" "+
						(this.form['titleMemo_yn'] == 'Y' && memocnt > 0 ? "<img src=./img/skin/"+skin+"/i_memo.gif class=unc-bsc> <span class=unc-scr-memo>"+memocnt+"</span> " : "")+
						(this.form['titleTag_yn'] == 'Y' && tagcnt > 0 ? "<span class=unc-scr-memo><img src=./img/skin/"+skin+"/i_tag.gif class=unc-bsc> "+tagcnt+"</span> " : "")+
						(this.form['titleNew_yn'] == 'Y' && recent == 'Y' ? "<img src=./img/skin/"+skin+"/i_new.gif class=unc-bsc>" : 
	           				(upgrade == 'Y' ? "<img src=./img/skin/"+skin+"/i_update.gif class=unc-bsc>" : "")
						)+
						"<a href=\"./board-read.do?boardId="+this.form['boardId']+"&boardNo="+boardno+"&command=READ&page=1&categoryId=-1\" target=\"_unicornblank\" class=\"unc-main\"><img src=./img/skin/"+skin+"/i_pop.gif class=unc-bsc></a>"+
						"</div>"+
						"<div class=unc-scr-cnt>"+
						(this.form['titleThumbnail_yn'] == 'Y' && presentthumbnail == 'true' ? 
          					"<div class=unc-scr-cnt-thumb style=\"width:"+this.form['thumbnailSize']+"\">"+thumbnailborder+"</div>"
						:"")+
							"<div class=unc-scr-cnt-dtl>"+
							(this.form['titleNick_yn'] == 'Y' && this.form['anonymity_yn'] == 'N' ? user : "")+" "+
							(this.form['titleRead_yn'] == 'Y' ? 
									(this.form['readOver_yn'] == 'Y' ? "<strong>"+this.form['readOver_color']+"</strong>":"")+
									"<span class=unc-scr-read>read "+read+"</span>"
							:"")+
							"<br/><br/>"+contents+
							"</xmp></pre>"+
                    		"</div>"+
						"</div>"+
						"<div class=unc-scr-regdt>"+
							(this.form['titleDate_yn'] == 'Y' ?	"<span class=unc-scr-read>"+register+"</span>":"")+
						"</div>"+
					"</div>"+
                	"</nobr>";
		
		if (Web.isIE) {
			var row = tbl.insertRow();
			var cel1 = row.insertCell();
			var cel2 = row.insertCell();
			row.className = 'unc-scr-tr';
			cel1.className = 'unc-scr-col-multiple';
			cel2.className = 'unc-scr-bsc';
			cel1.innerHTML = html1;
			cel2.innerHTML = html2;
			
		} else {
			var row = document.createElement("tr");
			var cel1 = document.createElement("td");
			var cel2 = document.createElement("td");
			row.appendChild(cel1);
			row.appendChild(cel2);
			row.className = 'unc-scr-tr';
			cel1.className = 'unc-scr-col-multiple';
			cel2.className = 'unc-scr-bsc';
			cel1.innerHTML = html1;
			cel2.innerHTML = html2;
	
			tbl.appendChild(row);
		}
		size_init02();
		
	}
};


Unc.scroll.bar = {
	y: 0,
	vertical: null,
	imgheight: 0,
	dragapproved: false,
	barheight: 0,
	start: 0,
	finish: 0,
	lock: false,	
	init: function() {
		this.vertical = $('unc-vertical');
		this.vertical.style.top = 0;
		this.barheight = Web.isIE? document.documentElement.offsetHeight : self.innerHeight;
		this.imgheight = this.vertical.offsetHeight;
		
		Event.observe(document, "mouseup", this.up);
		Event.observe(document, "mousedown", this.down);
		Event.observe(document, "mousemove", this.move);
		Event.observe(document, "click", this.click);
		this.middle();
	},
	
	down: function(e) {
		Unc.scroll.bar.dragapproved = true;
		Unc.scroll.bar.start = parseInt(Unc.scroll.bar.vertical.style.top);
		Unc.scroll.bar.y = Web.isIE? event.clientY : e.pageY;
	},
	
	up: function(e) {
		Unc.scroll.bar.finish = parseInt(Unc.scroll.bar.vertical.style.top);	
		Unc.scroll.bar.dragapproved = false;
		var diff = (Unc.scroll.bar.finish - Unc.scroll.bar.start) / (Unc.scroll.bar.barheight-65);
		parent.moveScrollBox(diff);
	},
	
	move: function(e) {
		if (Unc.scroll.bar.dragapproved) {
			if (parseInt(Unc.scroll.bar.vertical.style.top) < 0) { 
				Unc.scroll.bar.vertical.style.top = "0px";
				Unc.scroll.bar.up(e);
				return;
			} 
			else if ((Unc.scroll.bar.barheight - Unc.scroll.bar.imgheight) < parseInt(Unc.scroll.bar.vertical.style.top)) { 
				Unc.scroll.bar.vertical.style.top = (Unc.scroll.bar.barheight - Unc.scroll.bar.imgheight)+"px";
				Unc.scroll.bar.up(e);
				return; 
			}
			
			var cy = Web.isIE? event.clientY : e.pageY;
			Unc.scroll.bar.vertical.style.top = (Unc.scroll.bar.start+cy-Unc.scroll.bar.y)+"px";
			if (parseInt(Unc.scroll.bar.vertical.style.top) <= 0) {
				parent.moveScrollTop();
			}			
			return false;
		}
	},
	
	click: function(e) {		
		if (!Unc.scroll.bar.lock) {
			var cy = Web.isIE? event.clientY : e.pageY;
			Unc.scroll.bar.vertical.style.top = ((parseInt(Unc.scroll.bar.vertical.style.top)+Unc.scroll.bar.imgheight/2 < cy)? parseInt(Unc.scroll.bar.vertical.style.top)+Unc.scroll.bar.imgheight/2 : parseInt(Unc.scroll.bar.vertical.style.top)-Unc.scroll.bar.imgheight/2)  +"px";
		}
		
		if ((Unc.scroll.bar.barheight - Unc.scroll.bar.imgheight) < parseInt(Unc.scroll.bar.vertical.style.top)) {
			Unc.scroll.bar.vertical.style.top = (Unc.scroll.bar.barheight - Unc.scroll.bar.imgheight)+"px";
		}
		else if (parseInt(Unc.scroll.bar.vertical.style.top) < 0) {
			Unc.scroll.bar.vertical.style.top = "0px";
			parent.moveScrollTop();
		} 
		else if ((Unc.scroll.bar.barheight - Unc.scroll.bar.imgheight) < parseInt(Unc.scroll.bar.vertical.style.top)) {
			Unc.scroll.bar.vertical.style.top = (Unc.scroll.bar.barheight - Unc.scroll.bar.imgheight)+"px";
		}
	
		Unc.scroll.bar.up(e);
		return false;
	},
	
	middle: function() {	
		var cur = parseInt(this.vertical.style.top)+32;		
		var off = (cur < this.barheight / 2 - this.imgheight/2)? 3:-3;		
		var to = parseInt(this.barheight / 2 - this.imgheight/2);		
		setTimeout("Unc.scroll.bar.roll("+to+","+off+")", 15);
	},
	
	roll: function(to, off) {		
		if ((off < 0 && to >= parseInt(this.vertical.style.top)) || (off > 0 && to <= parseInt(this.vertical.style.top))) {
			return;
		}

		this.vertical.style.position = 'absolute';
		this.vertical.style.left = 1;		
		this.vertical.style.top = (parseInt(this.vertical.style.top) + off) + "px";		
		setTimeout("Unc.scroll.bar.roll("+to+","+off+")", 15);
	},
	
	synchronize: function(bul) {
		this.lock = bul;
	}
};

Unc.tagging = {
	tagSeq: 0,
	curTagIdx: 0,
	currentPk: null,
	oldTextbox: null,
	keystatus: true,
	tagMouseOver: false,
	mconti: false,
	
	init: function() {
		if ($fn('unc-cash','tag_yn').value = 'Y') {
			this.start();
			/*
			if (Web.isIE) {
				this.start();
			}
			else {
				this.start();//document.onkeydown=Unc.tagging.capcureKeyDown;
			}*/
		}
	},
	
	onfocus: function(pk) {
		this.setCurrentPk(pk);
		this.loadBox(true);
		this.setOldTextBox('');
	},      
	
	onblur: function() {
		this.loadBox(false);
		this.setCurrentPk('');		
	},
	
	start: function() {
		if (this.currentPk != '' && !this.mconti) {
			this.monitor();	
		}
		setTimeout('Unc.tagging.start()', 1000);
	},
	
	coloring: function(qry, svd) {
		var rtn = '';
		var qry2 = (qry.length > 1? qry.substring(0,qry.length-1) : qry);
		for (var i = 1; i <= svd.length; i++) {
			if (qry2.toLowerCase() == svd.substring(0,i).toLowerCase())
				rtn = '<span class=unc-tag-color>'+qry2+'</span>'+svd.substring(i);
				
			if (qry.toLowerCase() == svd.substring(0,i).toLowerCase())
				rtn = '<span class=unc-tag-color>'+qry+'</span>'+svd.substring(i);
		}
		return rtn;
	},

	parsing: function(xml) {
		var html = "";
		var pk = this.currentPk;
		var obj = this.getTagName();
		
		this.tagSeq = 0;
		this.curTagIdx = 0;
		var root = xml.getElementsByTagName("tags")[0];
		if (root != null) {
			var tags = root.getElementsByTagName("tag");
			for (var i = 0; i < tags.length; i++) {	
				var item = tags[i].getElementsByTagName("name")[0].firstChild.nodeValue;
				var colored = this.coloring(obj.value, item);
				html += "<div id=unc-tag-"+pk+"-no-"+(i+1)+" onclick=\"parent.insertTag('"+pk+"','"+item.gsub(/'/, '')+"')\" onmouseover=\"this.style.backgroundColor='#eeeeee';\" onmouseout=\"this.style.backgroundColor='';\">"+(colored.indexOf('<span')== 0? colored:item)+"</div>";
				this.tagSeq++;
			}
		}
		var box = $('unc-tag-box-'+pk);
		//box.style.height = '150px';
		var tag_list = box.contentWindow.document.getElementById('unc-tag-list');
		tag_list.innerHTML = html;
	
		if (this.tagSeq > 0) {
			this.loadBox(true);
		}
		else {
			this.loadBox(false);
		}
	},
	
	ladderKey: function(e) {
		var pk = this.currentPk;
		var key = Web.isIE? window.event.keyCode : e.keyCode;
		if (this.tagSeq > 0) {
			if (key == 40 || key == 38) {
				if (key == 40 && this.curTagIdx < this.tagSeq) {
					this.curTagIdx++;
				}
				else if (key == 38 && this.curTagIdx > 1) {
					this.curTagIdx--;
				}
			
				var box = $('unc-tag-box-'+pk);
				var rw = box.contentWindow.document.getElementById('unc-tag-'+pk+'-no-'+this.curTagIdx);
				this.keystatus = false;
				
				for (var i = 1; i <= this.tagSeq; i++) {
					box.contentWindow.document.getElementById('unc-tag-'+pk+'-no-'+i).style.backgroundColor = '#ffffff';
				}
				
				var tag_list = box.contentWindow.document.getElementById('unc-tag-list');
				if (key == 40) {
					if (this.curTagIdx <= this.tagSeq) {					
						rw.style.backgroundColor = '#eeeeee';
						if (this.curTagIdx > 2) {
							tag_list.scrollTop += 21;
						}
					}
				} 
				else if (key == 38) {
					if (this.curTagIdx > 0) {
						rw.style.backgroundColor = '#eeeeee';
						tag_list.scrollTop -= 21;
					}							
				}
				
				try {
					var obj = this.getTagName();
					obj.value = rw.getAttribute("innerText");
					obj.focus();
				}
				catch(E) {}
				//if (rw)
					//rw.onclick();
			}
			else {
				this.keystatus = true;
			}
		}
	},
	
	setTagMouseOver: function(bul) {
		this.tagMouseOver = bul;
	},
	
	setCurrentPk: function(pk) {
		this.currentPk = pk;
	},
	
	setOldTextBox: function(val) {
		this.oldTextbox = val;
	},
	
	insertTag: function(pk, val) {
		var obj = $('unc-tagsname-'+pk);
		obj.value = val;
		var box = $('unc-tag-box-'+pk);
		box.style.display = 'none';
	},
	
	loadBox: function(bul) {
		var pk = this.currentPk;
		if (bul) {
			if (this.tagSeq > 0 && pk != '') {
				var box = $('unc-tag-box-'+pk);
				var obj = this.getTagName();
				if (obj.value.length > 0) {
					box.style.display = 'inline';
				}
			}
		} 
		else {
			if (!this.tagMouseOver && pk != '') {
				var box = $('unc-tag-box-'+pk);
				box.style.display = 'none';
			}
		}
	},	
	
	getTagName: function() {
		return $('unc-tagsname-'+this.currentPk);
	},
	
	capcureKeyDown: function(e) {
		if (Unc.tagging.currentPk != '') {
			var node = Web.isIE? window.event.srcElement : e.target;
			var textbox = Unc.tagging.getTagName();
			if (textbox == node) {
				Unc.tagging.monitor();
			}
		}
	},

	monitor: function() {
		if (this.currentPk &&
			this.currentPk != '' && 
			this.keystatus) {
			var obj = this.getTagName();
			var textbox = obj.value;			
			if (textbox.strip().length == 0) {
				this.oldTextbox = textbox;
				this.loadBox(false);
			}
	
			if (this.oldTextbox != textbox) {
				Web.Ajax.invoke({action:'ajax-tag.do', params:'tagsName='+encodeURIComponent(textbox), handler:'Unc.tagging.parsing'});
			}
			this.oldTextbox = textbox;
			setTimeout('Unc.tagging.monitor()', 200);
			this.mconti = true;
		} 
		else {
			this.mconti = false;
		}
	}
};

Unc.calendar = {
	target:null,
	stime:null,
	box:null,
	
	over: function() {
		window.clearTimeout(this.stime);
	},
	
	out: function() {
		this.stime = window.setTimeout("Unc.calendar.box.style.display='none';", 200);
	},
	
	click: function(v) {
		this.target.value = v;
		this.box.style.display='none';
	},
	
	day: function(obj) {
		var now = obj.value.split("-");
		this.target = obj;
	
		this.box = $('unc-calendar');
		this.box.style.top = Web.util.Position.objectY(obj) + obj.offsetHeight;
		this.box.style.left = Web.util.Position.objectX(obj)-2;

		this.box.style.display = '';
		
		var ifrm = window.frames["unc-calendar-iframe"];
		if (now.length == 3) {
			ifrm.calendarShow(now[0],now[1],now[2]);					
		} 
		else {
			now = new Date();
			ifrm.calendarShow(now.getFullYear(), now.getMonth()+1, now.getDate());
		}
	},
	
	overit: function(e) {
		var el = Web.isIE? event.srcElement : e.target;
		var d = el.title;
		if (d.length > 7) {
			el.style.borderTopColor = el.style.borderLeftColor = "buttonhighlight";
			el.style.borderRightColor = el.style.borderBottomColor = "buttonshadow";
			el.style.cursor = 'pointer';
		}	
	},
	
	outit: function(e) {
		var el = Web.isIE? event.srcElement : e.target;
		var d = el.title;
		if (d.length > 7) {
			el.style.borderColor = "white";
			el.style.cursor = 'pointer';
		}
	},
	
	day2: function(d) {
		var s = new String();		
		if (parseInt(d) < 10) {
			s = "0" + parseInt(d);
		} 
		else {
			s = "" + parseInt(d);
		}
		return s;	
	},
	
	show: function(y, m, d) {
		var md = new Array(0,31,28,31,30,31,30,31,31,30,31,30,31);
		var hd = new Array('1.1','3.1','5.5','6.6','8.15','10.3','12.25');
		var to = new Date();
		var iy = parseInt(y);
		var im = parseInt(m);
		var id = parseInt(d);
		$('unc-calendar-box').update('');
		
		if (iy == 0) {
			iy = to.getFullYear();
		}
		if (im == 0) {
			im = parseInt(to.getMonth())+1;
		}
		if (id == 0) {
			id = to.getDate();
		}
		
		switch (im) {
			case 1:
				ipy = iy -1;
				ipm = 12;
				iny = iy;
				inm = 2;
				break;
			case 12:
				ipy = iy;
				ipm = 11;
				iny = iy + 1;
				inm = 1;
				break;
			default:
				ipy = iy;
				ipm = parseInt(im) - 1;
				iny = iy;
				inm = parseInt(im) + 1;
				break;
		}
		ippy = iy-1
		inny = iy+1

		ny = to.getFullYear();
		nm = to.getMonth()+1;
		nd = to.getDate();
		
		dfd = new Date(iy, im-1, 1);
		ifw = dfd.getDay();
		
		isw = ifw;
		itw = ifw;
		
		dtd = new Date(iy, im, id);
		itwd = dtd.getDay();
		tpd = 1;

		flg = 0
		if ((iy % 4)==0) {
			if ((iy % 100) == 0) {
				if ((iy % 400) == 0) {
					md[2] = 29;
				}
			} else {
				md[2] = 29;
			}
		}
		ild = md[im];

		txt = "<table id=unc-calendar-tab class=unc-calendar-tab bgcolor='#f4f4f4' border=0 cellpadding=1 cellspacing=1 width=100% onmouseover='Unc.calendar.overit(event)' onmouseout='Unc.calendar.outit(event)'>"+
				"<tr align=center bgcolor='#000066'>"+
				"<td colspan=7 height=25>"+
				"<div style=float:left;padding-left:10px>"+
				"<a class=unc-calendar-title onclick='Unc.calendar.show("+ippy+","+im+","+id+");'>"+ippy+"³â</a> "+
				"<a class=unc-calendar-title onclick='Unc.calendar.show("+ipy+","+ipm+","+id+");'>¢·ÀÌÀü¿ù</a>"+
				"</div>"+
				"<div style=float:right;padding-right:10px>"+
				"<a class=unc-calendar-title onclick='Unc.calendar.show("+iny+","+inm+","+id+");'>ÀÌÈÄ¿ù¢¹</a> "+
				"<a class=unc-calendar-title onclick='Unc.calendar.show("+inny+","+im+","+id+");'>"+inny+"³â</a>"+
				"</div>"+
				"</td></tr>"+
				"<tr align=center bgcolor='#f6f6f6'>"+
				"<td style='padding-top:3px;'><b>ÀÏ</td><td style='padding-top:3px;'><b>¿ù</td><td style='padding-top:3px;'><b>È­</td><td style='padding-top:3px;'><b>¼ö</td><td style='padding-top:3px;'><b>¸ñ</td><td style='padding-top:3px;'><b>±Ý</td><td style='padding-top:3px;'><b>Åä</td>"+
				"</tr>";
			
		for (intLoopWeek=1; intLoopWeek < 7; intLoopWeek++) {
			txt += "<tr align=right bgcolor='white'>"
			for (intLoopDay=1; intLoopDay <= 7; intLoopDay++) {
				if (itw > 0) {
					txt += "<td>";
					itw--;
				} else {
					if (tpd > ild) {
						txt += "<td>";
					} else {
						txt += "<td onClick=Unc.calendar.clickit(this); title="+iy+"-"+Unc.calendar.day2(im).toString()+"-"+Unc.calendar.day2(tpd).toString()+" style=\"cursor:Hand;border:1px solid white;";
						if (iy == ny && im==nm && tpd==id) {
							txt += "background-color:#FEEDF4;font-weight:bold;";
						}
						
						switch(intLoopDay) { 
							case 1:
								txt += "color:#ff0000;";
								break;
							case 7:
								txt += "color:#54A6E2;";
								break;
							default:
						}
						
						for (var i = 0; i < hd.length; i++) {
							if (hd[i] == im+'.'+tpd) {
								txt += "color:#ff0000;";
							}
						}
						
						txt += "\">"+tpd;
						
					}
					tpd++;
					
					if (tpd > ild) {
						flg = 1;
					}
				}
				txt += "</td>";
			}
			txt += "</tr>";
			if (flg==1) break;
		}
	
		txt += "<tr><td colspan=7 align=center height=25 bgcolor=#eeeeee><b>"+iy +"³â "+ im +"¿ù"+"</b></td></tr></table>";
		$('unc-calendar-box').update(txt);
		parent.calendarResize(300, $('unc-calendar-tab').offsetHeight);		
	},
	
	clickit: function(e) {
		parent.calendarClick(e.title);
	}
};

Unc.Popup = {
	init: function(title, contents, width, height, style, loc, left, top) {
		if (loc == 'A') {
			var addX = style == 'A'? 0:6;
			var addY = style == 'A'? 0:35;
			if (style == 'A') {
				left = ((Web.util.Position.screenWidth()/2) - ((parseInt(width)+addX)/2)) + 'px';
				top = (parseInt(height)+addY) > Web.util.Position.screenHeight() ? 0 : (((Web.util.Position.screenHeight()-(parseInt(height)+addY))/2))+'px';
			}
			else {
				left = ((Web.util.Position.clientWidth()/2) - ((parseInt(width)+addX)/2)) + 'px';
				top = (parseInt(height)+addY) > Web.util.Position.clientHeight() ? 0 : (((Web.util.Position.clientHeight()-(parseInt(height)+addY))/2))+'px';
			}
		}
		else if (loc == 'B') {
			left = '0px';
			top = '0px';
		}
		else if (loc == 'C') {
			top = '0px';
			left = (parseInt(Web.util.Position.clientWidth()) - parseInt(width))+'px';
		}
		else if (loc == 'D') {
			// let it be
		}
		
		if (style == 'A') {
		    Web.Window.template({title:title, contents:contents, width:width, height:height, left:left, top:top});
		}
		else if (style == 'B') {
			Web.notice({title:title, contents:contents, width:width, height:height, left:left, top:top});
		}
		else if (style == 'C') {
			Web.information({title:title, msg:contents, width:width, height:height});
		}
		else if (style == 'D') {
			Web.alert({title:title, msg:contents, width:width, height:height});
		}
		else if (style == 'E') {
			alert(contents);
		}
	}
};

Unc.ThumbManager = {
	complete: true,
	hash: new Hash,
	sequence:0,
	put: function(el) {
		this.hash[el.id] = el;
	},
	get: function(id) {				
		return this.hash[id];
	},
	getAll: function() {
		return this.hash;
	},
	getSeq: function() {
		return "unc.p."+(++this.sequence);
	},
	remove: function(id) {
		this.hash.remove(id);		
	},
	removeAll: function() {
		var keys = this.hash.keys();
		for (var i = 0; i < keys.length; i++) {
			this.remove(keys[i]);
		}
	},
	getRecent: function() {
		var keys = this.hash.keys();
		for (var i = 0; i < keys.length; i++) {
			return this.hash[keys[i]];
		}
	},
	hideAll: function() {
		var keys = this.hash.keys();
		for (var i = 0; i < keys.length; i++) {
			this.get(keys[i]).forceHide();
		}
	},
	loading: function(arg) {
		if (!this.complete) return;
		this.complete = false;
		thumb = new Unc.Thumb(arg.bno, arg);
		thumb.loading(arg.bid, arg.bno, arg.left, arg.top);		
	},
	parsing: function(xml) {		
		var root = xml.getElementsByTagName("thumbs")[0];
		if (root != null) {
    		var id = root.getElementsByTagName("boardno")[0].firstChild.nodeValue;
    		var keys = this.hash.keys();
    		for (var i = 0; i < keys.length; i++) {
    			if (keys[i] == id) {
    				this.get(id).parsing(xml);
    			}
    		}
    	}
        else
            this.hideAll();
	},
	show: function(id) {
		var keys = this.hash.keys();
		for (var i = 0; i < keys.length; i++) {
			if (keys[i] == id) {
				this.get(id).show();
			}
		}
	},
	hide: function(id) {
		var keys = this.hash.keys();
		for (var i = 0; i < keys.length; i++) {
			if (keys[i] == id) {				
				this.get(id).hide();
			}
		}
	},
	lock: function(id) {
		var keys = this.hash.keys();
		for (var i = 0; i < keys.length; i++) {
			if (keys[i] == id) {
				this.get(id).lock();
			}
		}
	},
	unlock: function(id) {
		var keys = this.hash.keys();
		for (var i = 0; i < keys.length; i++) {
			if (keys[i] == id) {
				this.get(id).unlock();
			}
		}
	}
};

Unc.Thumb = Class.create();
Unc.Thumb.prototype = {
	initialize: function(id, arg) {
		if (!id) {
			id = Unc.ThumbManager.getSeq();
		}
		this.id = id;
		this.bno = null;
		this.maxw = 0;
		this.curw = 0;
		this.bbong = false;
		this.complete = false;
		this.pspeed = 7;
		this.mspeed = 7;
		this.thumbnails = null;
		Unc.ThumbManager.put(this);
	},
	lock: function() {
		this.bbong = true;
	},
	unlock: function() {
		this.bbong = false;
	},
	loading: function(bid, bno) {
		this.bno = bno;
		this.thumbnails = 'alc-thumb-div-'+bno;
		var div = null;
		if ($(this.thumbnails)) {
			div = $(this.thumbnails);
		}
		else {
			div = Web.Element.createDiv(this.thumbnails);
		}
		
		var y = Web.util.Position.objectY($('alc-thumb-'+bno));
		var x = Web.util.Position.objectX($('alc-thumb-'+bno));
		var left = x + $('alc-thumb-'+bno).width + 2;
		var top = y + 1;

		div.style.position = 'absolute';
		div.style.left = left + 'px';
		div.style.top = top + 'px';
		div.style.visibility = 'visible';
		div.style.display = 'inline';
		div.innerHTML = '<img src=./img/common/board/i_large_loading2.gif>';
		$('unc-plus-'+this.bno).src = './img/common/board/i_minus.gif';
		
		Web.Ajax.invoke({action:'ajax-thumbs.do', params:'boardId='+bid+'&boardNo='+bno, handler:'Unc.ThumbManager.parsing'});
	},
	parsing: function(xml) {
		var txt = "<table cellpadding=2 cellspacing=0 border=0><tr>";
		var siz = 0;
		var root = xml.getElementsByTagName("thumbs")[0];
		var thumbs = [];
		if (root != null) {
			thumbs = root.getElementsByTagName("thumb");
			for (var i = 0; i < thumbs.length; i++) {
				upd = thumbs[i].getElementsByTagName("upload")[0].firstChild.nodeValue;
				//siz = thumbs[i].getElementsByTagName("size")[0].firstChild.nodeValue;
				siz = $fn('unc-cash','thumbnailSize').value||thumbs[i].getElementsByTagName("size")[0].firstChild.nodeValue;
				thm = thumbs[i].getElementsByTagName("filemask")[0].firstChild.nodeValue;
				txt += "<td style=vertical-align:bottom><span style='float:left;padding:0;margin:0'><img src='."+upd+"/thumb/"+thm.substring(0,8)+"/"+thm+"'  onclick=this.src.replace('thumb','editor').viewer() class=unc-pnt ></span></td>";
			}
		}
		var header = "<div onmouseover=javascript:Unc.ThumbManager.lock(\""+this.id+"\") onmouseout=javascript:Unc.ThumbManager.unlock(\""+this.id+"\");setTimeout('Unc.ThumbManager.hide(\""+this.id+"\")',1000) id=unc-thumb-d-"+this.id+" style='margin:0;padding:5px;border:1px solid #ccc;overflow:hidden;width:10px;;background-color: #fff;'>";
		txt = header+txt+"</tr></table></div>";
		this.maxw = ((parseInt(siz)+4)*thumbs.length+12);
		this.curw = 10;
		this.pspeed *= thumbs.length;
		this.mspeed *= thumbs.length;

		if (thumbs.length > 0) {
		    $(this.thumbnails).update(txt);
		    this.show();
        }
        else {
            this.forceHide();
        }
	},
	forceHide: function() {
		this.bbong = false;
        this.complete = true;
        this.curw = 0;
        Unc.ThumbManager.complete = true;
        this.hide();
	},
	hide: function() {
		if (this.bbong) return;
		if (!this.complete) return;
		if (0 < this.curw) {			
			if ($('unc-thumb-d-'+this.id))
				$('unc-thumb-d-'+this.id).style.width = (this.curw)+'px';				
			else
				return;
			if (this.curw / this.maxw * 100 < 30)
				this.mspeed = 10;
			else if (this.curw / this.maxw * 100 < 60)
				this.mspeed = 15;
			this.curw -= this.mspeed;
			setTimeout("Unc.ThumbManager.hide('"+this.id+"')", 5);

		}
		else {			
			$(this.thumbnails).update('');
			$('unc-plus-'+this.bno).src = './img/common/board/i_plus.gif';
			Unc.ThumbManager.remove(this.id);
		}
	},
	show: function() {	
		if (this.maxw > this.curw) {			
			if ($('unc-thumb-d-'+this.id))
				$('unc-thumb-d-'+this.id).style.width = (this.curw)+'px';				
			else
				return;
			if (this.curw / this.maxw * 100 > 80)
				this.pspeed = 10;
			else if (this.curw / this.maxw * 100 > 60)
				this.pspeed = 15;
			
			this.curw += this.pspeed;
			setTimeout("Unc.ThumbManager.show('"+this.id+"')", 5);
		}
		else {
			if ($('unc-thumb-d-'+this.id)) {
				$('unc-thumb-d-'+this.id).style.width = this.maxw+'px';
				this.complete = true;
				Unc.ThumbManager.complete = true;
			}
		}
	}
};

Unc.user = {
	clickX:0,
	clickY:0,
	loading: function(uid, e) {
		e = Web.isIE? window.event : e;
		var div = null;
		if ($("unc-user-view")) {
			div = $("unc-user-view");
		}
		else {
			div = document.createElement("div");
			div.setAttribute("id", "unc-user-view");
			document.body.appendChild(div);	
		}
		div.style.left = (e.clientX - 5 + Web.util.Position.deltaX()) + 'px';
		div.style.top = (e.clientY + 1 + Web.util.Position.deltaY()) + 'px';
		this.clickX = div.style.left;
		this.clickY = div.style.top; 
		div.innerHTML = '<img src=./img/common/board/i_large_loading2.gif>';
		div.style.visibility = 'visible';
		Web.Ajax.invoke({action:'ajax-member-view.do', params:'userId='+uid, handler:'Unc.user.parsing'});
	},
	parsing: function(xml) {
		var root = xml.getElementsByTagName("users")[0];
		if (root != null) {
			var user = root.getElementsByTagName("user")[0];
			var uid = user.getElementsByTagName("uid")[0].firstChild.nodeValue;
			var photo = user.getElementsByTagName("photo")[0].firstChild.nodeValue;
			var level = user.getElementsByTagName("level")[0].firstChild.nodeValue;
			var levelterm = user.getElementsByTagName("levelterm")[0].firstChild.nodeValue;
			var levelgage = user.getElementsByTagName("levelgage")[0].firstChild.nodeValue;
			var point = user.getElementsByTagName("point")[0].firstChild.nodeValue;
			var uname = user.getElementsByTagName("uname")[0].firstChild.nodeValue;
			var nick = user.getElementsByTagName("nick")[0].firstChild.nodeValue;
			var grade = user.getElementsByTagName("grade")[0].firstChild.nodeValue;
			var email = user.getElementsByTagName("email")[0].firstChild.nodeValue;
			var tel1 = user.getElementsByTagName("tel1")[0].firstChild.nodeValue;
			var tel2 = user.getElementsByTagName("tel2")[0].firstChild.nodeValue;
			var tel3 = user.getElementsByTagName("tel3")[0].firstChild.nodeValue;
			var hp1 = user.getElementsByTagName("hp1")[0].firstChild.nodeValue;
			var hp2 = user.getElementsByTagName("hp2")[0].firstChild.nodeValue;
			var hp3 = user.getElementsByTagName("hp3")[0].firstChild.nodeValue;
			var birthday = user.getElementsByTagName("birthday")[0].firstChild.nodeValue;
			var wedding = user.getElementsByTagName("wedding")[0].firstChild.nodeValue;
			var post = user.getElementsByTagName("post")[0].firstChild.nodeValue;
			var addr = user.getElementsByTagName("addr")[0].firstChild.nodeValue;
			var talk = user.getElementsByTagName("talk")[0].firstChild.nodeValue;
			var visitdt = user.getElementsByTagName("visitdt")[0].firstChild.nodeValue;
			var actives = user.getElementsByTagName("active");
			var bests = user.getElementsByTagName("best");
			
			var active_set = new Array();
			for (var k = 0; k < actives.length; k++) {
				var active = actives[k];
				var board = active.getElementsByTagName("board")[0].firstChild.nodeValue;
				var write = active.getElementsByTagName("write")[0].firstChild.nodeValue;
				var reply = active.getElementsByTagName("reply")[0].firstChild.nodeValue;
				var memo = active.getElementsByTagName("memo")[0].firstChild.nodeValue;
				active_set[k] = new Unc.user.history(board, write, reply, memo);
			}
			var best_set = new Array();
			for (var k = 0; k < bests.length; k++) {
				var best = bests[k];
				var board = best.getElementsByTagName("board")[0].firstChild.nodeValue;
				var write = best.getElementsByTagName("write")[0].firstChild.nodeValue;
				var reply = best.getElementsByTagName("reply")[0].firstChild.nodeValue;
				best_set[k] = new Unc.user.history(board, write, reply);
			}
	
			var txt = ""+				
					"<fieldset class=main>"+
					"<table width=100%>"+
						"<tr><td width=70 class=subject>¾ÆÀÌµð</td><td class=unc-verdana><strong>"+uid+"</strong></td></tr>"+
						"<tr><td class=subject>Æ÷ÀÎÆ®</td><td class=unc-verdana><strong>"+point+"</strong> Á¡</td></tr>"+
						"<tr><td class=subject>·¹º§</td><td>"+level+"</td></tr>"+
						"<tr><td class=subject>´ÙÀ½·¹º§¾÷</td><td class=unc-verdana>"+levelterm+" "+levelgage+"%</td></tr>"+
						"<tr><td class=subject>µî±Þ</td><td>"+grade+"</td></tr>"+
						(uname.strip().length > 0 ? "<tr><td class=subject>ÀÌ¸§</td><td>"+uname+"</td></tr>":"")+
						(photo.strip().length > 0 ? "<tr><td class=subject>»çÁø</td><td>"+photo+"</td></tr>":"")+
						(email.strip().length > 0 ? "<tr><td class=subject>ÀÌ¸ÞÀÏ</td><td class=unc-verdana>"+email+"</td></tr>":"")+
						(tel1.strip().length > 0 && tel2.strip().length > 0 && tel3.strip().length > 0 ? "<tr><td class=subject>ÀüÈ­</td><td class=unc-verdana>"+tel1+"-"+tel2+"-"+tel3+"</td></tr>":"")+
						(hp1.strip().length > 0 && hp2.strip().length > 0 && hp3.strip().length > 0 ? "<tr><td class=subject>ÇÚµåÆù</td><td class=unc-verdana>"+hp1+"-"+hp2+"-"+hp3+"</td></tr>":"")+
						(birthday.strip().length == 8 ? "<tr><td class=subject>»ýÀÏ</td><td>"+birthday.substring(0,4)+"."+birthday.substring(4,6)+"."+birthday.substring(6,8)+"</td></tr>":"")+
						(wedding.strip().length == 8 ? "<tr><td class=subject>°áÈ¥±â³äÀÏ</td><td>"+wedding.substring(0,4)+"."+wedding.substring(4,6)+"."+wedding.substring(6,8)+"</td></tr>":"")+
						(post.strip().length > 0 ? "<tr><td class=subject>¿ìÆí¹øÈ£</td><td class=unc-verdana>"+post+"</td></tr>":"")+
						(addr.strip().length > 0 ? "<tr><td class=subject>ÁÖ¼Ò</td><td class=unc-verdana>"+addr+"</td></tr>":"")+
						(talk.strip().length > 0 ? "<tr><td class=subject>Àâ´ã</td><td class=talk>"+talk+"</td></tr>":"")+
						"<tr><td class=subject>È°µ¿ÀÌ·Â</td><td><div style='height:100px;overflow:auto;border:1px solid #eeeeee;'><table class=history><tr bgcolor=#eeeeee><td>°Ô½ÃÆÇ</td><td>±ÛÀÛ¼º</td><td>±Û´äº¯</td><td>´ñ±Û¼ö</td></tr>";
			
			for (var i = 0; i < active_set.length; i++) {
			txt += "<tr><td>"+active_set[i].board+"</td><td>"+active_set[i].write+"</td><td>"+active_set[i].reply+"</td><td>"+active_set[i].memo+"</td></tr>";
			}
			txt += 				"</table></div></td></tr>"+
					"<tr><td class=subject>º£½ºÆ®ÀÌ·Â</td><td><div style='height:100px;overflow:auto;border:1px solid #eeeeee;'><table class=history><tr bgcolor=#eeeeee><td>°Ô½ÃÆÇ</td><td>¸¶°¨¼ö</td><td>Ã¤ÅÃ¼ö</td></tr>";
			for (var i = 0; i < best_set.length; i++) {
			txt += "<tr><td>"+best_set[i].board+"</td><td>"+best_set[i].write+"</td><td>"+best_set[i].reply+"</td></tr>";
			}
			txt += 				"</table></div></td></tr>"+
						(visitdt.strip().length > 0 ? "<tr><td class=subject>ÃÖ±Ù¹æ¹®ÀÏ</td><td class=unc-verdana>"+visitdt+"</td></tr>":"")+
					"</table>"+
				"</fieldset>";
	
			Web.UserViewerManager.view({
					uid: uid,
					nick: nick,
					content: txt,
					x: this.clickX,
					y: this.clickY});
		}
		else {
			Web.alert({title:'Á¤º¸', msg:'Á¶È¸µÈ È¸¿øÀÌ ¾ø½À´Ï´Ù'});
		}
		$("unc-user-view").update('');
	},
	history: function(b,w,r,m) {
		this.board = b;
		this.write = w;
		this.reply = r;
		this.memo = m;	
	},
	hide: function() {
		if ($("unc-user-view")) {
			$("unc-user-view").update('');
			$("unc-user-view").style.visibility = 'hidden';	
		}
	}
};

Unc.Cookie = {
	getCookie: function(cookieName) {
		var val = null;
		var cookie = document.cookie;
		var f = cookie.indexOf(cookieName+"=");
		if (f > -1) {
			var s = cookie.substring(f, cookie.length);
			var l = s.indexOf(';');
			if (l == -1) l = cookie.length;
			var c = s.substring(0, l).split('=');			
			val = unescape(c[1]);
		}
		return val;
	},
	setCookie: function(cookieName, cookieValue, day) {
		var date = new Date();
		date.setDate(date.getDate()+parseInt(day));
		var expire = parseInt(day)>-1? 'expires='+date.toGMTString()+'; ':'';		
		document.cookie = cookieName+'='+escape(cookieValue)+'; path=/; '+expire;		
	},
	delCookie: function(cookieName) {
		var date = new Date();
		date.setDate(date.getDate()-1);
		document.cookie = cookieName+'=; expires='+(date.toGMTString())+'; path=/';
	}
};

Unc.Timeout = {
	time: 0,
	limit: 60*20,
	init: function(isLogin, timeout) {
		this.limit = timeout*60;
		if (isLogin == 'TRUE')
			setTimeout('Unc.Timeout.plus()', 1000);
	},
	plus: function() {
		this.time++;		
		if (parseInt(this.time) > parseInt(this.limit)) {
			Web.confirm({title:'Á¤º¸', msg:'¾ÈÀüÇÑ À¥À»À§ÇØ <b>'+(this.limit/60)+'</b>ºÐµ¿¾È ¹ÝÀÀÀÌ ¾ø¾î¼­<br><b>ÀÚµ¿ ·Î±×¾Æ¿ô</b> µÇ¾ú½À´Ï´Ù<br><br>´Ù½Ã ·Î±×ÀÎ ÇØÁÖ¼¼¿ä <br><br>',fnok: function(){link('logout.do?link=login.do');},fncancel: function(){link('logout.do');},width:400,height:200});
		}
		else {
			setTimeout('Unc.Timeout.plus()', 1000);
		}
	}
};



