function newXMLHttpRequest(){
	var xmlreq = false;
	if (window.XMLHttpRequest) {
		// Create XMLHttpRequest object in non-Microsoft browsers
		xmlreq = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		// Create XMLHttpRequest via MS ActiveX
		try {
			// Try to create XMLHttpRequest in later versions
			// of Internet Explorer
			xmlreq = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e1) {
			// Failed to create required ActiveXObject
			try {
				// Try version supported by older versions
				// of Internet Explorer
				xmlreq = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e2) {
				// Unable to create an XMLHttpRequest with ActiveX
			}
		}
	}
	return xmlreq;
}

String.prototype.trim = function()
{
	return this.replace(/(^\s*)|(\s*$)/gi, "");
}

function CommaAdd(n)
{
  return (n<0?"-":"")+Number(n.replace(/\..*|[^\d]/g,"")).toLocaleString().slice(0,-3); 
}

function CommaDrop(n)
{
	n = String(n);
	if (n == '') return '';
	else if (n == '-') return '';
	else if (n == '0-') return '';
	n = n.replace(/[^\d\.-]/g,'');
	n = String(n.match(/^-?\d*\.?\d*/));
	n = n.replace(/^(-?)(\d*)(.*)/,
	function(str,p1,p2,p3)
	{
		p2 = (p2>0) ? String(n.match(/[1-9]\d*$/)) : '';
		// p2 = (p2>0) ? String(parseInt(p2,10)) : '0';
		return p1 + p2 + p3;
	}
	);
	return n;
}

function adjustIFrameSize(iframeWindow)
{
	if (iframeWindow.document.height){
		var iframeElement = document.getElementById(iframeWindow.name);
		iframeElement.style.height = iframeWindow.document.height + 'px';
		//iframeElement.style.width = iframeWindow.document.width + 'px';
		alert(iframeElement.style.height);
	}
	else if (document.all){
		var iframeElement = document.all[iframeWindow.name];
		if (iframeWindow.document.compatMode && iframeWindow.document.compatMode != 'BackCompat')
		{
			iframeElement.style.height = iframeWindow.document.documentElement.scrollHeight + 'px';
			iframeElement.style.width = 580;
		}
		else {
			iframeElement.style.height = iframeWindow.document.body.scrollHeight;
			iframeElement.style.width = 580;
			//alert(iframeWindow.document.body.scrollHeight);
		}
	}
}
 
function include_js(link){
	var js;
    var html_doc = document.getElementsByTagName('head')[0];
    js = document.createElement('script');
    js.setAttribute('type', 'text/javascript');
    js.setAttribute('src', link);
    html_doc.appendChild(js);
    
    js.onreadystatechange = function (){
        if (js.readyState == 'complete'){
            alert('JS onreadystate faired');
        }
    }
    
    js.onload = function (){
        alert('JS onload fired');
    }
    return false;
}

function CenterLayer()
{
	var x,y;
	
	x = (screen.availWidth)/2;
	y = (screen.availHeight)/2;
	
	return [{PosX:x, PosY:y}];
}

function bodyCenterLayer()
{
	var x, y;
	
	x = (document.body.clientWidth)/2;
	y = (document.body.clientHeight)/2;
	
	return [{PosX:x, PosY:y}];
}

function screenCenterLayer()
{
	var x, y;
	
	if (self.innerHeight) {
		x = (screen.availWidth - self.innerWidth)/2;
		y = (screen.availHeight - self.innerHeight)/2;
	}
	else if (document.documentElement && document.documentElement.clientHeight) {
		x = (screen.availWidth - document.documentElement.clientWidth)/2;
		y = (screen.availHeight - document.documentElement.clientHeight)/2;
	}
	else if (document.body) {
		x = (screen.availWidth - document.body.clientWidth)/2;
		y = (screen.availHeight - document.body.clientHeight)/2;
	}
	
	return [{PosX:x, PosY:y}];
}

function inputCheck(f, field, msg)
{
	var f = eval("document." + f + "."+field);
	
	if (!f.value.trim()){
		alert(msg);
		f.value = "";
		f.focus();
		return false;
	}
	else {
		return true;
	}
}

