var date_val = new Date();
var datepicker_json = {
	dateFormat: "yy-mm-dd",    /* 날짜 포맷 */ 
	prevText: 'prev',
	nextText: 'next',
	showButtonPanel: true,    /* 버튼 패널 사용 */ 
	changeMonth: true,        /* 월 선택박스 사용 */ 
	changeYear: true,        /* 년 선택박스 사용 */ 
	showOtherMonths: true,    /* 이전/다음 달 일수 보이기 */ 
	selectOtherMonths: true,    /* 이전/다음 달 일 선택하기 */ 
	closeText: '닫기', 
	currentText: '초기화', 
	showMonthAfterYear: true,        /* 년과 달의 위치 바꾸기 */ 
	/* 한글화 */ 
	monthNames : ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'], 
	monthNamesShort : ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'], 
	dayNames : ['일', '월', '화', '수', '목', '금', '토'],
	dayNamesShort : ['일', '월', '화', '수', '목', '금', '토'],
	dayNamesMin : ['일', '월', '화', '수', '목', '금', '토'],
	showAnim: 'slideDown',
	yearRange:  "-100:+0",
	onSelect:function(dateText, inst){
	}
};



/*
png24
*/
var setPng24 = function(obj) {
	if(navigator.userAgent.toLowerCase().indexOf("msie 6")!=-1) {
		if(navigator.userAgent.toLowerCase().indexOf("msie 8")==-1 && navigator.userAgent.toLowerCase().indexOf("msie 7")==-1) {
			obj.width=obj.height=1;
			obj.className=obj.className.replace(/\bpng24\b/i,'');
			obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');";
			obj.src=' 여기 1*1 투명 gif삽입 ';
		}
	}
	return '';
};


String.prototype.toInteger = function() {
	return this.replace(/[^0-9]/g, '') * 1;
};


/*
http://phpschool.com/gnuboard4/bbs/board.php?bo_table=qna_html&wr_id=149287&sca=&sfl=wr_subject%7C%7Cwr_content&stx=%B1%DB%C0%DA%BC%F6&sop=and&page=2
머슴님의 글을 가져왔습니다.
*/
String.prototype.bytes = function() {
	var str = this;
	var l = 0;
	var len = str.length;
	for (var i=0; i<len; i++) l += (str.charCodeAt(i) > 128) ? 2 : 1;
	return l;
};



var util = function() {

	this.ifr_height = new Array(); // : iframe크기값 저장하는곳
	this.ifr_height2 = new Array(); // : iframe크기값 저장하는곳
	this.ifr_height3 = new Array(); // : iframe크기값 저장하는곳

	this.myRequests = {};

	/* div로 키보드 화살표 위아래 이동시 위치값. */
	this.key_div_move_chk_count = -1;
	this.not_key_button = [12,33,34,35,36,37,38,39,40,   112,113,114,115,116,117,118,119,120,121,122,123,    145,19,     20,16,17,18,21,91,92,27,93,25,     45,46,144];



	/* : 마우스 드레그시 사용하는 변수 */
	this.bdown = false;
	this.x, this.y;
	this.sElem;

	/* div마우스 무브시 top값 기억하기 */
	this.save_top = 0;

	/* object값과 object의 innerHTML값 기억하기 - input type="file"에서 값 지워진 상태로 다시 돌릴때 사용합니다. */
	this.inner_obj = '';
	this.inner_innerHTML = '';

	/* 확장자 체크값. */
	this.ext_value = '';

	this.date = new Date();

	// : 모바일 기본 글자 크기
	this.font_size = 0;

	/* : onLoad */
	this.onload_func = function() {
		util.select_img();
		util.startBlink();
	};


/*#######################
// : 펌 자료 - http://phpschool.com/gnuboard4/bbs/board.php?bo_table=tipntech&wr_id=38633&sca=&sfl=wr_subject%7C%7Cwr_content&stx=%B5%FB%B6%F3%B4%D9&sop=and
// : 글쓴이 - 송효진
// : 감사합니다~
#######################*/
	this.origin_top = {};
	this.limit_top = {};
	this.margin_top = {};
	this.follow_banner = function(div_id, origin_top, limit_top, margin_top) {
		var d, t, s, g, target_height;

		if(!this.origin_top[div_id]) this.origin_top[div_id] = origin_top;
		if(!this.limit_top[div_id]) this.limit_top[div_id] = limit_top;
		if(!this.margin_top[div_id]) this.margin_top[div_id] = margin_top;

		this.origin_top[div_id] *= 1;
		this.limit_top[div_id] *= 1;
		this.margin_top[div_id] *= 1;

		d = document.getElementById(div_id);
		s = document.body.scrollTop + "";

		target_height = s.toInteger() + this.margin_top[div_id];
		if(target_height < this.limit_top[div_id]) {
			target_height = this.origin_top[div_id];
		}

		t = d.style.top.toInteger();

		if(t != target_height) {
			g = Math.ceil((t - target_height) / 5);
			if(g > 50) {
				g = 50;
			} else if (g < -50) {
				g = -50;
			}

			switch(d.className) {
				case 'mouse_drag':
					var divHeight = d.style.top.toInteger() - document.getElementsByTagName('body')[0].scrollTop;
					if(g<=0 || divHeight>=450) d.style.top = (t - g) + "px";
					break;
				default:
					d.style.top = (t - g) + "px";
					break;
			}
		}

		setTimeout("util.follow_banner('" + div_id + "', " + this.origin_top[div_id] + ", " + this.limit_top[div_id] + ", " + this.margin_top[div_id] + ");", 5);
	};




/*#######################
// : 청명공자님 펌 - 펌주소[http://phpschool.com/gnuboard4/bbs/board.php?bo_table=tipntech&wr_id=61953&sca=&sfl=wr_subject%7C%7Cwr_content&stx=%B7%D1%B8%B5&sop=and]
// : 자스클래스라 좀 바꿨습니다. 이해해주세요~ ^^;
// : 감사합니다~
#######################*/
	this.scrolling = function (objId,sec1,sec2,speed,height) {
		this.objId=objId;
		this.sec1=sec1;
		this.sec2=sec2;
		this.speed=speed;
		this.height=height;
		this.h=0;
		this.div=document.getElementById(this.objId);
		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;};
		this.this_type = 'next';
		var self=this;
		this.div.scrollTop=0;
		window.setTimeout(function(){self.play()},this.sec1);
	};
	this.scrolling.prototype = {
		play:function(){
			if(!this) return false;
			var self=this;
			if(!this.div.isover){
				this.div.scrollTop+=this.speed;
				if(this.div.scrollTop>this.div.scrollHeight/2){
					this.div.scrollTop=0;
				}else{
					this.h+=this.speed;
					if(this.h>=this.height){
						if(this.h>this.height|| this.div.scrollTop%this.height !=0){
							switch(this.this_type) {
								case 'prev':
									this.div.scrollTop-=this.h%this.height;
									break;
								default:
									this.div.scrollTop+=this.h%this.height;
									break;
							}
						}
						this.h=0;
						window.setTimeout(function(){self.play()},this.sec1);
						return;
					}
				}
			}
			window.setTimeout(function(){self.play()},this.sec2);
		},
		prev:function(){
			if(this.div.scrollTop == 0)
			this.div.scrollTop = this.div.scrollHeight/2;
			this.div.scrollTop -= this.height;
		},
		next:function(){
			if(this.div.scrollTop ==  this.div.scrollHeight/2)
			this.div.scrollTop =0;
			this.div.scrollTop += this.height;
		},
		prev_rolling:function() {
			this.this_type = 'prev';
			new util.scrolling(this.objId, this.sec1, 1, 1, this.height)
		},
		next_rolling:function() {
			this.this_type = 'next';
			new util.scrolling(this.objId, this.sec1, 1, 1, this.height)
		}
	};




