function openWindow(fileName, windowName, theWidth, theHeight, etcParam) {
	var objNewWin;
	var x = theWidth;
	var y = theHeight;

	var sy = window.screen.height / 2 - y / 2 - 70;
	
	if (etcParam == 'fix') {
		var sy = window.screen.height / 2 - y / 2 - 40;
	} else if (etcParam == 'resize') {
		var sy = window.screen.height / 2 - y / 2 - 40;
	}
	etcParam = "status:No;resizable:No;scroll:no";

	var sx = window.screen.width  / 2 - x / 2;

	if (sy < 0 ){
		sy = 0;
	}
	
	var sz = "px; dialogTop:" + sy + ";dialogLeft:" + sx;

	if (windowName == "newMessageWindow") 	{
		windowName = new String(Math.round(Math.random() * 100000));
	} 

	objNewWin = showModalDialog(fileName, window, etcParam + ";dialogWidth:" + x + "px; dialogHeight:" + y + sz);

//	window.open(fileName, "", etcParam + ";dialogWidth:" + x + "px; dialogHeight:" + y + sz);
}

// °áÀç¹®¼­ Call
function openDocWindow(fileName,windowName,etcParam,scrollbars) {
	var x;
	var y;

	if (windowName == "newMessageWindow") 
	{
	windowName = new String(Math.round(Math.random() * 100000));
	}

	if (etcParam == 'fix') {
		x = window.screen.availWidth - 10;
		y = window.screen.availheight - 30;

		etcParam = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0";
	}
	else if (etcParam == 'resize') {
		x = window.screen.availWidth - 10;
		y = window.screen.availheight - 30;

		etcParam = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars="+scrollbars+",resizable=1";
	}
	objNewWin = window.open(fileName,windowName, etcParam + ",top=0,left=0,width=" + x + ",height=" + y);
}

// 
function openHelpWindow(fileName,windowName,theWidth,theHeight, etcParam) {

	var objNewWin;
	var x = theWidth;
	var y = theHeight;

	var sy = window.screen.height / 2 - y / 2 - 70;
	if (etcParam == 'fix') {
		etcParam = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0";
		var sy = window.screen.height / 2 - y / 2 - 40;
	}
	else if (etcParam == 'resize') {
		etcParam = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1";
		var sy = window.screen.height / 2 - y / 2 - 40;
	}

	var sx = window.screen.width  / 2 - x / 2;


	if (sy < 0 ) {
		sy = 0;
	}
	
	var sz = ",top=" + sy + ",left=" + sx;

	if (windowName == "newMessageWindow") 
	{
	windowName = new String(Math.round(Math.random() * 100000));
	} 

	objNewWin = window.open(fileName,windowName, etcParam + ",width=" + x + ",height=" + y + sz);
	objNewWin.focus();
}

function openModalessWindow(fileName, windowName, theWidth, theHeight, etcParam) {
	var objNewWin;
	var x = theWidth;
	var y = theHeight;

	var sy = window.screen.height / 2 - y / 2 - 70;
	
	if (etcParam == 'fix') {
		var sy = window.screen.height / 2 - y / 2 - 40;
	} else if (etcParam == 'resize') {
		var sy = window.screen.height / 2 - y / 2 - 40;
	}
	etcParam = "status:No;resizable:No;scroll:no";

	var sx = window.screen.width  / 2 - x / 2;

	if (sy < 0 ){
		sy = 0;
	}
	
	var sz = "px; dialogTop:" + sy + ";dialogLeft:" + sx;

	if (windowName == "newMessageWindow") 	{
		windowName = new String(Math.round(Math.random() * 100000));
	} 

	objNewWin = showModelessDialog(fileName, window, etcParam + ";dialogWidth:" + x + "px; dialogHeight:" + y + sz);

//	window.open(fileName, "", etcParam + ";dialogWidth:" + x + "px; dialogHeight:" + y + sz);
}

function EnterToTab() {
    key_code			= event.keyCode;
    key_shift			= event.shiftKey;

    if(key_shift != true) {
		if(key_code == 13) {
			event.keyCode         = 9;
//			selectNext(event.srcElement, 1);
			return;
		}
    }
}

function EnterToTabTarget(TargetObj) {
    key_code			= event.keyCode;
    key_shift			= event.shiftKey;

    if(key_shift != true) {
		if(key_code == 13) {
			TargetObj.focus();
//			selectNext(event.srcElement, 1);
			return;
		}
    }
}


// ÄÞ¸¶ °ü·Ã
function CommaIn(input) {
	eval(input).value = putComma(eval(input).value);
}

function CommaOut(input) {
	eval(input).value = eval(input).value.replace(/,/gi,"");
}

function putComma(input) {
	var num = input;

	if (num < 0) {
		num *= -1;
		var minus = true
	}else{
		var minus = false
	}

	var dotPos = (num+"").split(".")
	var dotU = dotPos[0]
	var dotD = dotPos[1]
	var commaFlag = dotU.length%3

	if(commaFlag) {
		var out = dotU.substring(0, commaFlag)
		if (dotU.length > 3) out += ","
	}
	else var out = ""

	for (var i=commaFlag; i < dotU.length; i+=3) {
		out += dotU.substring(i, i+3)
		if( i < dotU.length-3) out += ","
	}

	if(minus) out = "-" + out
	if(dotD) return out + "." + dotD
	else return out
}

// Cookie °ü·Ã
var cProcID

function GetProcID(){
	var acookie = document.cookie;
	var op = 0;

	if(acookie.length > 0){
		var cc = acookie.split(";");
		for(var i = 0; i < cc.length; i++){
			if(cc[i].match("ProcID=")) {
				cProcID = cc[i].replace("ProcID=", "");
				cProcID = cProcID.replace("%B0%FC%B8%AE%C0%DA", "°ü¸®ÀÚ");
				cProcID = cProcID.replace("%7C", "|");
				cProcID = cProcID.replace("%7C", "|");
				cProcID = cProcID.replace("%7C", "|");
				return;
			}
		}
	}
}
GetProcID();

//
function InitFrameCheck(){
	var FrameLogOutPath = "/common/Logon_mgmt/Logoff.asp";

	try{
		var targetWindow;

		if (typeof(dialogArguments) == "undefined" && typeof(window.opener) == "undefined"){
			if (typeof(top.mainFrame) == "undefined"){
				top.location.replace(FrameLogOutPath);
				alert("Á¢±Ù ºÒ°¡ ÇÕ´Ï´Ù.");
			}
		}else{
			if (typeof(dialogArguments) == "undefined"){
				targetWindow = window.opener;
			}else{
				targetWindow = dialogArguments;
			}

			if (typeof(targetWindow.top.mainFrame) == "undefined"){
				window.close();
				alert("Á¢±Ù ºÒ°¡ ÇÕ´Ï´Ù.");
			}

		}
	}
	catch (e){
		top.location.replace(FrameLogOutPath);
		alert("Á¢±Ù ºÒ°¡ ÇÕ´Ï´Ù.");
	}
}
//InitFrameCheck();

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 jReplace(val, de1, de2){
	if (de2.indexOf(de1) >= 0){
		return '';
	}

	while (val.indexOf(de1) >= 0){
		val = val.replace(de1, de2);
	}

	return val;
}

function GetComp(obj_1, obj_2, ret){
	alert();
	if (obj_1 == obj_2){
		return ret
	}else{
		return ""
	}
}


function setCookie(name, value, expiredays) { 
	var todayDate = new Date(); 
	todayDate.setDate( todayDate.getDate() + expiredays ); 
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";" 
}