function strCheck(id)
{
	f = eval("document.comment_form");
	
	var m = f.comment.value;
	var mm = m.length;
	document.getElementById("StringLength").innerHTML = mm;
	if(mm > 400){
		alert("Á¦ÇÑ ±ÛÀÚ¼ö¸¦ ÃÊ°úÇÏ¿´½À´Ï´Ù.");
		f.comment.value = m.substr(0, 400);
	}
	setTimeout("strCheck()" ,0);
}

function MenuRollOver(id, topid)
{
	var MainTarget = document.getElementById(topid);
	
	var imgTag = MainTarget.getElementsByTagName("IMG");
	
	for (x = 0; x < imgTag.length; x++) imgTag[x].src = imgTag[x].src.replace("_over.gif", ".gif");
	id.src = id.src.replace(".gif", "_over.gif");
}

function imgRollOver(id, type)
{
	switch (type)
	{
		case "OVER":			id.src = id.src.replace(".gif", "_over.gif");				break;
		case "OUT":				id.src = id.src.replace("_over.gif", ".gif");				break;
	}
}

function nextFocus(t, l, id)
{
	if (t.value.length >= l) document.getElementById(id).focus();
}

function getMenu()
{
	var menuDiv = document.getElementById("mMenu");
	var strMenu = "";
	
	for (x = 0; x < subMenu.length; x++){
		if (strMenu) strMenu += "<div class=\"bar\"></div>";
		strMenu += "<div class=\"Item\"><a href=\""+subMenu[x].LINK+"\" onfocus=\"blur();\"><img src=\"../images/sub"+setSub+"/menu_"+subMenu[x].NO+(setMain==subMenu[x].NO?"_over":"")+".gif\"></a></div>";
	}
	
	menuDiv.innerHTML = strMenu;
}

///////////////////// Ã¼Å©¹Ú½º Ã¼Å© ½ºÅ©¸³Æ® ///////////////////////////
function select_all(frm)
{
	if(frm.all.checked == true){
		to_value = true;
	}
	else {
		to_value = false;
	}

	for(i=0; i<frm.elements.length; i++){
		if(frm.elements[i].name == "process[]"){
			frm.elements[i].checked = to_value;
		}
	}
}
///////////////////// Ã¼Å©¹Ú½º Ã¼Å© ½ºÅ©¸³Æ® ³¡ ///////////////////////


///////////////////// ¸ÖÆ¼ ÄÁÆß ½ºÅ©¸³Æ® /////////////////////////////
function process_multi(frm)
{
	var cnt = 0;
	for(i=0; i<frm.elements.length; i++){
		if(frm.elements[i].name == "process[]" && frm.elements[i].checked == true){
			cnt++;
		}
	}
	
	if (cnt > 0){
		if (confirm("Á¤¸» »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?") == true){
			frm.submit();
		}
	}
	else {
		alert("¼±ÅÃµÈ ·¹ÄÚµå°¡ ¾ø½À´Ï´Ù.");
	}
}
///////////////////// ¸ÖÆ¼ ÄÁÆß ½ºÅ©¸³Æ® ³¡ /////////////////////////////

function flashOpen(id)
{
	if (!window.open("../include/flash_player.html?idx="+id, "flash_player", "top=200px, left=200px, width=562px, height=481px, scrollbars=no, status=no")){
		alert("ÆË¾÷ÀÌ Â÷´ÜµÇ¾ú½À´Ï´Ù.\nÂ÷´ÜµÈ ÆË¾÷À» Çã¿ëÇØÁÖ¼Å¾ß ÀÌ¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.");
	}
}

function flashOpen2(u)
{
	if (!window.open("../include/flash_player.html?setMovie="+u, "flash_player", "top=200px, left=200px, width=562px, height=481px, scrollbars=no, status=no")){
		alert("ÆË¾÷ÀÌ Â÷´ÜµÇ¾ú½À´Ï´Ù.\nÂ÷´ÜµÈ ÆË¾÷À» Çã¿ëÇØÁÖ¼Å¾ß ÀÌ¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.");
	}
}