/*#######################
// :  날짜검색 select테그
#######################*/
	this.search_date = function(id) {
		/* : 년도 */
		var doc_year = document.createElement("select");
		for(var i=1; i<=12; i++) {
		}
	};


/*#######################
// :  페이지 이동
#######################*/
	this.move_page = function(page) {
		switch(page.indexOf("http://")!=-1) {
			case true:
				location.href = page;
				break;
			default:
				location.href = root+page;
				break;
		}
	};


/*#######################
// :  페이지 이동
#######################*/
	this.window_move_page = function(page) {
		switch(page.indexOf("http://")!=-1) {
			case true:
				var url = root+page;
				break;
			default:
				var url = page;
				break;
		}
		window.open(url);
	};


	/*############################################
	배열 체크하기.
	############################################*/
	this.in_array = function(value, obj) {
		var len = obj.length;
		for(var i=0; i<len; i++) {
			if(value==obj[i]) {
				return true;
			}
		}
		return false;
	};


/* 박스 닫기 */
	this.div_close = function(id) {
		document.getElementById(id).style.display = 'none';
	}



/* : 박스창 열기 */
	this.box_window = function(no, mode) {
		window.open("/Libs/_box/mini_info.php?no="+no+"&mode="+mode,"interview","width=400,height=280,status=yes,scrollbars=yes");
	};


	/*############################################
	스크립트 뒤에 붙인 값
	############################################*/
	var Request = function (str) {
		var Values = (String(str).indexOf("?") > 0) ? String(str).replace(/.[^?]+\?/,"").split("&") : null;
		var len = Values.length;
		for (var i=0; i<len; i++) {
			var Redim = [
				Values[i].substr(0,Values[i].indexOf("=")),
				Values[i].substr(Values[i].indexOf("=") + 1,Values[i].length - Values[i].indexOf("=") - 1)
			];
			this[Redim[0]] = Redim[1];
		}
	};
	/*############################################
	스크립트 뒤에 붙인 값의 키값은 파일명입니다.
	예) http://apis.daum.net/maps/maps2.js?apikey=abcde를 불러올때
	this.myRequests[maps2.js][apikey]변수는 뒤의 값을 가지고 옵니다.
	############################################*/
	this.script_value = function() {
		var script_obj = document.getElementsByTagName("script");
		var len = script_obj.length;
		for(var i=0; i<len; i++) {
			/*src값 없으면 넘기기*/
			if(!script_obj[i].src) continue;
			var script_src = script_obj[i].src.split("/");
			if(script_src[script_src.length-1].indexOf("?")>0) {
				var script_src_filename = script_src[script_src.length-1].substr(0,script_src[script_src.length-1].indexOf("?"));
				this.myRequests[script_src_filename] = new Request(script_obj[i].src);
			}
		}
	};




/*############################################
submit버튼이 아닐경우 실행하는 함수
############################################*/
	this.submit_regist = function(el, fname, msg) {
		if(confirm(msg)) {
			var form = document.forms[fname];
			var mode = el.getAttribute("mode");
			var check_name = el.getAttribute("check_name");
			var check_name_obj = document.getElementsByName(check_name);
			if(check_name_obj) {
				var len = check_name_obj.length;
				var count = 0;
				do{
					if(!check_name_obj[count].value) {
						alert("수정해야할 값을 입력해주시기 바랍니다.");
						check_name_obj[count].focus();
						return false;
						break;
					}
					count++;
				}while(count<len);
			}
			form.mode.value = mode;
			form.submit();
		}
	}


/*#################################################################
// : 라디오박스 체크여부
#################################################################*/
	this.radio_check = function(name, value) {
		var obj = (name=='[object]') ? name : document.getElementsByName(name);
		var len = obj.length;
		for(var i=0; i<len; i++) {
			if(obj[i].checked===true) {
				if(value!='undefined') return obj[i].value;
				else return true;
			}
		}
		return false;
	};


/*#################################################################
// : 라디오박스 체크하기
#################################################################*/
	this.radio_checked = function(name, value) {
		var obj = (name=='[object]') ? name : document.getElementsByName(name);
		var len = obj.length;
		for(var i=0; i<len; i++) {
			if(obj[i].value==value) obj[i].checked = true;
		}
		return false;
	};


/*#################################################################
// : 체크박스 - 전체선택기능, 선택된 체크박스 갯수도 뽑아온다. [ 체크박스 전체선택 ]
// : 체크박스로 전체선택, 선택한 갯수구하는함수
#################################################################*/
	this.checkbox_allcheck	= function (el, setName, msg) {

		var id = el.getAttribute('id');
		var tailname = el.getAttribute('tailname');

		var chk_all = (id) ? document.getElementsByName(id) : "";
		var chk_check = el.getAttribute("check");
		var chk = document.getElementsByName(tailname);
		var chk_num = 0;
		var setName_value = new Array();

		var true_attri = el.getAttribute("true");
		var false_attri = el.getAttribute("false");
		true_attri = true_attri ? true_attri : '전체선택';
		false_attri = false_attri ? false_attri : '전체취소';

		if(chk.length<=0) {
			var msgs = msg ? msg : '정보가 존재하지 않습니다.';
			alert(msgs);
			return false;
		}

		var len = chk.length;
		for(var i=0; i<len; i++) {
			if(chk_check) {
				chk_check=='false' ? el.setAttribute("check","true") : el.setAttribute("check","false");
				chk[i].checked = (el.getAttribute("check")=='true') ? true : false;
				el.alt = el.getAttribute("check")=='true' ? "전체취소" : "전체선택";
				el.src = el.getAttribute("check")=='true' ? false_attri : true_attri;
			} else if(!!id) {
				chk[i].checked = (el.checked==true) ? true : false;
			}
			chk_num = (chk[i].checked==true) ? ++chk_num : chk_num ;
			if(setName && chk[i].checked===true) setName_value[i] = chk[i].getAttribute(setName);
		}

		var len = chk_all.length;
		for(var i=0; i<len; i++) {
			chk_all[i].checked = (el.checked===true) ? true : false;
		}

		if(setName) return [chk_num, setName_value];
		else return chk_num;
	};


/*#################################################################
//#	선택삭제등... 선택해서 어떤 모종의 작업을 하기 위해서 사용함
//#	[el : this, name :form이름, word:확인/취소문구, type:갯수알아보기위한것, func:함수넣기 ]
//#	func값이 있으면 action을 실행하지 않습니다.
#################################################################*/
	this.checkbox_alldelete	= function (el, name, word, type, func, msg) {
		var fname = (name) ? name : el.form.getAttribute('name');
		var mode = el.getAttribute('mode');
		var url = el.getAttribute('url');
		var form = document.forms[fname];

		if(el.getAttribute("etc_value")) form.etc_value.value = el.getAttribute("etc_value");

		/*선택된 갯수 알아오기*/
		var num = util.checkbox_allcheck(el, '', msg);
		if(num===false) return false;
		if(type) return num; // : 이 if문은 갯수를 알아내기 위한 if문임. 그러므로 위에 먼저 if문이 있어야함.

		if(num<=0) {
			alert("최소한 한개 이상은 선택하셔야합니다.");
			return false;
		} else {
			if(confirm(word)) {
				if(func) {
					eval(func);
				} else {
					form.mode.value	= mode;
					if(url)	form.action	= url;
					form.submit();
				}
			}
		}
		return true;
	};



/*#################################################################
//#	해당 obj안에 있는 form들 needed값 없앴다 나타냈다 하기
#################################################################*/
	this.form_tag_needed_check = function(obj, code) {
		var len = obj.length;
		if(len<=0) return false;
		var count = 0;
		do{
			var hname_is = obj[count].getAttribute("hname");
			// : hname값이 있을때에만 작동합니다.
			if(hname_is) {
				switch(code) {
					case "set":
						obj[count].setAttribute("needed", "needed");
						break;
					default:
						obj[count].removeAttribute("needed");
						break;
				}
			}
			count++;
		}while(count<len);
	};


