//<!--<![CDATA[

/* Window Load ***********************************************************/

/**************************************************************************
*
*				window load
*
**************************************************************************/
	window.onload	= function(){
		User.doc	= (document.compatMode && document.compatMode != "BackCompat" && User.browser != "opera")
					? document.documentElement
					: document.body;
		if(this.init)
			init();
	};

	window.onunload	= function(){
		if(this.exit)
			exit();
	};

/* Prototype**************************************************************/

/**************************************************************************
*
*				Extend
*
**************************************************************************/
/*
	Object.prototype.extend	= function(tg_){
		if(tg_.constructor !== Object)
			return "Target Not Found!!";
		for(var item in tg_){
			if(tg_[item] == null || this[item] === tg_[item])
				continue;
			this[item]	= tg_[item];
		}
	};
*/
/* Object ****************************************************************/

/**************************************************************************
*
*				User info
*
**************************************************************************/
	var agent	= navigator.userAgent.toLowerCase();
	var User	= {
		version	: agent.replace(/.*(?:rv|it|ra|ie|on|ox)[\/: ]([\d.]+).*/, "$1"),
		browser	: agent.replace(/.*(msie|opera|apple|mozilla).*/, "$1"),
		doc		: null,
		referrer: document.referrer
	};

/**************************************************************************
*
*							Xml Http Request
*
**************************************************************************/
	var Request	= {
		sender	: null,
		send	: function(path_, function_, data_){
			var sender	= this.sender || this.newXHR();
			var method	= data_ ? "POST" : "GET";
			sender.open(method, path_, true);
			sender.setRequestHeader("User-Agent","XMLHTTP/1.0");
			if(data_)
				sender.setRequestHeader("Content-type","application/x-www-form-urlencoded;");

			sender.onreadystatechange = function(){
				if(sender.readyState == 4){
					if(sender.status != 200 && sender.status != 304){
//						alert('HTTP error ' + sender.status);
						return;
					}
					if(function_)
						function_(sender);
				}else{
//					alert('HTTP error ' + sender.status);
					return;
				}
			};

			if(sender.readyState == 4)
				return;
			sender.send(data_ || null);
		},

		newXHR	: function(){
			var creXHR = [], i = 0;
			creXHR[i++]	= function(){return new ActiveXObject("Microsoft.XMLHTTP")};
			creXHR[i++]	= function(){return new ActiveXObject("Msxml2.XMLHTTP")};
			creXHR[i++]	= function(){return new ActiveXObject("Msxml3.XMLHTTP")};
			creXHR[i++]	= function(){return new XMLHttpRequest()};

			while(i--){
				try{
					this.sender	= creXHR[i]();
				}catch(e){
					continue;
				}
			}
			return this.sender;
		}
	};

/**************************************************************************
*
*				Popup
*
**************************************************************************/
	var Popup	= {
//		option	: ", toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, channelmode=yes, alwaysReised=yes, fullscreen=yes",
		write	: function(content_, name_, width_, height_, x_, y_, etc_){
			if(this[name_] && !this[name_].closed){
				this[name_].focus();
				return;
			}
			var option	= "width=" + width_ + ", height=" + height_
						+ (y_ ? ", top=" + y_ : "")
						+ (x_ ? ", left=" + x_ : "")
						+ (etc_ ? ", " + etc_ : "");
			this[name_]	= window.open("about:blank", name_, option);
			this[name_].document.write(content_);
		},

		open	: function(path_, name_, width_, height_, x_, y_, etc_){
			if(this[name_] && !this[name_].closed){
				this[name_].focus();
				return;
			}
			var option	= "width=" + width_ + ", height=" + height_
						+ (y_ ? ", top=" + y_ : "")
						+ (x_ ? ", left=" + x_ : "")
						+ (etc_ ? ", " + etc_ : "");
			this[name_]		= window.open(path_, name_, option);
		},

		reload	: function(path_, name_, width_, height_, x_, y_, etc_){
			var option	= "width=" + width_ + ", height=" + height_
						+ (y_ ? ", top=" + y_ : "")
						+ (x_ ? ", left=" + x_ : "")
						+ (etc_ ? ", " + etc_ : "");
			this[name_]		= window.open(path_, name_, option);
			this[name_].focus();
		},

		close	: function(name_){
			if(this[name_]){
				this[name_].close();
				delete this[name_];
			}
		}
	};

