function setCookie(name,value,expiredays)
{
	var todayDate = new Date();
	todayDate.setDate(todayDate.getDate() + expiredays);
	document.cookie = name + "=" + escape(value) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}


function getCookie(name)
{
	var nameOfCookie = name + "=";
	var x = 0;
	while (x <= document.cookie.length)
	{
		var y = (x+nameOfCookie.length);
		if (document.cookie.substring( x, y ) == nameOfCookie)
		{
			if ((endOfCookie=document.cookie.indexOf(";",y)) == -1)
			{
				endOfCookie = document.cookie.length;
			}
			return unescape(document.cookie.substring(y,endOfCookie));
		}

		x = document.cookie.indexOf(" ",x) + 1;
		if (x == 0)
		{
			break;
		}
	}
	return "";
}

function show(obj)
{
	obj.style.display = "";
}


function toggle(obj)
{
	if (obj.style.display == 'none')
		obj.style.display = '';
	else
		obj.style.display = 'none';
}
function hide(obj)
{
	obj.style.display = "none";
}


function fx(nNewPadding,el)
{
	while (el.tagName!="TD")
		el = el.parentNode;
	var nPadding = parseInt(el.getAttribute("nPadding"));
	el.style.paddingTop=nPadding+nNewPadding;
}

function defx(el)
{
	while (el.tagName!="TD")
		el = el.parentNode;
	var nPadding = parseInt(el.getAttribute("nPadding"));
	el.style.paddingTop = nPadding;

	ref = el.getAttribute("ref");
	if (ref)
	{
		var ref = document.getElementById(ref);

		while (ref.tagName!="TD")
			ref = ref.parentNode;

		var nPadding = parseInt(ref.getAttribute("nPadding"));
		ref.style.paddingTop = nPadding;
	}
}


function trim(str)
{
	newstr = str.replace (/(^\s*)|(\s*$)/g, "");
	return newstr;
}

function copyURL(s)
{
	var doc = document.body.createTextRange();
	var s = document.getElementById(s);
	doc.moveToElementText(s);
	doc.select();
	doc.execCommand('copy');
	alert('URLÀÌ Å¬¸³º¸µå¿¡ ÀúÀåµÇ¾ú½À´Ï´Ù.');
}

function copyText(sId)
{
	bResult = window.clipboardData.setData("Text",document.getElementById(sId).innerText);
	if (bResult)
		alert('Å¬¸³º¸µå¿¡ ÀúÀåµÇ¾ú½À´Ï´Ù.');
}


function showFlashObject(id,width,height,movie,flashvars,style)
{
	var s = '<object id="'+id+'" classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+width+'" height="'+height+'" style="'+style+'"><param name="movie" value="'+movie+'"/><param name="menu" value="false"/><param name="quality" value="high"/><param name="allowScriptAccess" value="sameDomain"/><param name="play" value="true"/><param name="wmode" value="transparent"/><param name="flashvars" value="'+flashvars+'"/><embed swLiveConnect="true" flashvars="'+flashvars+'" src="'+movie+'" quality="high" bgcolor="" wmode="transparent" width="'+width+'" height="'+height+'" name="'+id+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object>';
	document.write(s);
}


function Ajax()
{
	_ajax = this;
	this.xmlhttp = null;
	this.method = '';
	this.async = true;
	this.url = '';
	this.handler = this.nullify;
	this.init();
}

Ajax.prototype = {
	nullify:function(s){},
	init:function()
	{
		if (this.xmlhttp)
			return this.xmlhttp;

		var xmlhttp;
		if (window.ActiveXObject)
			xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
		else if (window.XMLHttpRequest)
			xmlhttp = new XMLHttpRequest();
		else
			xmlhttp = null;
		return xmlhttp;
	},

	loadText:function(url,method,data)
	{
		this.data = data;
		this.reponseType = 'text';
		this.load(url,method);
	},

	loadXML:function(url,method,data)
	{
		this.data = data;
		this.reponseType = 'xml';
		this.load(url,method);
	},

	load:function(url,method)
	{
		this.xmlhttp = this.xmlhttp || this.init();
		this.method = method == undefined ? 'GET' : method;
		this.url = url;
		window.setTimeout(this.sendRequest,10);
	},

	sendRequest:function()
	{
		if (_ajax.async)
			_ajax.xmlhttp.onreadystatechange = _ajax.onStateChange;

		_ajax.xmlhttp.open(_ajax.method,_ajax.url,_ajax.async);

		if (_ajax.method == 'POST')
			_ajax.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
		try
		{
			_ajax.xmlhttp.overrideMimeType("text/xml");
		}
		catch(e){}
		_ajax.xmlhttp.send(_ajax.method == 'POST' ? _ajax.data : null);
	},

	bind:function(func)
	{
		_ajax.handler = func;
	},

	onStateChange:function()
	{
		if (_ajax.xmlhttp.readyState == 4)
		{
			if (_ajax.xmlhttp.status == 200)
				_ajax.handler(_ajax.responseType == 'xml' ? _ajax.xmlhttp.responseXML : _ajax.xmlhttp.responseText);
			else
				_ajax.error();
		}
	},

	error:function()
	{
	}
}