/*#################################################################
//#	div 보이기
#################################################################*/
	this.div_view = function(el, divid) {
		var obj = document.getElementById(divid);
		obj.style.display = (obj.style.display=="none") ? "block" : "none";
	};




/*#################################################################
//#	div[] 보이기
#################################################################*/
	this.div_object_view = function(divid, count) {
		var obj = document.getElementsByName(divid);
		obj[count].style.display = (obj[count].style.display=="none") ? "block" : "none";
	};


/*#################################################################
//#	div[] 한개만 보이고 다 가리기
#################################################################*/
	this.div_object_view_one = function(divid, count) {
		var obj = document.getElementsByName(divid);
		var counts = 0;
		var len = obj.length;
		if(len>0) {
			do{
				obj[counts].style.display = (counts==count) ? "block" : "none";
				counts++;
			}while(counts<len);
		}
	};



/*#################################################################
//#
#################################################################*/
	this.div_location_view = function(id, x, y) {
		var obj = document.getElementById(id);
		var body_size = parseInt(document.body.offsetWidth);
		var obj_size = parseInt(obj.style.width);
		switch(x) {
			case "left":
				obj.style.left = 0;
				break;
			case "center":
				obj.style.left = (body_size-obj_size)/2;
				break;
			case "right":
				obj.style.left = body_size - (body_size-obj_size);
				break;
			default:
				x = parseInt(x);
				y = parseInt(y);
				obj.style.left = x;
				break;
		}
		obj.style.top = y;
		obj.style.display = "block";
	};


/*#################################################################
//#	id : 기준이 되는 위치
//#	viewid : 보여줄 div박스
#################################################################*/
	this.div_center_view = function(id, viewid) {
		var obj = document.getElementById(id);
		var width1 = parseInt(obj.offsetWidth);
		var height1 = parseInt(obj.offsetHeight);
		var obj2 = document.getElementById(viewid);
		var width2 = parseInt(obj2.offsetWidth);
		var height2 = parseInt(obj2.offsetHeight);

		switch(width2) {
			case 0:
				var left_value = width1 / 2 - width2 / 2;
				var top_value = height1 / 2 - height2 / 2;
				obj2.style.top = top_value;
				obj2.style.left = left_value;
				obj2.style.display = "block";
				break;
		}

		obj2 = document.getElementById(viewid);
		width2 = parseInt(obj2.offsetWidth);
		height2 = parseInt(obj2.offsetHeight);

		var left_value = width1 / 2 - width2 / 2;
		var top_value = height1 / 2 - height2 / 2;
		obj2.style.top = top_value;
		obj2.style.left = left_value;
		obj2.style.display = "block";
	};


/*#################################################################
//#	div[] 보이기2 --> 자신만 보이고 나머지는 자동으로 가려집니다. - 자신 다시 클릭하면 가려집니다.
#################################################################*/
	this.me_div_object_view = function(divid, count) {
		var obj = document.getElementsByName(divid);
		var len = obj.length;
		var count2 = 0;
		do{
			obj[count2].style.display = (count==count2 && obj[count2].style.display=='none') ? "block" : "none";
			count2++;
		}while(count2<len);
	};



/*#################################################################
//#	div 위치값 구하기
//#	퍼온곳 : http://www.phpschool.com/gnuboard4/bbs/board.php?bo_table=qna_html&wr_id=21902
//#	글쓴이 : 참이삭
//#	감사합니다~
#################################################################*/
/* : 가로*/
	this.getPageX = function(el)
	{
		return (!el||el==document.body) ? 0 : el.offsetLeft + this.getPageX(el.offsetParent);
	};
/* : 세로*/
	this.getPageY = function(el)
	{
		return (!el||el==document.body) ? 0 : el.offsetTop  + this.getPageY(el.offsetParent);
	};


/* : 현재페이지의 스크롤 가로 중앙값*/
	this.scrollX = function(el) {
		var left = (!el||el==document.body) ? 0 : document.body.scrollLeft;
		var size = left + (document.body.offsetWidth/2)-(el.offsetWidth/2);
		return (window.attachEvent) ? size/2 : size;
	};
/* : 현재페이지의 스크롤 세로 중앙값*/
	this.scrollY = function(el) {
		var top = (!el||el==document.body) ? 0 : document.body.scrollTop;
		var size = top + (document.body.offsetHeight/2)-(el.offsetHeight/2);
		return (window.attachEvent) ? size : size/2;
	};


	/*박스 클릭시 바로 근처에 나타나게*/
	this.divBox_site = function(divId, left, top, el) {
		var divObj = document.getElementById(divId);
		var width = 0;
		var height = 0;
		var view_type = "";

		if(el) var view_type = el.getAttribute("view_type");
		switch(view_type!='this') {
			case true:
				width = window.event.clientX;
				height = window.event.clientY;
				break;
			default:
				var width = divObj.offsetWidth;
				var height = divObj.offsetHeight;
				break;
		}
		divObj.style.left = width + document.body.scrollLeft + left;
		divObj.style.top = height + document.body.scrollTop + top;
		if(divObj.style.display=="none") divObj.style.display="";
	};



/*#################################################################
//#	글자수 카운트 [ textarea에서 글자수 세는것입니다. ]
#################################################################*/
	this.cal_pre = function(f,el, max) {
		max = max ? max : 99999;
		var hidden = document.getElementById(el.name+'_hidden');
		var obj_name = f ? f : 'textarea_length_span';
		var doc = document.getElementById(obj_name);
		var size_check = el.value;
		var length_value = size_check.bytes();
		if(length_value>max) {
			alert(max+'자 이하로 입력해주시기 바랍니다.');
			if(hidden) el.value = hidden.value;
		} else {
			if(size_check) {
				doc.innerHTML = size_check.bytes();
				if(hidden) hidden.value = el.value;
			}
		}
	};