// ÀÏ¹Ý ÇÃ·¡½Ã Embed
function normalFlash(src, w, h)
{
	html = '';
	html += '<object type="application/x-shockwave-flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" id="param" width="'+w+'" height="'+h+'">';
	html += '<param name="allowScriptAccess" value="always" />';
	html += '<param name="movie" value="'+src+'">';
	html += '<param name="quality" value="high">';
	html += '<param name="bgcolor" value="#ffffff">';
	html += '<param name="menu" value="false">';
	html += '<param name="wmode" value="transparent">';
	html += '<param name="swliveconnect" value="true">';
	html += '<embed src="'+src+'" quality=high bgcolor="#ffffff" menu="false" width="'+w+'" height="'+h+'" allowScriptAccess="always" swliveconnect="true" id="param" name="param" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"><\/embed>';
	html += '<\/object>';
	document.write(html);
}

// ÆË¾÷.
function procPopup()
{
	if (window.open("../_config/airport.html", "air", "width=625px, height=650px, scrollbars=yes")==false){
		alert("ÆË¾÷À» Çã¿ëÇØÁÖ¼Å¾ß ÀÌ¿ë°¡´ÉÇÕ´Ï´Ù.");
	}
}

/////////////////////// ÆË¾÷ ÄíÅ° Ã³¸®.           //////////////////////////
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 checkBlur()
{
	if(event.srcElement.tagName=="A" || event.srcElement.tagName=="IMG"){
		document.body.focus();
	}
}
document.onfocusin=checkBlur;

function optionAdd(txt, val, select_type)
{
	var op = document.createElement("OPTION");
	op.text = txt;
	op.value = val;
	op.selected = select_type?true:"";
	
	return op;
}

function optionDrop(target, i)
{
	target.remove(target.options[i].index);
}


/////		¸¶¿ì½º Æ÷ÀÎÅÍ À§Ä¡ ¹ÝÈ¯					////////////////////
var MousePox_x = 0;
var MousePox_y = 0;
function checkPoint(e){
	if (document.layers){
		MousePox_x = e.x;
		MousePox_y = e.y;
	}
	else if (document.all){
		MousePox_x = event.clientX;
		MousePox_y = event.clientY;
	}
	else if (document.getElementById){
		MousePox_x = e.clientX;
		MousePox_y = e.clientY;
	}
}
document.onmousemove=checkPoint;

/////		½ºÅ©·Ñ º¯Çü Áß¾Ó ÁÂÇ¥ ¹ÝÈ¯				////////////////////
function ScrollCenterPos(t, y)
{
    if (document.body.scrollTop){
    	var sTop = document.body.scrollTop;
    }
    else {
    	var sTop = document.documentElement.scrollTop;
    }
	
    document.getElementById(t).style.top = (sTop + y) + 'px';
}


function reflash()
{
	window.setTimeout("window.location.reload()", 1000);
}

/////		ºÏ¸¶Å©									////////////////////
function bookMarkCreater()
{
	if (window.sidebar){
		// IE
		window.sidebar.addPanel(hostTitle, hostUrl,"");
	} else if(window.external){
		// FF
		window.external.AddFavorite(hostUrl, hostTitle);
	}
	else if(window.opera && window.print) {
		// Opera´Â ¾ÈµÊ.
		return true;
	}
}

/////		Explorer 6# ¿ë png Åõ¸íÈ­				////////////////////
/*
pngfix=function()
{
	var els=document.getElementsByTagName('*');
	var i_p=/\.png/i;var 
	i=els.length;
	
	while (i-- >0){
		var el=els[i];
		var es=el.style;
		if(el.src&&el.src.match(i_p)&&es.filter==''){
			el.height = el.height;
			el.width = el.width;
			es.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+el.src+"',sizingMethod='crop')";
			el.src = "./images/clear.gif";
		}
		else{
			var elb=el.currentStyle.backgroundImage;
			if(elb.match(i_p)){
				var path=elb.split('"');
				var rep=(el.currentStyle.backgroundRepeat=='no-repeat')?'crop':'scale';
				es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path[1]+"',sizingMethod='"+rep+"')";
				es.height=el.clientHeight+'px';es.backgroundImage="none";
			}
		}
		
		if (el.currentStyle.position!='absolute' && !es.filter && !el.tagName.match(/(body|html|script)/gi)) es.position="relative";
		if (es.filter&&el.currentStyle.position=="relative") es.position="static";
	}
}

window.attachEvent('onload',pngfix);
*/