// JScript ÆÄÀÏ
var	__webgear_library_loaded = true;
function recvPassword()	{
	var	ap = "";
	if(arguments.length	>	0)
		ap = String(arguments[0]);
	var	pwd	=	window.prompt("ºñ¹Ð¹øÈ£¸¦	ÀÔ·ÂÇÏ¼¼¿ä", ap);
	if(pwd !=	null)	{
		document.forms[0].comment_pw.value = pwd;
		return true;
	}
	else
		return false;
}
window.oprompt = window.prompt;
window.prompt	=	function(message,	defaultValue,	isText)	{
	var	dArg = [message, defaultValue, isText];
	return window.showModalDialog("/webgear/lib/prompt.htm", dArg, "dialogWidth:330px;dialogHeight:220px;status=no;help=no;");
}
//SELECT ELEMENT ÀÇ	ÇØ´ç value¸¦ °®´Â	OPTION ELEMENT ¸¦	¹ÝÈ¯
//ex)	findOption(document.forms[0].select1,	"1")
function findOption(select,	value){
	for(var	i	=	0; i < select.options.length;	i++)
		if(select.options[i].value ==	value)
			return select.options[i];
	return new Object;
}
function NewsTicker(s, delay){
	var	t;
	this.initiated = false;
	this.init	=	function(){
		var	d	=	(delay ==	null?1000:delay);
		var	mouseFlag	=	false;
		var	i	=	0;
		function adScroll(){
			if(mouseFlag)
				return;
			if(--i <=	0){
				window.clearInterval(t);
				s.appendChild(s.childNodes[0]);
				s.scrollTop	=	0;
				window.setTimeout(startScroll, d);
				return;
			}
			s.scrollTop++;
		}
		
		function startScroll(){
			i	=	s.childNodes[0].offsetHeight;
			t	=	window.setInterval(adScroll, 50);
		}
		
		if(s.childNodes.length > 0 &&	s.offsetHeight < s.scrollHeight){
			s.onmouseover	=	function(){mouseFlag = true;}
			s.onmouseout = function(){mouseFlag	=	false;}
			window.setTimeout(startScroll, d);
		}
		this.initiated = true;
	}
	
	this.dispose = function(){
		window.clearInterval(t);
	}
}
function NewsTicker2(s,	delay)
{
	var	t;
	this.initiated = false;
	this.init	=	function(){
		var	d	=	(delay ==	null?1000:delay);
		var	mouseFlag	=	false;
		var	i	=	0;
		function adScroll(){
			if(mouseFlag)
				return;
			if(--i <=	0)
			{
				window.clearInterval(t);
				s.appendChild(s.childNodes[0]);
				s.scrollLeft = 0;
				window.setTimeout(startScroll, d);
				return;
			}
			s.scrollLeft++;
		}
		
		function startScroll(){
			i	=	s.childNodes[0].offsetWidth;
			t	=	window.setInterval(adScroll, 50);
		}
		
		if(s.childNodes.length > 0 &&	s.offsetWidth	<	s.scrollWidth){
			s.onmouseover	=	function(){mouseFlag = true;}
			s.onmouseout = function(){mouseFlag	=	false;}
			window.setTimeout(startScroll, d);
		}
		this.initiated = true;
	}
	
	this.dispose = function(){
		window.clearInterval(t);
	}
}
function fwrapper(func,	args){
	this.invoke	=	function(){
		func.apply(null, args);
	}
}
function isNumeric(){
	for(var	i	=	0; i < arguments.length; i++)
		if(String(arguments[i])	== ""	|| String(arguments[i]).replace(/\d+/, "") !=	"")
			return false;
	return true;
}
function SetCookie(sName,	sValue,	expireDate){
	if(expireDate)
		document.cookie	=	sName	+	"="	+sValue+ ";	path=/;	expires="	+	expireDate.toUTCString() + ";";
	else
		document.cookie	=	sName	+	"="	+sValue+ ";	path=/;";
}
function DelCookie(sName){
	document.cookie	=	sName	+	"='temp';	path=/;	expires=Fri, 31	Dec	1999 23:59:59	GMT;";
}
function ReadCookie(CookieName){
	var	name = CookieName;
	var	Found	=	false;
	var	start, end;
	var	i	=	0
	while(i	<	document.cookie.length){
		start	=	i
		end	=	start	+	name.length;
		if(document.cookie.substring(start,end)	== name){
			Found	=	true;
			break;
		}
		i++;
	}
	if(Found ==	true){
		start	=	end	+	1;
		end	=	document.cookie.indexOf(";",start);
		if(end < start){
			end	=	document.cookie.length;
		}
		return document.cookie.substring(start,	end);
	}
	else
	{
		return null;
	}
}
function openImage(imgPath,	imgSrc){
	window.open("/webgear/lib/image.htm?"	+	imgPath	+	imgSrc,	"",	"status=yes,resizable=yes,width=200px,height=100px").focus();
}
function openFile(imgPath, imgSrc){
	try	{
		if(imgSrc	== "")
			return;
		if(imgSrc.match(/\.(jpg|jpeg|bmp|gif|png)$/i)	!= null)
			openImage(imgPath, imgSrc);
		else
			window.open(imgPath	+	imgSrc,	"",	"");
		return false;
	}	catch(e) {
		return true;
	}
}
function getAvailSize(w, h,	mw,	mh){
	if(w > mw	|| h > mh){
		//width	±âÁØ Ãà¼Ò
		if(h / w > mh	/	mw)
			return [(mh	*	w) / h,	mh];
		//height ±âÁØ	Ãà¼Ò
		else
			return [mw,	(mw	*	h) / w];
	}	else {
		return [w, h];
	}
}
function resizeImgEx(img,	maxw,	maxh){
	if(img.width && img.height)	{
		var	avail	=	getAvailSize(img.width,	img.height,	maxw,	maxh);
		if(avail[0]	!= 0 &&	avail[1] !=	0	&& !isNaN(avail[0])	&& !isNaN(avail[1])) {
			img.width	=	avail[0];
			img.height = avail[1];
		}	else {
			img.width	=	maxw;
			img.height = maxh;
		}
    img.style.cursor = "pointer";
    img.onclick = function(){
      openImage(this.src, "");
    }
	}	else {
		window.setTimeout(new	fwrapper(resizeImgEx,	[img,	maxw,	maxh]).invoke, 10);
	}
}
function resizeImg(img,	max) {
	max	=	max	|| 500;
	if(img.width)	{
		if(img.width > img.height)
		{
			if(img.width > max)
				img.width	=	max;
		}
		else
		{
			if(img.height	>	max)
				img.height = max;
		}
    img.style.cursor = "pointer";
    img.onclick = function(){
      openImage(this.src, "");
    }
	}	else {
		window.setTimeout(new	fwrapper(resizeImg,	[img,	max]).invoke,	10);
	}
}
function openWndFindPW() {
	var	w	=	300, h = 150;
	var	x	=	(window.screen.availWidth	-	w) / 2,	y	=	(window.screen.availHeight - h)	/	2;
	var	wndFindPW	=	window.open("/webgear/member/findpw.asp",	"wndFindPW", "width="	+	w	+	"px,height=" + h + "px,left="	+	x	+	"px,top="	+	y	+	"px");
	if(wndFindPW){
		wndFindPW.focus();
		wndFindPW.moveTo(x,	y);
	}
}
function isChecked(name) {
	var	elems	=	document.getElementsByName(name);
	for(var	i	=	0; i < elems.length; i++)	{
		if(elems[i].checked)
			return true;
	}
	return false;
}
function toggle(name)	{
	var	elems	=	document.getElementsByName(name);
	for(var	i	=	0; i < elems.length; i++)	{
		elems[i].checked = !elems[i].checked;
	}
}