/*#################################################################
//#	select 테그 이미지화 하기
#################################################################*/
	this.select_img = function() {
		var count = 0;
		var doc = document.getElementsByTagName("select");
		var len = doc.length;
		while(count<len) {
			var type = doc[count].getAttribute("type");
			if(type=='img') {
				util.select_img_create(doc[count], count);
			}
			count++;
		}
	};
	/* : select테그 누를때 발생하는 이벤트*/
	this.select_img_onClick = function(el, type) {
		alert("menu_click");
		var obj = document.getElementById(el);
		switch(type) {
			case "over":
				obj.style.display = (obj.style.display=="") ? "none" : "";
				break;
			default:
				obj.style.display = "none";
				break;
		}
	};
	/* : option부분에서 선택했을시*/
	this.select_img_option_onClick = function(el, doc, parentObj) {
		var parentObj = document.getElementById(parentObj);
		alert("option_click");
		var input = document.createElement("input");
		input.name = doc.name;
		input.type = 'hidden';
		input.value = el.getAttribute("value");
		doc.parentNode.innerHTML = doc_cre.innerHTML;
		parentObj.style.display = "";
	};
	/* : select 테그 이미지화 하기*/
	this.select_img_create = function(doc, num) {
		var count = 0;
		var doc_name = doc.name;
		var doc_cre = document.createElement("div"); /* : 전체 obj*/
		var span1 = document.createElement("span"); /* : 왼쪽obj*/
		var span2 = document.createElement("span"); /* : 가운데 obj*/
		var span3 = document.createElement("span"); /* : 우측 obj*/
		var div_options = document.createElement("div"); /* : 가운데의 레이어*/
		/*div_options.style.marginTop = 50;*/

		doc_cre.style.backgroundColor = "#ffffff"; /* : 바탕색은 흰색*/
		span2.id = doc_name+"_select_img["+count+"]";
		span2.onClick = "util.select_img_onClick('"+doc_name+"_select_img_options_div["+num+"]', 'over')";
		span2.style.cursor = "pointer";
		/*span2.onMouseOver = 'util.select_img_onClick("select_img_options_div['+num+']", "over")';*/

		/* : select테그의 option박스 단어 style시키기.*/
		div_options.style.zIndex = -1;
		div_options.style.backgroundColor = "#dddddd";
		div_options.id = doc_name+"_select_img_options_div["+num+"]";
		div_options.style.position = "absolute";
		div_options.onMouseOut = "util.select_img_onClick('"+doc_name+"_select_img_options_div["+num+"]', 'out')";

		/* : 이미지 붙이기.*/
		span1.innerHTML = '[';/*'<img src="" align="absmiddle" border="0" alt="왼쪽">';*/
		span2.innerHTML = doc.options[doc.selectedIndex].text;
		span3.innerHTML = ']';/*'<img src="" align="absmiddle" border="0" alt="오른쪽">';*/
		doc_cre.appendChild(span1);
		doc_cre.appendChild(span2);
		doc_cre.appendChild(span3);

		/* : 가운데의 레이어 생성*/
		var div_option = document.createElement("div");
		div_option.style.paddingTop = 5;
		div_option.innerHTML = '&nbsp;';
		div_options.appendChild(div_option);
		var len = doc.length;
		while(count<len) {
			var div_option = document.createElement("div");
			div_option.onClick = "util.select_img_option_onClick(this, "+doc+", '"+doc_name+"_select_img_options_div["+num+"]')";
			div_option.style.cursor = "pointer";
			div_option.style.paddingTop = 5;
			div_option.innerHTML = doc[count].text;
			div_option.setAttribute("value", doc[count].value);
			div_options.appendChild(div_option);
			count++;
		}

		/* : select테그 붙이기작업*/
		doc.parentNode.innerHTML = doc_cre.innerHTML;
		div_options.style.display = "none";
		document.body.appendChild(div_options);
		var span2_doc = document.getElementById(doc_name+"_select_img["+num+"]");
		var div_options_doc = document.getElementById(doc_name+"_select_img_options_div["+num+"]");
		var x = util.getPageX(span2_doc);
		var y = util.getPageY(span2_doc);
		div_options_doc.style.left = x;
		div_options_doc.style.top = y;
	};


/* : 회원에게 메일 보내기*/
	this.email_send = function(el, code, add_get) {
		var email = el.getAttribute("email");
		var from_email = el.getAttribute("from_email");
		var uid = el.getAttribute("uid");
		var from = el.getAttribute("from");

		// : 게시판에서 보내는 메일과 같은거 씁니다. - module/netk_board/netk_board.class.js페이지의 member_box_view함수
		window.open(root+"module/netk_board/index.php?&code="+code+"&uid="+uid+"&email="+email+"&from="+from+"&from_email="+from_email+"&"+add_get, "basic_email", "width=500, height=420,status=yes,scrollbars=yes");
	};



/* : 깜박임 효과 [ explorer ]*/
	this.doBlink = function() {
		var blink = document.all.tags("BLINK");
		var len = blink.length;
		for (var i=0; i < len; i++) blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : ""
	};
	this.startBlink = function() {
		if (document.all) setInterval("util.doBlink()",400);
	};