/**************************************************************************
*
*				Cookie
*
**************************************************************************/
	var Cookie	= {
		init : function(){
			var cookieList	= document.cookie.split("; "),
			len				= cookieList.length, temp;
			for(var i = 0; i < len; i ++){
				temp			= cookieList[i].split("=");
				this[temp[0]]	= unescape(temp[1]);
			}
		},

		create : function(name_, value_, hour_, path_, domain_, secure_){
			if(hour_){
				var now		= new Date(), expires;
				now.setTime(hour_* 1000 * 60 * 60 + now.getTime());
				expires	= "; expires=" + now.toGMTString();
			}else{
				expires	= "";
			}
			document.cookie	= name_ + "=" + escape(value_) + expires
							+ (!path_ ? "" : "; path=" + path_)
							+ (!domain_ ? "" : "; domain=" + domain_)
							+ (!secure_ ? "" : "; secure");
			this[name_]		= value_;
		},

		remove : function(name_){
			this.create(name_, "", -24);
			delete this[name_];
		}
	};

	//init
	Cookie.init();

/**************************************************************************
*
*				Images
*
**************************************************************************/
	var Images	= {
		view	: null,
		init	: function(){
			var imgs	= el("IMG"),
				len		= imgs.length,
				size	= null,
				ie6		= User.browser == "msie" && User.version < 7
				cls		= "";

			for(var i = 0; i < len; i++){
				cls		= imgs[i].className;
				if(size = cls.match(/\d+(?:w|h)/g))
					if(/w/.test(size[0]))
						Images.reSize(imgs[i], parseInt(size[0]), parseInt(size[1] || 0));
					else
						Images.reSize(imgs[i], parseInt(size[1] || 0), parseInt(size[0]));

				if(ie6 && /png24/.test(cls))
					Images.png(imgs[i]);

				if(Images.addView && /addView/.test(cls))
					Images.addView(imgs[i]);
			}
		},

		reSize	: function(img_, w_, h_){
			var w	= img_.width,
				h	= img_.height;
			if(w < w_ || h < h_)
				return;
			if((w > w_ ? w_ : w) * h / w < h_){
				img_.height = h_;
			}else{
				img_.width	= w > w_ ? w_ : w;
			}
		},

		addView	: function(img_){
			img_.alt	= "view";
			img_.title	= "View!!"
			addEvent(img_, "click", function(e){
				var event	= e || window.event;
					event	= event.srcElement || event.target;
				Images.view.firstChild.src	= event.src;
				Images.posView();
				Images.view.display			= true;
			});
			img_.style.cursor	= "pointer";

			if(this.view)
				return;

			var img	= document.createElement("IMG");
				img.style.cssText	= "border:solid 2px #000;"
									+ "cursor:pointer;";
				img.setAttribute("title", "Close!");

			addEvent(img, "click", function(){
				var div			= Images.view;
				div.style.top	= "-10000px";
				div.style.left	= "-10000px";
				div.display		= false;
			});

			addEvent(img, "load", function(){
				if(Images.view.display)
					Images.posView();
			});

			this.view	= document.createElement("DIV");
			this.view.style.cssText	= "position:absolute;"
									+ "padding:10px;"
									+ "border:solid 5px #C09968;"
									+ "font-size:1px;"
									+ "top:-10000px;left:-10000px;"
									+ "z-index:10000";

			this.view.appendChild(img);
			document.body.appendChild(this.view);

			addEvent(window, "resize", function(){
				if(Images.view.display)
					Images.posView();
			});
		},

		posView	:function(){
			var div	= this.view,
				img	= div.firstChild,
				w	= (User.doc.clientWidth - img.width) / 2  + User.doc.scrollLeft,
				h	= (User.doc.clientHeight - img.height) / 2 + User.doc.scrollTop;
			div.style.top	= h < 100 ? "100px" : h + "px";
			div.style.left	= w < 100 ? "100px" : w + "px";
		},

		path	: function(url_){
			return escape(url_.split("http://" + location.host).join(""));
		},

		png		: function(img_){
			img_.width = img_.height = 1;
			img_.style.filter	= "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\""
								+ this.path(img_.src)
								+ "\", sizingMethod=\"image\")";
		}
	};

	addEvent(window, "load", Images.init);

//	alert(/w/.test(size[1]));

/* Function **************************************************************/

/**************************************************************************
*
*				type Name
*
**************************************************************************/
	function typeName(type_){
		var type = typeof type_;
		if(type == "object"){
			if(type_.constructor == Array)
				return	"array";
			else if(/[A-Z]/.test(type_.tagName))
				return	"element";
		}
		return type;
	};

