//ÆË¾÷Ã¢ ¶ç¿ì±â
function Pop_Open(ref, title, w, h) {
	var window_left = (screen.width-640)/2;
	var window_top = (screen.height-550)/2;
	popup=window.open(ref,title,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no, width=' + w + ',height=' + h + ',top=' + window_top + ',left=' + window_left + '');
	popup.focus();
}

// open modal window
function openModal(obj, file_name, width, height)
{
	var rand = Math.random() * 4;
	window.showModalDialog(file_name + '?rand=' + rand, obj, 'dialogWidth=' + width + 'px;dialogHeight=' + height + 'px;dialogLeft=300px;dialogTop=100px;resizable=no;status=no;scroll=no;help=no');
}

// ¼¿·ºÆ®¹Ú½º¿¡¼­ url ÀÌµ¿ÇÏ±â 2003-07-16
function goSvc(sel)
{
	var gourl = sel[sel.selectedIndex].value;
	if (gourl != "") {
		window.location.href = gourl;
	}
}


function MM_NewwinMenu(targ,selObj,restore){ //v3.0
  open(selObj.options[selObj.selectedIndex].value);
  if (restore) selObj.selectedIndex=0;
}



function confirm_go(gourl, msg) {
	if(confirm(msg)==true) {
		location.href = gourl;
	}
	else 
   	return false; 
}



//¼¿·ºÆ®½Ã¿¡ ¼±ÅÃÇÑ Ç×º¹À» selected ÇÏ°Ô ÇÔ 2004-05-25 
function setSelect(obj,value){
    if(value){
      var str = "document.all['"+obj+"'].value = '"+value+"';";
      eval(str);
    }
}


//Ã¼Å©¹Ú½º Ç¥½ÃÇÏ±â
function set_chkbox(form_, seq)
{
	var tempval=eval(form_ + "[" + seq + "]")
	tempval.checked=true;
}



// getÀ¸·Î ³Ñ±æ¶§ 
function goSearch(urlData) {
	location.href = urlData;
}



//ÄÞ¸¶ ³Ö±â(Á¤¼ö¸¸ ÇØ´ç) 
function comma(val) { 
	val = get_number(val); 
	if(val.length <= 3) return val; 

	var loop = Math.ceil(val.length / 3); 
	var offset = val.length % 3; 

	if(offset==0) offset = 3; 
	var ret = val.substring(0, offset); 

	for(i=1;i<loop;i++) { 
		ret += "," + val.substring(offset, offset+3); 
		offset += 3; 
	} 
	return ret; 
} 


// ·Î±×ÀÎ
function login(the_form) {
	alert(the_form);
	the_form.submit();
}

// ·Î±×¾Æ¿ô
function logout(the_form) {
	the_form.submit();
}


// ¹®ÀÚ¿­ ±æÀÌ
function chkLength(_value, min_length, max_length)
{
    if(chkNull(_value) == false) return false;

    var temp = "";
    var count = 0;
    for(var i=0; i<_value.length; i++)
    {
        temp = _value.charAt(i);
        if(escape(temp).length > 4) count += 2;
        else count += 1;
    }
    if(count < min_length) return false;
    if(max_length != 'unlimit' && count > max_length) return false;
}

// ¼ýÀÚ,¾ËÆÄºª¸¸
function chkAlNum(strValue)
{
    for(var i=0; i<strValue.length;i ++)
    {
        var strCh = strValue.charAt(i).toUpperCase();
        if(strCh >="A" && strCh <="Z") continue;
        if(strCh >="0" && strCh <="9") continue;
        if(strCh =" ") continue;
        return false;
    }
}

// ÇÑ±ÛÃ¼Å©
function chkHan(strValue)
{
    for(i=0;i<strValue.length;i++)
    {
        var a=strValue.charCodeAt(i);
        if(a > 128)
        {
            return true;
        }
        else
        {
            return false;
        }
    }
}

// ¼ýÀÚÃ¼Å©
function chkNum(inputname)
{
    var formstr=eval(inputname);
    for(var i=0;i<formstr.value.length;i++)
    {
        var chr=formstr.value.substr(i,1);
        if((chr<'0'||chr>'9') && chr!='-' && chr!='_')
        {
            return false;
        }
    }
    return true;
}

//¸µÅ©µÈ ÀÌ¹Ì¸® Å×µÎ¸® Á¡¼± ¾ø¾Ö±â
function allblur() {
  for (i = 0; i < document.links.length; i++) {
    var obj = document.links[i];
    if(obj.addEventListener) obj.addEventListener("focus", oneblur, false);
    else if(obj.attachEvent) obj.attachEvent("onfocus", oneblur);
  }
}
 
function oneblur(e) {
  var evt = e ? e : window.event;

 

  if(evt.target) evt.target.blur();
  else if(evt.srcElement) evt.srcElement.blur();
}


//ÇÃ·¡½Ã ÄÁÆ®·Ñ È°¼ºÈ­
if(!document.__define_CObjectLoader__)
{
	document.__define_CObjectLoader__ = true

	CObjectLoader();
	function CObjectLoader()
	{
		CObjectLoader.load = function(loadStr)
		{
			document.write(loadStr);
		}
	}

}

function getAbsLeft(obj) {
	return (obj.offsetParent==null)? 0 : obj.offsetLeft+getAbsLeft(obj.offsetParent);
}

function getAbsTop(obj) {
	return (obj.offsetParent==null)? 0 : obj.offsetTop+(obj.offsetParent.offsetTop);
}

function MM_showHideLayers() {
	var i, visStr, args, theObj;
	args = MM_showHideLayers.arguments;
	for (i=0; i<(args.length-1); i+=2) { //with arg triples (objNS,objIE,visStr)
		visStr   = args[i+1];
		if (navigator.appName == 'Netscape' && document.layers != null) {
			theObj = eval("document.layers['" + args[i] + "']");
			if (theObj) theObj.visibility = visStr;
		} else if (document.all != null) { //IE
			if (visStr == 'show') visStr = 'visible';
			if (visStr == 'hide') visStr = 'hidden';
			theObj = eval("document.all['" + args[i] + "'].style");
			if (theObj) theObj.visibility = visStr;
	
		} 
	}
}

function allClose() {
	MM_showHideLayers('Calendar_L', "hide");
}

function showCalendar(name) {
    var left, top;
    obj_st = eval(document.all.date_st.style);

    if(document.all['Calendar_L'].style.visibility=="visible") {
        allClose();
        document.all['Calendar_L'].style.visibility=="hidden";
        MM_showHideLayers('Calendar_L', "hide");
    } else {
        allClose();
        Cal_L.location.href="/option/calendar.php?sel_type=st&name=" + name;
        var theObj;
        theObj = eval("document.all['Calendar_L'].style");
        if(theObj) {
            theObj.left = event.x+10 ;
            theObj.top = event.y-20;
        }
        MM_showHideLayers('Calendar_L', "show");
    }
}