/*
필드 추가 [ 테이블의 tr복사해서 추가하기 ]
작업시 제목들은 thead로 묶어주시고 복사할 필드들은 tbody로 해주셔야합니다.

// : func는 함수실행입니다. eval로 실행하시면 됩니다.
*/
	this.field_add = function(el, type, id, num, func) {
		var copy_tr_obj = document.createElement("div");
		var tableObj = document.getElementById(id);
		var doc_tbody = tableObj.getElementsByTagName('tbody')[0];
		var doc_tbody_tr = document.getElementsByName("banner_regist_tbl_tr[]");
		var count_hidden = document.getElementsByName("count_hidden[]");
		var tr_inn = doc_tbody.getElementsByTagName("tr");
		var tr_inn_len = tr_inn.length;
		var doc_tbody_tr_len = (doc_tbody_tr.length>0) ? doc_tbody_tr.length : tr_inn_len;

		if(tableObj) {
			switch(type) {
				case "add":
					var tr = tr_inn[0].cloneNode(true);
					var input_obj = tr.getElementsByTagName("input");
					var len = input_obj.length;
					var count = 0;
					do{
						switch(input_obj[count].type) {
							case "text":
								input_obj[count].value = "";
								break;
							case "checkbox":
								input_obj[count].checked = false;
								break;
						}
						count++;
					}while(count<len);
					// : count_hidden값이 있을때만 실행합니다.
					count_hidden_is = count_hidden.length>0 ? true : false;
					// : 붙여넣기
					switch(count_hidden_is) {
						// : count_hidden_is값 있을때 - 배너에서 사용함.
						case true:
							var count_hidden_max = parseInt(count_hidden[count_hidden.length-1].getAttribute("count"));
							var copy_tr = tr.cloneNode(true);
							copy_tr.innerHTML.replace(/\[0\]/gi, "["+(count_hidden_max+1)+"]");
							copy_tr.innerHTML.replace(/count=\"0\"/gi, "count="+(count_hidden_max+1)+"");
							copy_tr.innerHTML.replace(/_0_/gi, "_"+(count_hidden_max+1)+"_");
							copy_tr_obj.appendChild(copy_tr);
							var made_tr = doc_tbody.insertAdjacentElement('beforeEnd', copy_tr);
							break;
						// : 일반적으로 사용함.
						default:
							var made_tr = doc_tbody.insertAdjacentElement('beforeEnd',tr.cloneNode(true));
							break;
					}
					if(func) eval(func);
					break;
				case "del":
					var chk = document.getElementsByName(el.getAttribute("tailname"));
					var chk_count = this.checkbox_allcheck(el);
					if(doc_tbody_tr_len<=1) {
						alert("배너등록폼은 한개이상은 존재해야합니다.");
						return;
					}
					if(chk_count<=0) {
						alert("최소한 한개이상은 선택하셔야합니다.");
						return;
					}
					if(confirm("삭제하시겠습니까?")) {
						var len = doc_tbody_tr_len;
						var count = 0;
						var check_count = 0;
						do{
							var check_obj = chk[check_count].checked;
							switch(check_obj) {
								case true:
									// : 모두 지우면 안되기 때문에 최초의 한개는 남겨둡니다. [ 제일 마지막것만 남깁니다. ]
									var delete_chk = doc_tbody_tr_len==chk_count ? count < doc_tbody_tr_len-1 : true;
									if(delete_chk===true) {
										tr_inn[check_count].parentNode.removeChild(tr_inn[check_count]);
									}
									break;
								default:
									check_count++;
									break;
							}
							count++;
						}while(count<len);
					}
					break;
			}
		}
	};



/* : 메뉴 클릭*/
	this.menu_onclick = function(el, num, divid, divid2) {
		var count = 0;
		var count2 = 0;
		var big = document.getElementsByName(el.id); /* : 1차카테고리*/
		var obj = document.getElementsByName(divid); /* : 2차카테고리*/
		var len = obj.length;
		while(count<len) {
			obj[count].style.display = (count==num) ? 'block' : 'none';
			big[count].style.backgroundColor = (count==num) ? '#ffffff' : '#f8f8f8';

			var obj2 = document.getElementsByName(divid2+'['+count+'][]'); /* : 3차카테고리*/
			var big_menu2 = document.getElementsByName('big_menu2['+count+'][]'); /* : 2차카테고리*/
			count2 = 0;
			var len2 = obj2.length;
			while(count2<len2) {
				obj2[count2].style.display = (count2==0 && count==num) ? 'block' : 'none';
				big_menu2[count2].style.fontWeight = (count2==0) ? 'bold' : 'normal';
				count2++;
			}
			count++;
		}
	};
/* : 메뉴클릭2*/
	this.menuonclick2 = function(el, num, num2, divid2) {
		var count = 0;
		var count2 = 0;
		var big_menu = document.getElementsByName('big_menu[]');

		var len = big_menu.length;
		while(count<len) {
			var big_menu2 = document.getElementsByName('big_menu2['+count+'][]'); /* : 2차카테고리*/
			var obj2 = document.getElementsByName(divid2+'['+count+'][]'); /* : 3차카테고리*/

			count2 = 0;
			var len2 = obj2.length;
			while(count2<len2) {
				big_menu2[count2].style.fontWeight = (num2==count2) ? 'bold' : 'normal';
				obj2[count2].style.display = (count2==num2 && count==num) ? 'block' : 'none';
				count2++;
			}
			count++;

			/*obj2.style.display = */
		}
	};



/* : 테그선택시 그에 따른 변화작업*/
/*
select테그에 값이 없을때 text입력을 비활성화하거나
radio, checkbox사용시 text입력을 비활성화하기 위한 작업
*/
/* : radio, checkbox들은 yes, no값일때만 그에 맞는 작업을 사용합니다. -- 또는 0이면 나머지가 비활성화되게 하거나.*/
	this.tag_click_change = function(el, id) {
		var RESULT = false;
		var count = 0;
		var obj = document.getElementsByName(id);
		/* : 금액입력란이 있어야 실행합니다.*/

		var len = obj.length;
		while(count<obj.length) {
			if(obj) {
				switch(el.tagName) {
					case "SELECT":
							obj[count].disabled = el.value ? false : true;
							obj[count].style.backgroundColor = el.value ? '#ffffff' : '#eeeeee';
							obj[count].readOnly = el.value ? false : true;
							if(!el.value) obj[count].value = '';
						break;
					default:
						switch(el.type) {
							case "radio":
								if(el.value=='yes') RESULT = el.checked===true ? true : false;
								else RESULT = el.checked===false ? true : false;
								obj[count].disabled = RESULT===false ? true : false;
								obj[count].style.backgroundColor = RESULT===false ? '#eeeeee' : '#ffffff';
								obj[count].readOnly = RESULT===false ? true : false;
								if(RESULT===false) obj[count].value = '';
								break;

							case "checkbox":
								var keys = el.getAttribute("key");
								if(keys==0) {
									if(count==0) { count++; continue; } /* : 0은 취소기 때문에 그냥 건너뛴다.*/
									obj[count].disabled = el.checked===true ? true : false;
									obj[count].checked = el.checked===true ? false : obj[count].checked;
								}
								break;
						}
						break;
				}
			}

			/* : 입력박스가 readOnly이면 등록하지 않아도 되도록 하기 [ text나 select테그만 사용합니다. ]*/
			if(obj[count].type=='text' || obj[count].tagName=='SELECT') {
				if(obj[count].readOnly===false) obj[count].setAttribute("needed", "needed");
				else obj[count].removeAttribute("needed");
			}
			count++;
		}
	};



/* : 현재페이지 주소복사 [ ex전용 ]*/
	this.url_copy = function(meintext) {
		/* the IE-manier */
		window.clipboardData.setData("Text", meintext);
		alert("주소가 저장되었습니다.");
		return false;
	};


/* 삭제함수 */
	this.delete_func = function(el, msg) {
		var msg = msg ? msg : '삭제하시겠습니까?';
		// : 삭제함수
		if(confirm(msg)) {
			var no = el.getAttribute("no");
			var url = el.getAttribute("url");
			var mode = el.getAttribute("mode");
			location.href = url+'?mode='+mode+'&chk[]='+no;
		}
	}


/*
출처 - http://k.daum.net/qna/view.html?category_id=QCL001&qid=0FnWL&q=div+%C0%CC%B9%CC%C1%F6+%B8%B6%BF%EC%BD%BA+%B5%E5%B7%B9%B1%D7&srchid=NKS0FnWL
출처에서 약간 응용했습니다. 이해해주세요~^^ 정보 제공해주셔서 감사합니다.~;
마우스 드레그 1 [ 사용방법(이동할 테그에 class="mouse_drag" 넣어주면 됩니다.) -- 테그속 내용들도 같이 이동됩니다. ]
*/
	this.mdown = function() {
		var count = 0;
		var addtext = '';
		do{
			var tagObj = eval("event.srcElement"+addtext);
			addtext += '.parentNode';
			/* : className값인 mouse_drag이 있는지 찾아보기.. 있다면 그 객체가 이동객체가 됩니다. - 값있으면 빠져나오자.*/
			if(tagObj.className=='mouse_drag') {
				this.bdown = true;
				this.sElem = tagObj;
				this.x = event.clientX;
				this.y = event.clientY;
				return;
				break;
			}
			/* : 테그값이 undefined값이면 빠져나오자.*/
			if(tagObj.tagName==undefined) break;
			count++;
		/* : 100까지 한 이유는 어느정도가 마지막일지 몰라서;;*/
		}while(count<100);
	};
	this.mup = function() {
		this.bdown = false;
	};
	this.moveimg = function() {
		if(this.bdown) {
			var distX = event.clientX - this.x;
			var distY = event.clientY - this.y;
			this.sElem.style.pixelLeft += distX;
			this.sElem.style.pixelTop += distY;
			this.x = event.clientX;
			this.y = event.clientY;
			return false;
		}
	};


/* : 쿠키 저장하기*/
	this.setCookie = function( name, value, expiredays )
	{
		var todayDate = new Date();
		todayDate.setDate(todayDate.getDate() + expiredays);
		document.cookie = name + '=' + escape( value ) + '; path=/; expires=' + todayDate.toGMTString() + ';'
	};
/* : 닫기버튼*/
	this.noneWin = function(el, divid, value, addtype)
	{
		var cookie_name = addtype ? 'popup_'+addtype+'_doc' : 'popup_doc'
		this.setCookie(cookie_name+value, value , 1);
		document.getElementById(divid).style.display = "none";
	};


/*이미지 사이즈 체크*/
	this.imgCheck = function(el, iframename) {
		var form = document.forms[el.form.name];
		var iframe = document.getElementById(iframename);
		var ext = el.getAttribute("ext");

		var attach_ext = document.getElementById(el.name+"_attach_ext");
		

		var prev_action = form.action;
		var prev_mode = form.mode.value;
		var prev_target = form.target;
		var prev_onsubmit = form.onsubmit;

		if(iframe) {
			var docCre = document.createElement("input");
			docCre.type = "hidden";
			docCre.name = "imgName";
			docCre.id = "imgName";
			docCre.value = el.name;
			form.appendChild(docCre);

			var upload_div = document.getElementById("upload_div");
			form.target = iframename;
			form.mode.value = "file_size_check";
			form.action = domain+"Libs/_php/multiProcess.php";
			form.submit();

			form.action = prev_action;
			form.mode.value = prev_mode;
			form.target = prev_target;
			form.onsubmit = prev_onsubmit;
			return false;
		} else {
			alert("필요한 정보가 없습니다."); /* iframe이 없을경우에 이 메시지가 출력됩니다. */
		}
	};


/* : 이미지 확장자 체크*/
	this.checkEXT = function(el) {
		var ext = el.getAttribute("ext");
		var file_arr = el.value.split(".");
		var file_ext = file_arr[file_arr.length-1].toLowerCase();
		if(ext.indexOf(file_ext)==-1) {
			alert("파일의 확장자는"+ext+"만 가능합니다.");
			this.inner_obj = document.getElementById(el.id+'_span');
			this.inner_innerHTML = this.inner_obj.innerHTML;
			this.inner_obj.innerHTML ="";
			this.inner_obj.innerHTML =this.inner_innerHTML;
		}
	};


/* : 금액값 */
	this.money_comma = function(money, part) {
		var money_text = new String(money);
		var len = money_text.length;
		var money_value = '';
		var count = 0;
		var part_count = 3;
		var part = part ? part : ',';
		do{
			var money_part = money_text.substr(count, 1);
			if(money_part.indexOf("undefined")==-1) money_value += ''+money_part+'';
			if(count%part_count==0 && len-1!=count) money_value += part;
			count++;
		}while(count<len);

		return money_value;
	};


/* tr노드 삭제 */
	this.tr_remove = function(el) {
		var count = 0;
		var addtext = '';
		do{
			var tagObj = eval("el"+addtext);
			addtext += '.parentNode';
			/* : className값인 mouse_drag이 있는지 찾아보기.. 있다면 그 객체가 이동객체가 됩니다. - 값있으면 빠져나오자.*/
			if(tagObj.tagName.toLowerCase()=='tr') {
				tagObj.parentNode.removeChild(tagObj);
				return;
			}
			/* : 테그값이 undefined값이면 빠져나오자.*/
			if(tagObj.tagName==undefined) break;
			count++;
		/* : 100까지 한 이유는 어느정도가 마지막일지 몰라서;;*/
		}while(count<10);
	};


/* 원하는 테그 object값 구하기 */
	this.tr_object = function(el, tagname) {
		var count = 0;
		var addtext = '';
		do{
			var tagObj = eval("el"+addtext);
			addtext += '.parentNode';
			/* : className값인 mouse_drag이 있는지 찾아보기.. 있다면 그 객체가 이동객체가 됩니다. - 값있으면 빠져나오자.*/
			if(tagObj.tagName.toLowerCase()==tagname) {
				return tagObj;
			}
			/* : 테그값이 undefined값이면 빠져나오자.*/
			if(tagObj.tagName==undefined) break;
			count++;
		/* : 100까지 한 이유는 어느정도가 마지막일지 몰라서;;*/
		}while(count<10);
	};


/* 원하는 id object값 구하기 */
	this.id_object_find = function(el, id) {
		var count = 0;
		var addtext = '';
		do{
			var tagObj = eval("el"+addtext);
			addtext += '.parentNode';
			/* : className값인 mouse_drag이 있는지 찾아보기.. 있다면 그 객체가 이동객체가 됩니다. - 값있으면 빠져나오자.*/
			if(tagObj.id.toLowerCase()==id) {
				return tagObj;
			}
			/* : 테그값이 undefined값이면 빠져나오자.*/
			if(tagObj.id==undefined) break;
			count++;
		/* : 100까지 한 이유는 어느정도가 마지막일지 몰라서;;*/
		}while(count<10);
	};


/* 상세정보 innerHTML로 보여주기 - 태그깨짐방지 (div, textarea 태그가 필요합니다.) */
	this.content_innerHTML = function(obj, textarea_obj) {
		obj.innerHTML = textarea_obj.value;
	};



/* 객체값을 배열로 변환하는 함수입니다. - 자스의 join같은 명령어를 쓰기 위해서~ */
	this.object_change_array = function(obj) {
		var len = obj.length;
		var arr = new Array();
		var count = 0;
		do{
			arr[count] = obj[count].value;
			count++;
		}while(count<len);
		return arr;
	};


/* calendar의 onClick */
	this.calendar_onclick = function(el, url) {
		var day = el.getAttribute("day");
		if(url) location.href = url+'?rdate_check='+day;
	};



/* 이미지 부드럽게 */
	this.bt = function(id,after,check) {
		check = window.attachEvent ? check : 'no'; // : 효과는 익스용입니다.
		switch(check=='yes') {
			case true:
				id.filters.blendTrans.stop(); 
				id.filters.blendTrans.Apply(); 
				id.src=after; 
				id.filters.blendTrans.Play(); 
				break;
			default:
				id.src=after;
				break;
		}
	};


/* form값 정리 - ajax post로 보낼때 사용 */
	this.form_parameters = function(fname) {
		var form = document.forms[fname];
		var len = form.length;
		var count = 0;
		var parameters = '';
		do{
			var el = form[count];
			switch(el.type) {
				case "radio":
					if(el.checked==true) parameters += '&'+el.name+'='+el.value;
					break;
				case "checkbox":
					if(el.checked==true) parameters += '&'+el.name+'='+el.value;
					break;
				default:
					parameters += '&'+el.name+'='+encodeURIComponent(el.value);
					break;
			}
			count++;
		}while(count<len);
		return parameters;
	};


/* 날짜검색 기간클릭시 값 자동으로 놓기 */
	this.search_date_input_click = function(date, name, num) {
		var obj = document.getElementsByName(name);
		var len = obj.length;
		var count = 0;
		do{
			switch(count) {
				case 0:
					obj[count].value = (date) ? date : "";
					break;
				default:
					var month = this.date.getMonth()+1>=10 ? this.date.getMonth()+1 : '0'+(this.date.getMonth()+1);
					var day = this.date.getDate()>=10 ? this.date.getDate() : '0'+(this.date.getDate());
					obj[count].value = (date) ? this.date.getFullYear()+'-'+month+'-'+day : "";
					
					break;
			}
			count++;
		}while(count<len);
	};


/* 이미지클릭해도 체크되게 하기 */
	this.icon_click = function(id) {
		document.getElementById(id).click();
	};



/*
type : 소셜네트워크종류
msg : 메시지
url : 광고주소
subject : 제목
site_subject : 사이트제목
*/
	this.socialnetwork_func = function(el, type) {
		var http_root_value = (http_root.substr(0, http_root.length-1));
		var msg = el.getAttribute("msg");
		var url = http_root_value+el.getAttribute("url");
		var subject = el.getAttribute("subject");
		var site_subject = el.getAttribute("site_subject");
		var image = el.getAttribute("image");

		switch(type) {
			// : 페이스북
			case "goFaceBook":
				var href = "http://www.facebook.com/sharer.php?u=" + encodeURIComponent(url) + "&t=" + encodeURIComponent(msg);
				break;
			// : 트위터
			case "goTwitter":
				var href = "http://twitter.com/share?text=" + encodeURIComponent(msg) + " " + encodeURIComponent(url);
				break;
			case "goMe2Day":
				// : 미투데이
				var href = "http://me2day.net/posts/new?new_post[body]=" + encodeURIComponent(msg) + " " + encodeURIComponent(url) + "&new_post[tags]=" + encodeURIComponent(site_subject);
				break;
			// : 다음요즘
			case "goYozmDaum":
				var href = "http://yozm.daum.net/api/popup/prePost?sourceid=54&link=" + encodeURIComponent(url) + "&prefix=" + encodeURIComponent(' [ '+site_subject+' ] '+subject) + "&parameter=" + encodeURIComponent(msg);
				break;
			// : 싸이월드
			case "goCyworld":
				var url = "http://csp.cyworld.com/bi/bi_recommend_pop.php?url=" + encodeURIComponent(url) + "&title=" + (' [ '+site_subject+' ] '+subject) + "&thumbnail=" + image+"&summary=" + (' [ '+site_subject+' ] '+subject) + "&writer="+document.domain;
				var a1 = window.open(url, 'cLogin', 'width=410, height=443');
				if(a1) a1.focus();
				return;
				break;
		}

		var a = window.open(href, 'facebook', '');
		if (a) {
			a.focus();
		}
	};



/* : Object Object값 알아내기 */
	this.object_value_view = function(id, obj) {
		var table = '<table border="0" cellspacing="0" cellpadding="0" class="admin_tbl2_1">';
		for(x in obj) {
			table += '<tr><th>'+x+'</th><td>'+obj[x]+'</td></tr>';
		}
		table += '</table>';
		if(id) document.getElementById(id).innerHTML = table;
	};


/*블라인드 [ 알릭님이 만드신 것 참조했습니다. ] - http://www.alik.info */
	this.body_blind = function(msg, check) {
		SLB(msg,'html', check);
	}


/* 물어보고 처리하는 함수 */
	this.confirm_func = function(el) {
		var action = el.getAttribute("action");
		var msg = el.getAttribute("msg");
		var kind = el.getAttribute("kind");
		if(confirm(msg)) {
			switch(kind) {
				case "move":
					location.href = action;
					break;
			}
		}
	};



/* 중복된 get값이 있다면 하나로.. */
	this.location_href_dupl = function(page_value, add_get) {
		var result_get = '';
		var result_arr = {}; // : get값 변수 중복 안되게 하기 위한 object
		var result_value = {}; // : return넘길 object [ 연관배열로 return합니다. ]
		var result_obj_count = {};
		var page = page_value.split("?");

		switch(!page[1]) {
			// : get값이 없는경우 - 그냥 넘깁니다. - add_get값이 있으면 같이 넘깁니다.
			case true:
				result_value['page'] = page[0]+'?'+add_get; // : 전체 페이지값
				break;

			// : get값이 있는경우 - 중복된 변수는 제거하고 add_get값을 붙여서 넘깁니다.
			default:
				if(page[1]) {
					var and_part = page[1].split("&");
					var len = and_part.length;
					var count = 0;
					if(len>0) {
						do{
							var equal_part = and_part[count].split("=");
							if(!result_obj_count[equal_part[0]]) result_obj_count[equal_part[0]] = 0;
							switch(decodeURIComponent(equal_part[0]).indexOf('[')) {
								// : 배열로 넘어온경우 - 중복변수가 아니므로 없애지 않습니다.
								case -1:
									if(equal_part[0]) result_arr[equal_part[0]] = equal_part[1];
									break;
								// : 단일변수입니다.
								default:
									if(!result_arr[equal_part[0]]) result_arr[equal_part[0]] = new Array();
									var obj_int = result_obj_count[equal_part[0]];
									if(equal_part[1]) result_arr[equal_part[0]][obj_int] = equal_part[1];
									result_obj_count[equal_part[0]]++;
									break;
							}
							
							count++;
						}while(count<len);
					}
				}

				for(x in result_arr) {
					var result_len = result_arr[x].length;
					switch(result_len>1) {
						// : 배열로 넘어온경우
						case true:
							if(typeof result_arr[x]=='object') {
								for(var y=0; y<result_len; y++)
									result_get += x+'='+result_arr[x][y]+'&';
							} else {
								result_get += x+'='+result_arr[x]+'&'; // : 글자수도 length에 걸려버림;
							}
							break;
						// : 단일값인경우
						default:
							result_get += x+'='+result_arr[x]+'&';
							break;
					}
				}

				result_value['page'] = page[0]+'?'+result_get+add_get; // : 전체 페이지값
				result_value['get'] = result_get; // : get값 모음
				result_value['arr'] = result_arr; // : 배열화된 get값
				break;
		}
		return result_value;
	};


/* onload시킬 함수 단어로 넣기 */
	this.onLoad_start_func = function(func) {
		if(window.attachEvent) window.attachEvent('onload', eval(func));
		else window.addEventListener('load', eval(func), false);
	};

/* onload시킬 함수 단어로 넣기 - 인자값을 넣어야하는 경우에 사용 */
	this.onLoad_start_val_func = function(func) {
		if(window.attachEvent) window.attachEvent('onload', function() { eval(func) });
		else window.addEventListener('load', function() { eval(func) }, false);
	};


/* 이미지 클릭시 라디오나 체크박스 체크되게 하기 */
	this.img_click_radio = function(id) {
		document.getElementById(id).click();
	};


/*
스크롤 따라다니는 레이어
[ 출처 ] http://phpschool.com/gnuboard4/bbs/board.php?bo_table=tipntech&wr_id=62574&sca=&sfl=wr_subject%7C%7Cwr_content&stx=%B5%FB%B6%F3%B4%D9%B4%CF%B4%C2&sop=and
무화님 감사합니다~

[ 사용법 ]

<div id="div1" style="position:absolute; left:50px; top:40px;">(default)</div>
<div id="div2" style="position:absolute; left:150px; top:80px;">(1000, Static)</div>
<div id="div3" style="position:absolute; left:250px; top:120px;">(1000, Bounce)</div>
<div id="div4" style="position:absolute; left:350px; top:160px;">(1000, Expo)</div>
<div id="div5" style="position:absolute; left:450px; top:200px;">(1000, Elastic is default)</div>
<div id="div6" style="position:absolute; left:550px; top:240px;">(2000, Elastic)</div>
<div id="div7" style="position:absolute; left:650px; top:280px;">(3000, Expo)</div>
 
<script> 
	util.StickerManager.add("div1");
	util.StickerManager.add("div2",1000,"Static");
	util.StickerManager.add("div3",1000,"Bounce");
	util.StickerManager.add("div4",1000,"Expo");
	util.StickerManager.add("div5",1000,"Elastic");
	util.StickerManager.add("div6",2000,"Elastic");
	util.StickerManager.add("div7",3000,"Expo");
</script>
*/
	var StickerAnimation = function(){};
	this.StickerManager_top = 0; // : 최초 top위치입니다.
	this.move_top_gap = 0; // : 스크롤 이동시키고 나서 최상단과의 갭입니다.
	this.top_static_check = false;
	StickerAnimation.prototype = {
		duration : null,
		obj : null,
		from : null,
		to : null,
		timer : 0,
		step : 0,
		start : function(obj, from, to, duration, type){
			var self = this;
			this.obj = obj;
			this.from = from;
			this.to = to;
			this.now = new Date;
			this.duration = duration || 1000;
			this._delta = this['_delta' +(type || 'Elastic')];

			if(this.timer)
				this.stop();

			this.timer = setInterval(function(){self.run();}, 10);
		},
		run : function(){

			var time = ((new Date) - this.now) / this.duration;
			var delta = this._delta(time);

			var step = Math.pow(2, this.step);
			var dep_x = (this.to.x - this.from.x) * delta;
			var dep_y = (this.to.y - this.from.y) * delta;

			if(time > 1){
				this.stop();
				this.end();
			}else{

				this.obj.style.marginLeft = this.from.x + dep_x + "px";
				this.obj.style.marginTop = this.from.y + dep_y + "px";
			}
		},
		end : function(){
			this.obj.style.marginLeft = (this.to.x) + "px";
			this.obj.style.marginTop = (this.to.y) + "px";
		},
		stop : function(){
			clearInterval(this.timer);
			this.timer = 0;
		},

		_deltaBounce : function(pos){
			var p = 1 - pos;

			var value;
			for (var a = 0, b = 1; 1; a += b, b /= 2){
				if (p >= (7 - 4 * a) / 11){
					value = - Math.pow((11 - 6 * a - 11 * p) / 4, 2) + b * b;
					break;
				}
			}
			return 1 - value;
		},

		_deltaExpo : function(pos){
			var p = 1 - pos;
			return 1 - Math.pow(2, 8 * (p - 1));
		},

		_deltaElastic : function(pos){
			var p = 1 - pos;
			return 1 - Math.pow(2, 10 * --p) * Math.cos(20 * p * Math.PI * 1 / 3);
		},

		_deltaStatic : function(pos){
			return 1;
		}

	};

	this.StickerManager = {
		init : false,
		stickers : [],
		opts : [],
		add : function(id, duration, type, gap, check_type){

			if(!this.init){
				var self = this;
				var init_event = function(){self.oninit();};
				var scroll_event = function(){self.onscroll();};

				if(window.attachEvent){
					window.attachEvent('onload', init_event);
					window.attachEvent('onscroll', scroll_event);
				}else{
					window.addEventListener('load', init_event, false);
					document.addEventListener('scroll', scroll_event, false);
				}

				this.init = true;
			}

			this.StickerManager_top = parseInt(document.getElementById(id).style.top); // : 스크롤시 최초 top값
			this.move_top_gap = (gap) ? gap : 0;
			this.top_static_check = check_type;
			this.stickers.push(id);
			this.opts.push({duration:duration,type:type});
		},

		oninit : function(){
			var sticker;
			for(var x = 0, len = this.stickers.length; x < len; x++){
				sticker = document.getElementById(this.stickers[x]);
				if(!sticker){
					alert(this.stickers[x] + ' is bad id.');
					this.stickers[x] = null;
					continue;
				}
				this.stickers[x] = sticker;
				sticker.style.marginLeft = sticker.style.marginTop = "0px";
			}
		},

		onscroll : function(){
			var left = parseInt(document.body.scrollLeft);
			var top = parseInt(document.body.scrollTop);
			var sticker;
			for(var x = 0, len = this.stickers.length; x < len; x++){
				sticker = this.stickers[x];
				// : 스크롤 이동시 첫 위치를 넘어서는 경우 최상단으로 이동시키게 하기 위해서

				// : 형식별 스크롤 상단위치
				switch(this.top_static_check) {
					// : 상단위치를 원하는 gap만큼 이동시키기
					case "top_static":
						var top = this.StickerManager_top<top ? top - this.StickerManager_top + this.move_top_gap : 0;
						break;
				}

				if(!sticker)
					continue;

				if(!sticker.animation){
					sticker.animation = new StickerAnimation();
				}else{
					sticker.animation.stop();
				}
				
				sticker.animation.start(
					sticker, 
					{x:parseInt(sticker.style.marginLeft), y:parseInt(sticker.style.marginTop)},
					{x:left, y:top},
					this.opts[x].duration,
					this.opts[x].type
				);

			}
		}
	};

/* 시작페이지로 */
	this.sethomepage = function(el, domain) {
		el.style.behavior = "url(#default#homepage)";
		el.setHomePage(domain);
	};


/*
즐겨찾기
출처 - http://blog.naver.com/PostView.nhn?blogId=ido5273&logNo=130073947342
*/
	this.bookmark = function(title, url) {
		if(window.sidebar) { // : 파폭
			window.sidebar.addPanel(title, url, "");
		} else if(window.opera && window.print) { // : 오페라
			var obj = document.createElement("a");
			obj.setAttribute("href", url);
			obj.setAttribute("title", title);
			obj.setAttribute("rel", "sidebar");
			obj.click();
		} else if(navigator.userAgent.match(/Chrome/)){
			alert("즐겨찾기에 추가하시려면 CTRL+D 키를 눌러주세요");
		} else {
			window.external.AddFavorite(parent.location.href, document.title);
		}
	};


/* input needed 체크 */
	this.needed_check = function(obj, check) {
		switch(check) {
			case true:
				obj.setAttribute("needed", "needed");
				break;
			default:
				obj.removeAttribute("needed");
				break;
		}
	};


/* iframe height값 체크 */
	this.iframe_height_size = function(if_id, div_id, key) {
		var parentObj = parent.document.getElementById(if_id);
		var comment_div = document.getElementById(div_id);
		parentObj.style.height = parent.util.ifr_height2[key] ? parent.util.ifr_height2[key] : comment_div.offsetHeight + 50;
		if(!parent.util.ifr_height2[key]) parent.util.ifr_height2[key]=parentObj.style.height;
	};


/* getAttribute값으로 값 찾아내기 */
	this.getAttribute_getfind = function(name, put_count, attname) {
		var obj = document.getElementsByName(name);
		var len = obj.length;
		var count = 0;
		do{
			var get_count = obj[count].getAttribute(attname);
			if(put_count==count) {
				return obj[count];
				break;
			}
			count++;
		}while(count<len);
	};


	/* 하단에 표시되게 하기 */
	this.bottom_boo = function(name) {
		var divObj = document.getElementById(name);
		var scr_top_val = document.body.clientHeight + document.body.scrollTop - divObj.offsetHeight;
		divObj.style.top = (scr_top_val) + 'px';
		setTimeout("util.bottom_boo('"+name+"')", 0);
	};


	/* 화살표로 div이동하기 - 검색시에 사용함 */
	this.key_div_move = function(el, divid, event) {
		var ev = event || window.event;
		var keycode = ev.keyCode;
		if(!util.in_array(keycode, [38,40])) return false;

		var divObj = document.getElementsByName(divid);
		var relation_search_keyword = document.getElementById("relation_search_keyword");
		var len = divObj.length;
		var count = 0;

		/* : 키값으로 위치이동 정보 */
		switch(keycode) {
			case 38:
				this.key_div_move_chk_count = (this.key_div_move_chk_count==0) ? 0 : this.key_div_move_chk_count-1;
				break;
			case 40:
				this.key_div_move_chk_count = (len==(this.key_div_move_chk_count+1)) ? len-1 : this.key_div_move_chk_count+1;
				break;
		}

		if(len>0) {
			do{
				var key_text = divObj[count].getAttribute("keyword2");
				switch(this.key_div_move_chk_count==count) {
					case true:
						divObj[count].style.backgroundColor = "#efefef";
						el.value = key_text;
						break;
					default:
						divObj[count].style.backgroundColor = "#ffffff";
						break;
				}
				count++;
			}while(count<len);
		}

		if(this.in_array(keycode, [38,40])) return true;
		else return false;
	};

	this.trick_db = '';
	this.trick_set;
	this.trick_func = function(el) {
		switch(this.trick_db==el.value) {
			case true:
				clearInterval(this.trick_set);
				break;
			default:
				var obj = document.getElementById(el.id);
				this.trick_db = el.value;
				this.trick_set = setInterval(function() {util.trick_func(el);}, 10);
				break;
		}
	};

/* 링크이동 */
	this.move_url_page = function(url) {
		window.open(domain+"move_url.php?url="+encodeURIComponent(url));
	};



	// : 레이어 가운데로 이동
	this.initLayerPosition = function(id, width,height,border){
		jQuery(".center_div").each(function(){
			jQuery(this).css("display", "none");
		});

		var element_layer = typeof id=='object' ? jQuery(id)[0] : jQuery("#"+id)[0];
		element_layer.style.display = "block";
		width = width>0 ? width : 300;
		borderWidth = border;

		// 위에서 선언한 값들을 실제 element에 넣는다.
		element_layer.style.width = width + 'px';
		element_layer.style.border = borderWidth + 'px solid';

		if(height>0) height = height>0 ? height : element_layer.offsetHeight;

		element_layer.style.height = height + 'px';
		// 실행되는 순간의 화면 너비와 높이 값을 가져와서 중앙에 뜰 수 있도록 위치를 계산한다.
		element_layer.style.left = (((window.innerWidth || document.documentElement.clientWidth) - width)/2 - borderWidth) + 'px';
		element_layer.style.top = (((window.innerHeight || document.documentElement.clientHeight) - height)/2 - borderWidth) + 'px';
	};
	this.initLayerPosition_close = function(id) {
		var element_layer = typeof id=='object' ? jQuery(id)[0] : jQuery("#"+id)[0];
		element_layer.style.display = "none";
	};
};

var util = new util();

util.onload_func();
if(window.attachEvent) window.attachEvent("onload", util.onload_func);
else window.addEventListener("load", util.select_img, false);

document.onmousedown = util.mdown;
document.onmouseup = util.mup;
document.onmousemove = util.moveimg;



jQuery(window).ready(function(){
	
	// : 날짜
	jQuery( ".datepicker_inp" ).datepicker(datepicker_json).keyup(function(e) {
		if(e.keyCode == 8 || e.keyCode == 46) {
			jQuery.datepicker._clearDate(this);
		}
	});

});