/**************************************************************************
*
*				elements
*
**************************************************************************/
	function el(){
		var owner, i = 0;
		if(typeName(arguments[i]) == "element")
			owner	= arguments[i ++];
		if(!arguments[i])
			return	owner || document;
		if(arguments.length > i + 1){
			var array	= [];
			for(var len = arguments.length; i < len; i ++)
				array.push(owner ? el(owner, arguments[i]) : el(arguments[i]));
			return array;
		}

		return	/[^A-Z]/.test(arguments[i]) ?
				document.getElementById(arguments[i]) :
				(owner || document).getElementsByTagName(arguments[i]);
	};

/**************************************************************************
*
*				add/remove Event
*
**************************************************************************/
	function addEvent(obj_, event_, function_){
		event_	= event_.toLowerCase().replace(/^on/, "");
		if(obj_.addEventListener)
			obj_.addEventListener(event_, function_, false);
		else if(obj_.attachEvent)
			obj_.attachEvent("on" + event_, function_);
		else
			obj_["on" + event_]	= function_;
	};

	function removeEvent(obj_, event_, function_){
		event_	= event_.toLowerCase().replace(/^on/, "");
		if(obj_.removeEventListener)
			obj_.removeEventListener(event_, function_, false);
		else if(obj_.detachEvent)
			obj_.detachEvent("on" + event_, function_);
		else
			obj_["on" + event_]	= function_;
	};

/**************************************************************************
*
*				Flash Embed Write
*
**************************************************************************/
	function writeFlash(path_, width_, height_, flashvars_, transparent_){
		width_			= width_ || "100%";
		height_			= height_ || "100%";
		flashvars_		= flashvars_ || "";
		transparent_	= transparent_ ? "window" : "transparent";
		var n			= 0, strFlash;
		while(el("flashMedia_" + n))
			n++;
		if(User.browser == "msie")
			strFlash	= "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\" width=\"" + width_ + "\" height=\"" + height_ + "\" id=\"flashMedia_" + n + "\">"
						+ "    <param name=\"movie\" value=\"" + path_ + "\">"
						+ "    <param name=\"menu\" value=\"false\">"
						+ "    <param name=\"wmode\" value=\"" + transparent_ + "\">"
						+ "    <param name=\"quality\" value=\"high\">"
						+ "    <param name=\"allowscriptaccess\" value=\"always\">"
						+ "    <param name=\"flashvars\" value=\"" + flashvars_ + "\">"
						+ "</object>";
		else
			strFlash	= "<embed src=\"" + path_ + "\" quality=\"high\" wmode=\"" + transparent_ + "\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + width_ + "\" height=\"" + height_ + "\" allowScriptAccess=\"always\" name=\"" + flashvars_ + "\" flashvars=\"" + flashvars_ + "\"></embed>";

		document.write(strFlash);
	};

/**************************************************************************
*
*				set vertical align
*
**************************************************************************/
	function vAlign(){
		var block = el("DIV"), len = block.length;
		for(var i = 0; i < len; i++)
			if(/vAlign/.test(block[i].className))
				block[i].style.marginTop	= parseInt((block[i].parentNode.offsetHeight - block[i].offsetHeight) / 2) + "px";
	};

	//load
	addEvent(window, "load", vAlign);

/**************************************************************************
*
*				set focus
*
**************************************************************************/
/*	function focusBlur(){
		var blur	= document.links,
			len		= blur.length;
		for(var i = 0; i < len; i++)
			addEvent(blur[i], "focus", oneBlur);

		blur	= el("INPUT");
		len		= blur.length;
		for(i = 0; i < len; i++)
			if(/checkbox|radio|image|submit|button/i.test(blur[i].type))
				addEvent(blur[i], "focus", oneBlur);

		blur	= el("LABEL");
		len		= blur.length;
		for(i = 0; i < len; i++)
			addEvent(blur[i], "focus", oneBlur);
	};

	function oneBlur(e){
		var event	= e || window.event;
			event	= event.target || event.srcElement;
		if(event)
			event.blur();
	};

	//load
	addEvent(window, "load", focusBlur);
*/
/**************************************************************************
*
*								toggle
*
**************************************************************************/
	function toggle(selector_){
		var obj	= el(selector_).style;
		obj.display = obj.display == "none" ? "" : "none";
	};

/**************************************************************************
*
*								trim
*
**************************************************************************/
	function trim(value_){
		return value_.replace(/^\s+|\s+$/, "");
	};


/**************************************************************************
*
*								ÆäÀÌÁöÀÌµ¿Ã³¸®
*
**************************************************************************/
	function pagingByPost(pgNo, actionPage) {
		document.frm.gotoPage.value = pgNo;
		document.frm.action = actionPage;
		document.frm.submit();
	};

/**************************************************************************/
//]]>-->
