function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

/*
function bluring(){

    if(event.srcElement != null) {
        if(event.srcElement.tagName=="A" || event.srcElement.tagName=="IMG") document.body.focus();
    }
} 
*/
//document.onfocusin = bluring;




//trap onload event
/*
function window::onload() {
    
     toHTTPS();    //http:// --> http:// �̵�

    //Determine browser, we only need this for Internet Explorer 
    if (navigator.appName == "Microsoft Internet Explorer") {

        //Array of elements to be replaced
        var arrElements = new Array(3);
        arrElements[0] = "object";
        arrElements[1] = "embed";
        arrElements[2] = "applet";


        //Loop over element types
        for (n = 0; n < arrElements.length; n++) {

            //set object for brevity
            replaceObj = document.getElementsByTagName(arrElements[n]);

            //loop over element objects returned
            for (i = 0; i < replaceObj.length; i++ ) {

                //set parent object for brevity
                parentObj = replaceObj[i].parentNode;

                //grab the html inside of the element before removing it from the DOM
                newHTML = parentObj.innerHTML;

                //remove element from the DOM
                parentObj.removeChild(replaceObj[i]);

                //stick the element right back in, but as a new object
                parentObj.innerHTML = newHTML;

               // alert(newHTML);

                }
            }
        }

    }
*/





function getCookie(name) {
    var arg = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;
    while(i < clen) {
        var j = i + alen;
        if(document.cookie.substring(i, j) == arg) {
            var end = document.cookie.indexOf(";", j);
            if(end == -1) end = document.cookie.length;
            return unescape(document.cookie.substring(j, end));
        }
        i = document.cookie.indexOf(" ", i) + 1;
        if(i == 0) break;
    }
    return null;
}

function setCookie(name, value, expiredays )
{
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

/*=======================================================================
Function��	: getByteLen
��      ��	: �ش� ���ڿ��� ����Ʈ ���ϱ�
Parameter	: str
return		: ����Ʈ ����
�����ۼ���	:
�����ۼ���	: 2009�� 06�� 05��
����������	: 2009�� 06�� 05��
========================================================================*/
function getByteLen(str){

	return(str.length+(escape(str)+"%u").match(/%u/g).length-1);
}

/*=======================================================================
Function��	: Replace_Blank
��      ��	: �ش� ���ڿ� �������
Parameter	: OrgStr
return		: ������ŵ� ���ڿ�
�����ۼ���	:
�����ۼ���	: 2009�� 06�� 05��
����������	: 2009�� 06�� 05��
========================================================================*/
function Replace_Blank(OrgStr) {

    var str = OrgStr.replace(/\ /gi,"");    //�ش繮�ڿ� ��� ���ϻ��
    return str;
}

/*=======================================================================
Function��	: Replace_All
��      ��	: �ش� ���ڿ��� ��ȯ
Parameter	: OrgStr,FindStr, NewStr
return		: ��ȯ�� ���ڿ�
�����ۼ���	:
�����ۼ���	: 2009�� 06�� 05��
����������	: 2009�� 06�� 05��
========================================================================*/
function Replace_All(OrgStr, FindStr, NewStr) {

  //\n --> \\n : \r --> \\r �Է�  
  
  var str = OrgStr.replace(eval("/" + FindStr + "/gi"), NewStr);
  return str;
}

/*=======================================================================
Function��	: checkID
��      ��	: ���� ���ڸ� �Է� ���� �Լ�
Parameter	: input
return		: ����
�����ۼ���	:
�����ۼ���	: 2009�� 06�� 05��
����������	: 2009�� 06�� 05��
========================================================================*/
function checkID(input) {

	var chars = "abcdefghijklmnopqrstuvwxyz0123456789";

	if(!containsCharsOnly(input, chars)){
		alert("����(�ҹ���) �� ���ڸ� �Է°����մϴ�.");
		input.value = "";
		input.focus();
		return false;
	}
}

/*=======================================================================
Function��	: checkPW
��      ��	: ���� ���ڸ� �Է� ���� �Լ�
Parameter	: input
return		: ����
�����ۼ���	:
�����ۼ���	: 2009�� 06�� 05��
����������	: 2009�� 06�� 05��
========================================================================*/
function checkPW(input) {
    var bFlag = false;

	bFlag = containsCharsOnly(input, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
    
	if(Replace_Blank(input.value) ==  "") return false;

	if(!bFlag){
	    if(containsCharsOnly(input, "0123456789")){
		    alert("��й�ȣ�� ������ ���ڸ� ȥ���Ͽ� 6 ~ 12�ڸ� �̳� �������� ���� �� �ֽ��ϴ�.");
			input.value = "";
			input.focus();
			return false;      
        }
	}else{         
        alert("��й�ȣ�� ������ ���ڸ� ȥ���Ͽ� 6 ~ 12�ڸ� �̳� �������� ���� �� �ֽ��ϴ�.");
     	input.value = "";
		input.focus();
		return false; 
    }

}

/*=======================================================================
Function��	: checkPW
��      ��	: ���� ���ڸ� �Է� ���� �Լ�
Parameter	: input
return		: ����
�����ۼ���	:
�����ۼ���	: 2009�� 06�� 05��
����������	: 2009�� 06�� 05��
========================================================================*/
function checkPW2(input) {
	var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

	if(!containsCharsOnly(input, chars)){
		alert("���� �� ���ڸ� �Է°����մϴ�.");
		input.value = "";
		input.focus();
		return false;
	}
}

/*=======================================================================
Function��	: checkID
��      ��	: ���� ���ڸ� �Է� ���� �Լ�
Parameter	: input
return		: ����
�����ۼ���	:
�����ۼ���	: 2009�� 06�� 05��
����������	: 2009�� 06�� 05��
========================================================================*/
function checkMailA(input) {

	var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.";

	if(!containsCharsOnly(input, chars)){
		alert("�Է��Ҽ���� ���� �Դϴ�.");
		input.value = "";
		input.focus();
		return false;
	}
}

/*=======================================================================
Function��	: checkID
��      ��	: ���� ���ڸ� �Է� ���� �Լ�
Parameter	: input
return		: ����
�����ۼ���	:
�����ۼ���	: 2009�� 06�� 05��
����������	: 2009�� 06�� 05��
========================================================================*/
function checkMailB(input) {

	var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.";

	if(!containsCharsOnly(input, chars)){
		alert("�Է��Ҽ���� ���� �Դϴ�.");
		input.value = "";
		input.focus();
		return false;
	}
}


/*=======================================================================
Function��	: onlyNum
��      ��	: ���ڸ� �Է� ���� �Լ�
Parameter	: input
return		: ����
�����ۼ���	:
�����ۼ���	: 2009�� 06�� 05��
����������	: 2009�� 06�� 05��
========================================================================*/
function onlyNum(input){
    var chars = "0123456789";

    input.style.imeMode = "disabled";

    if(!containsCharsOnly(input, chars)){
		alert("���ڸ� �Է°����մϴ�.");
		input.value = "";  // input.value.substring(0, input.value.length -1);
		input.focus();
		return false;
	}
}

/*=======================================================================
Function��	: containsCharsOnly
��      ��	: �Է� ���� �� ��� ���� �� �Լ�
Parameter	: input, chars
return		: boolean
�����ۼ���	:
�����ۼ���	: 2009�� 06�� 05��
����������	: 2009�� 06�� 05��
========================================================================*/
function containsCharsOnly(input, chars) {
	for (var inx = 0; inx < input.value.length; inx++) {
		if (chars.indexOf(input.value.charAt(inx)) == -1)
			return false;
	}
	return true;
}


/*=======================================================================
Function��	: valText
��      ��	: �Է� ���� Byte(obj.maxLength) �� �ʰ��� ��� ���� �޼��� ���
Parameter	: obj
return		:
�����ۼ���	:
�����ۼ���	: 2009�� 06�� 05��
����������	: 2009�� 06�� 05��
========================================================================*/
function valText(obj){

   var strValue = obj.value.replace(/[, ]/gi,"");
   var iMax = obj.maxLength;

   var limit = getByteLen(strValue);
   if(limit > iMax)
   {
		alert('�Է� ������ �ʰ� �Ͽ����ϴ�. \n' + '���� �� ����/��ȣ�� ' + iMax + '���� ' + '�ѱ��� ' + (iMax / 2) + '���� ���� �Է� �����մϴ�.' );
		obj.focus();
   }
}

/*=======================================================================
Function��	: Open_Window
��      ��	: Open Window �Լ�
Parameter	: sUrl,sWidth,sHeight
return		: boolean
�����ۼ���	:
�����ۼ���	: 2009�� 06�� 05��
����������	: 2009�� 06�� 05��
========================================================================*/
function Open_Window(sUrl,sWidth,sHeight)
{
   var screenPosX = screen.availWidth/2 - sWidth / 2;
   var screenPosY = screen.availHeight/2 - sHeight / 2;
   var features = "'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, top="+screenPosY+", left="+screenPosX+", width=" + sWidth + ", height=" + sHeight + "'";

   window.open(sUrl , null, features);

}

/*=======================================================================
Function��	: Open_Scroll_Window
��      ��	: Open Window �Լ�(��ũ�ѹ� ��)
Parameter	: sUrl,sWidth,sHeight
return		: boolean
�����ۼ���	: ��ȣ��
�����ۼ���	: 2009�� 08�� 16��
����������	: 2009�� 08�� 16��
========================================================================*/
function Open_Scroll_Window(sUrl,sWidth,sHeight)
{
   var screenPosX = screen.availWidth/2 - sWidth / 2;
   var screenPosY = screen.availHeight/2 - sHeight / 2;
   var features = "'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, top="+screenPosY+", left="+screenPosX+", width=" + sWidth + ", height=" + sHeight + "'";

   window.open(sUrl , null, features);

}

/*=======================================================================
Function��	: Open_Img_Window
��      ��	: �̹��� ��� Open Window �Լ�
Parameter	: sUrl
return		: boolean
�����ۼ���	: ��Ʈ - ��ȣ��
�����ۼ���	: 2009�� 08�� 10��
����������	: 2009�� 08�� 10��
========================================================================*/
function Open_Img_Window(src){

    var screenPosX = (screen.availWidth/2) - 1;
    var screenPosY = (screen.availHeight/2) - 1;
    window.open('/popup/ImageView.jsp?URL='+src+'&Init=yes','','scrollbars=no,status=no,toolbar=no,resizable=0,location=no,menu=no,width=2,height=2,'+'top='+screenPosY+',left='+screenPosX);

}


/*=======================================================================
Function��	: Open_Full_Window
��      ��	: Open Window �Լ� - ��üȭ��
Parameter	: sUrl
return		: boolean
�����ۼ���	: ��Ʈ - ��ȣ��
�����ۼ���	: 2009�� 07�� 27��
����������	: 2009�� 07�� 27��
========================================================================*/
function Open_Full_Window(sUrl)
{

   var sWidth = screen.availWidth;
   var sHeight = screen.availHeight;
   var screenPosX = 0;
   var screenPosY = 0;

   var features = "'channel=1, hotkeys=1, titlebar=1, toolbar=1, location=1, directories=1, status=1, menubar=1, scrollbars=1, resizable=1, top="+screenPosY+", left="+screenPosX+", width=" + sWidth + ", height=" + sHeight + "'";

   window.open(sUrl , '', features);

}

/*=======================================================================
Function��	: Modal_Window
��      ��	: ShowModal �Լ�
Parameter	: input, chars
return		: return value
�����ۼ���	:
�����ۼ���	: 2009�� 06�� 05��
����������	: 2009�� 06�� 05��
========================================================================*/
function Modal_Window(sUrl,sParam, sFeature)
{
	try
	{
		var strReturn = "";
		var strFearture_TMP = "";
		if(sFeature != null)
		{
			//var strNewFearture = ModifyDialogFeature(sFeature);
			strReturn = window.showModalDialog(sUrl, sParam, sFeature);	//encodeURI(sUrl), window, "dialogWidth:670px; dialogHeight:555px;status:no;scroll:no;help:no"
		}
		else
			strReturn = window.showModalDialog(sUrl, null, sParam);

		return strReturn;
	}
	catch(exception){}
}


function movetip()
{
	leftx = window.event.screenX;
	topy  = window.event.screenY;
}
var leftx = null;
var topy  = null;
document.onmouseup=movetip;

/*=======================================================================
Function��	: Modal_Window
��      ��	: ShowModal �Լ�
Parameter	: input, chars
return		: return value
�����ۼ���	:
�����ۼ���	: 2009�� 06�� 05��
����������	: 2009�� 06�� 05��
========================================================================*/
function Calendar(obj)
{

	var sUrl = "/popup/calendar.jsp?cDate=" + obj.value;
	var returnValue = Modal_Window(encodeURI(sUrl), window, "dialogWidth:200px;dialogHeight:215px;status:no;scroll:no;help:no;dialogLeft:" + leftx + ";dialogTop:" + topy + ";");

	if(typeof(returnValue) != "undefined" && returnValue != "undefined")
	{
	    obj.value = returnValue
	}
}


/*=======================================================================
Function��	: moveObj
��      ��	: �������� �Է��� �̵��Լ�
Parameter	: currObj, nextObj(����obj, �̵���obj, ��������)
return		:
�����ۼ���	:
�����ۼ���	: 2009�� 06�� 05��
����������	: 2009�� 06�� 05��
========================================================================*/
function moveObj(currObj, nextObj)
{
    if(currObj.value.length == currObj.maxLength){
	    nextObj.focus();
	}
}

/*=======================================================================
Function��	: setYYMM
��      ��	: �������� �Է��� �̵��Լ�
Parameter	: strObjNm(��ü��)
return		:
�����ۼ���	:
�����ۼ���	: 2009�� 06�� 05��
����������	: 2009�� 06�� 05��
========================================================================*/
function setYYMM(strObjNm)
{
	document.all[strObjNm].value = document.all[strObjNm + "YYYY"].value + "-" + document.all[strObjNm + "MM"].value;
}


/*=======================================================================
Function��	: GetUtf8String
��      ��	: �ѱ� �ʼ�,�߼�,���� �и� ��ũ��Ʈ
Parameter	: strValue(�Է°�)
return		:
�����ۼ���	:
�����ۼ���	: 2009�� 06�� 05��
����������	: 2009�� 06�� 05��
========================================================================*/
function GetUtf8String(strValue) {

    var ch = strValue;
    var retValue = "";

    var ChrLen = ch.length;
    var TotalValue = "";
    var Cho  = "";
    var Jung = "";
    var jong = "";
    for(i=0; i < ChrLen ; i++){
        var OneStr = ch.substring(i,i+1);
        var regExp1 = /[^-a-zA-Z0-9]/;
        if (regExp1.test(OneStr)){  // ���� �� ���ڸ� �����ϴ��� üũ�Ѵ�. ( �ѱ� �� Ư�����ڸ� �������� �ʴ´�. )
            var n_ch = OneStr.charCodeAt();
            var ch_T = (n_ch - 0xAC00) % 28;
            var ch_V = Math.floor((n_ch - 0xAC00) / 28) % 21;
            var ch_L = Math.floor(Math.floor((n_ch - 0xAC00) / 28) / 21);
            Cho = String.fromCharCode(ch_L + 0x1100);
            Jung = String.fromCharCode(ch_V + 0x1100 + 0x61);
            jong = String.fromCharCode(ch_T + 0x1100 + 0xA7);
            TotalValue = TotalValue + Cho + Jung + jong;
        }else{
            TotalValue = TotalValue + OneStr;
        }
    }
    return retValue = TotalValue.replace(" ","");
}

/*=======================================================================
Function��	: img_resize
��      ��	: �Խ��� Image Resize
Parameter	: oImg, iWidth
return		:
�����ۼ���	:
�����ۼ���	: 2009�� 06�� 05��
����������	: 2009�� 06�� 05��
========================================================================*/

function img_resize(strImg,iwidth){
        var table_width = iwidth;
        var img_num = 0;

        if(typeof(document.all[strImg]) != "undefined")
        {
            if(typeof(document.all[strImg].length) == "undefined")
            {
                img_num = 1
                for(i=0; i < img_num; i++){
                    if(document.all[strImg].width > table_width)
                        document.all[strImg].width = table_width;
                }
            }
            else{
                img_num = document.all[strImg].length;
                for(i=0; i < img_num; i++){
                    if(document.all[strImg][i].width > table_width)
                        document.all[strImg][i].width = table_width;
                }
            }
        }

}

/*=======================================================================
Function��	: uploadImageCheck
��      ��	: �̹������� ���ε�� ���� �뷮(2MB),���(gif,jpg,jpeg,bmp) üũ
Parameter	: obj, maxsize, sizeObj(�̹��������� ��θ� ������ ��Ʈ����ü,���ѿ뷮,���Ͽ뷮��� ��Ʈ��obj)
return		: ������ ������ ���� �뷮
�����ۼ���	: ��Ʈ - ��ȣ��
�����ۼ���	: 2009�� 07�� 16��
����������	: 2009�� 07�� 16��
========================================================================*/

// ���� ���� ����� ���Ͼ��ε� ��Ʈ�� ����
function resetImage(obj)
{
  obj.outerHTML = obj.outerHTML
}

 // imageLoad �۵��� ����߻�� �̹��� ��ü reset
 function tempBlank() { }

// �̹��� üũ ����
function uploadImageCheck(obj, maxsize, sizeObj)
{
  var value = obj.value;                    //���������� ���



  var src = getFileExtension(value);        //�̹��� Ȯ���� ����
  if (src == "") {
    alert('�ùٸ� �̹��� ������ �Է��Ͻʽÿ�.');
    sizeObj.value = 0;
    resetImage(obj);
    return;
  }
  else if ( !((src.toLowerCase() == "gif") || (src.toLowerCase() == "jpg") || (src.toLowerCase() == "jpeg") || (src.toLowerCase() == "bmp")) ) {
    alert('gif, jpg, jpeg, bmp ���ϸ� �����մϴ�.');
    sizeObj.value = 0;
    resetImage(obj);
    return;
  }else if(!ForbiddenFileCheck(value)){           //������ ���ϸ� üũ
    sizeObj.value = 0;
    resetImage(obj);
    return;
  }

  imageCall(obj, value, maxsize, sizeObj);
}

//�̹��� ���� ���� �� Validationüũ
function imageCall(obj, value, maxsize, sizeObj)
{
  //�̹��� ��ü�� �������� ����
  var imgInfo = new Image();
  imgInfo.dynsrc = value;          //�̹����� ��� ����

  //�ڴ��� ������ �뷮�� byteũ��� ��ȯ
  if (maxsize == "2MB") {
    maxFileSize = 2048000; // �ִ� 2MB����
  }

  //�߸�� �̹��� ���� üũ
  if (imgInfo.dynsrc == "") {
    alert('�׸������� ������ �� ����ϴ�.');
    sizeObj.value = 0;
    resetImage(obj);
    this.onload = tempBlank;
    return;
  }

  //���� �뷮 üũ(2MB�̳�)
  if (imgInfo.fileSize > maxFileSize) {
    alert('�����Ͻ� �׸� ������ ��� �ִ�ũ���� ' + (maxFileSize / 1000)  + 'kb(' + maxsize + ')' + ' �� �ʰ��Ͽ����ϴ�.');
    sizeObj.value = 0;
    resetImage(obj);
    this.onload = tempBlank;
    return;
  }

  sizeObj.value = imgInfo.fileSize / 1000;       //���������� �뷮ǥ�� ��Ʈ���� ���(kbyte)����

}



/*=======================================================================
Function��	: uploadFileCheck
��      ��	: ����÷�ν� ���� �뷮(5MB)üũ
Parameter	: obj, maxsize, sizeObj(������ ��θ� ������ ��Ʈ����ü,���ѿ뷮,���Ͽ뷮��� ��Ʈ��obj)
return		: ������ ������ ���� �뷮
�����ۼ���	: ��Ʈ - ��ȣ��
�����ۼ���	: 2009�� 07�� 19��
����������	: 2009�� 07�� 19��
========================================================================*/

// ���� ���� ����� ���Ͼ��ε� ��Ʈ�� ����
function resetFile(obj)
{
  obj.outerHTML = obj.outerHTML
}

 // imageLoad �۵��� ����߻�� �̹��� ��ü reset
 function tempFileBlank() { }

// ���� üũ ����
function uploadFileCheck(obj, maxsize, sizeObj)
{
  var value = obj.value;                    //���������� ���

  if(!ForbiddenFileCheck(value)){           //������ ���ϸ� üũ
      sizeObj.value = 0;
      resetFile(obj);
      return;
  }

  fileCall(obj, value, maxsize, sizeObj);
}

//���� ���� loading
function fileCall(obj, value, maxsize, sizeObj)
{
  //��ü�� �������� ����
  var fileInfo = new Image();

  fileInfo.dynsrc = value;          //������ ��� ����

  //�ڴ��� ������ �뷮�� byteũ��� ��ȯ
  if (maxsize == "5MB") {
    maxFileSize = 5120000; // �ִ� 5MB����
  }

  //���� �뷮 üũ(5MB�̳�)
  if (fileInfo.fileSize > maxFileSize) {
    alert('�����Ͻ� ÷�������� ��� �ִ�ũ���� ' + (maxFileSize / 1000)  + 'kb(' + maxsize + ')' + ' �� �ʰ��Ͽ����ϴ�.');
    sizeObj.value = 0;
    resetFile(obj);
    this.onload = tempFileBlank;
    return;
  }

  sizeObj.value = fileInfo.fileSize / 1000;       //���������� �뷮ǥ�� ��Ʈ���� ���(kbyte)����

}

/*=======================================================================
Function��	: getFileExtension
��      ��	: ������ Ȯ���� ���ϱ�
Parameter	: filePath(������ ���)
return		: Ȯ���ڰ� ���ܵ� ���ϸ�
�����ۼ���	: ��Ʈ - ��ȣ��
�����ۼ���	: 2009�� 07�� 19��
����������	: 2009�� 08�� 21��
========================================================================*/
function getFileExtension(filePath)
{
  var lastIndex = -1;
  lastIndex = filePath.lastIndexOf('.');
  var extension = "";

  if ( lastIndex != -1 ) {
    extension = filePath.substring( lastIndex+1, filePath.len );
  }
  else {
    extension = "";
  }

  return extension;
}

/*=======================================================================
Function��	: getfileName
��      ��	: ���ϸ� ���ϱ�
Parameter	: filePath(������ ���)
return		: Ȯ���ڰ� ���ܵ� ���ϸ�
�����ۼ���	: ��Ʈ - ��ȣ��
�����ۼ���	: 2009�� 08�� 21��
����������	: 2009�� 08�� 21��
========================================================================*/
function getfileName(filePath){
    var lastIndex = -1;
    lastIndex = filePath.lastIndexOf('\\');
    var fileName = '';
    if(lastIndex != -1){
        fileName = filePath.substring(lastIndex+1,filePath.length).split(".")[0];
    }

    return fileName;
}

/*=======================================================================
Function��	: getImgWidth
��      ��	: �̹����� ����ũ�� ���ϱ�
Parameter	: src(�̹��������� ���)
return		: �̹����� ����ũ��
�����ۼ���	: ��Ʈ - ��ȣ��
�����ۼ���	: 2009�� 08�� 10��
����������	: 2009�� 08�� 10��
========================================================================*/
function getImgWidth(src){

  var imgWidth = new Image();
  imgWidth.src = src;              //�̹����� ��� ����

  return imgWidth.width;

}

/*=======================================================================
Function��	: getImgHeight
��      ��	: �̹����� ����ũ�� ���ϱ�
Parameter	: src(�̹��������� ���)
return		: �̹����� ����ũ��
�����ۼ���	: ��Ʈ - ��ȣ��
�����ۼ���	: 2009�� 08�� 10��
����������	: 2009�� 08�� 10��
========================================================================*/
function getImgHeight(src){

  var imgHeight = new Image();
  imgHeight.src = src;          //�̹����� ��� ����

  return imgHeight.height;
}


/*=======================================================================
Function��	: getFileSize
��      ��	: ÷�ε� ������ �뷮���ϱ�(byte)
Parameter	: src(÷�������� ���)
return		: ÷�ε� ������ �뷮(byte)
�����ۼ���	: ��Ʈ - ��ȣ��
�����ۼ���	: 2009�� 08�� 10��
����������	: 2009�� 08�� 10��
========================================================================*/
function getFileSize(src){

  var fileInfo = new Image();
  fileInfo.dynsrc = src;              //������ ��� ����

  return fileInfo.fileSize;

}


/*=======================================================================
Function��	: FileOpen
��      ��	: ÷�ε� ���� Ȯ��
Parameter	: src(÷�������� ���)
return		:
�����ۼ���	: ��Ʈ - ��ȣ��
�����ۼ���	: 2009�� 08�� 10��
����������	: 2009�� 08�� 10��
========================================================================*/
function FileOpen(src){
    //÷�������� �̹����ϰ�� �̹��� �����Լ��� ���(common.js)
    var value = getFileExtension(src);        //�̹��� Ȯ���� ����
    if ( value.toLowerCase() == "gif" || value.toLowerCase() == "jpg" || value.toLowerCase() == "jpeg" ){
        Open_Img_Window(src);
    }
    else{   //�Ϲ������� ���
        window.open(src,'','');
    }
}


/*=======================================================================
Function��	: ForbiddenCheck
��      ��	: ������ ���͸�
Parameter	: search   (�˻� ���ڿ�)
return		: true, false(boolean)
�����ۼ���	: ��Ʈ - ���ؼ�
�����ۼ���	: 2009�� 08�� 20��
����������	: 2009�� 08�� 20��
========================================================================*/
function ForbiddenCheck(search){

    //TRIMó��
    search = Replace_All(search,'\\r','');
    search = Replace_All(search,'\\n','');
    search = Replace_All(search,' ','');

    //����� �迭�� �ִ´�
	var NoWord = new Array();
    NoWord = ForbiddenWord();

    //�˻��� �ܾ �迭�� �ֱ����� �迭 ����
	var word_Array = new Array();

    var word ="";
	
	for(j = 0 ; j < search.length ; j++){ // �ι�° for�� i�� ������ ���� ��
		for(i = j ; i < search.length ; i++){ //�˻��� �ܾ �迭�� �ְ� �ܾ �����Ѵ�
			word_Array[i] = search.charAt(i);				
			word += word_Array[i];
			for(z = 0 ; z < NoWord.length ; z++){ // �ܾ ������ �迭�� ����� ���� �迭�� �� �Ͽ� üũ�Ѵ�
				if(word == NoWord[z]){
                    alert(NoWord[z]+"��(��) ������ �Դϴ�.");
                    return false;
				}			
			}
		}
		word = "";
	}

    return true;
}

/*=======================================================================
Function��	: ForbiddenFileCheck
��      ��	: ���� ���ϸ� ���͸�
Parameter	: filePath   (���� ���)
return		: true, false(boolean)
�����ۼ���	: ��Ʈ - ��ȣ��
�����ۼ���	: 2009�� 08�� 21��
����������	: 2009�� 08�� 21��
========================================================================*/
function ForbiddenFileCheck(filePath){
    var search = getfileName(filePath);
    //TRIMó��
    search = Replace_All(search,'\\r','');
    search = Replace_All(search,'\\n','');
    search = Replace_All(search,' ','');

    //����� �迭�� �ִ´�
	var NoWord = new Array();
    NoWord = ForbiddenWord();

    //�˻��� �ܾ �迭�� �ֱ����� �迭 ����
	var word_Array = new Array();

    var word ="";

	for(j = 0 ; j < search.length ; j++){ // �ι�° for�� i�� ������ ���� ��
		for(i = j ; i < search.length ; i++){ //�˻��� �ܾ �迭�� �ְ� �ܾ �����Ѵ�
			word_Array[i] = search.charAt(i);
			word += word_Array[i];
			for(z = 0 ; z < NoWord.length ; z++){ // �ܾ ������ �迭�� ����� ���� �迭�� �� �Ͽ� üũ�Ѵ�
				if(word == NoWord[z]){
                    alert("���ϸ� "+NoWord[z]+"��(��) ������ �Դϴ�.");
                    return false;
				}
			}
		}
		word = "";
	}

    return true;
}

//���������
function ForbiddenWord(){
    var NoWord = new Array("��","�ѱ�","����","����","����","��ȭ��","ź��","����","����","����");
    return NoWord;
}



/*********************************** iframe Height Resize ***********************************/

   var iframeids;     //Resize�� �ش� IFRAME
   var defLeftHeight;     //�������� �����ϴ� left�޴��� ���̰� ���
    var iframehide="yes"
    var defHeight = 0;
    function resizeCaller() {
        defHeight = parseInt(defLeftHeight)-110;      //left�޴� ���̿� �� �ּ���� ���� ����
        var dyniframe=new Array()
        for (i=0; i<iframeids.length; i++){
            if (document.getElementById){
                    currentfrId = iframeids[i];
                    resizeIframe(iframeids[i]);
                }
            if ((document.all || document.getElementById) && iframehide=="no"){
                var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
                tempobj.style.display="block"
            }
        }
    }

    function resizeIframe(frameid){

        var currentfr=document.getElementById(frameid)
        if (currentfr && !window.opera){
            currentfr.style.display="block"
        if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight){ //ns6 syntax
            if(currentfr.contentDocument.body.offsetHeight < defHeight)
                currentfr.height = defHeight;
            else
                currentfr.height = currentfr.contentDocument.body.offsetHeight;

        }else if (currentfr.Document && currentfr.Document.body.scrollHeight){ //ie5+ syntax
            if(currentfr.Document.body.scrollHeight < defHeight)
                currentfr.height = defHeight;
            else
                currentfr.height = currentfr.Document.body.scrollHeight;
         }
       if (currentfr.addEventListener){
            currentfr.addEventListener("load", readjustIframe, false);
            currentfr.removeEventListener("load", readjustIframe, false);
           }
        else if (currentfr.attachEvent){
            currentfr.attachEvent("onload", readjustIframe);
            currentfr.detachEvent("onload", readjustIframe);
        }
    }

}

    function removeEvent(onload, readjustIframe){
        window.detachEvent(onload, resizeCaller);

    }
    function readjustIframe(loadevt) {
        var crossevt=(window.event)? event : loadevt
        var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
        if (iframeroot)
            resizeIframe(iframeroot.id);
    }

    function loadintoIframe(iframeid, url){
        if (document.getElementById)
            document.getElementById(iframeid).src=url
    }

    if (window.addEventListener){
            window.addEventListener("load", resizeCaller, false);
            window.removeEventListener("load", resizeCaller, false);
        }
    else if (window.attachEvent){
             window.attachEvent("onload", resizeCaller);
             window.detachEvent("onload", resizeCaller);

        }
    else{
        window.onload=resizeCaller;
    }


/*=======================================================================
Function�� : CalcDate
���� :  �˻��� ���� date �̻� �Ұ�
Parameter	:
return		: boolean
�����ۼ���	: ����
�����ۼ���  : 2009�� 09�� 06��
����������  : 2009�� 09�� 06��
========================================================================*/
function calcDate(objFrom, objTo, date)
{
	var strDate1 = objFrom.value;
	var strDate2 = objTo.value;
	var ArrDate1 = strDate1.split("-");
	var ArrDate2 = strDate2.split("-");

	var date1 = new Date(ArrDate1[0], ArrDate1[1], ArrDate1[2]);
	var date2 = new Date(ArrDate2[0], ArrDate2[1], ArrDate2[2]);

	var newdate=(date2-date1)/(24*60*60*1000);

	if(newdate > date)
		return false
	else
		return true;
}

/*=======================================================================
Function��	: toHTTPS()
��      ��	: http: --> https: 
Parameter	: 
return		: 
�����ۼ���	: ����
�����ۼ���	: 2009�� 08�� 31��
����������	: 2009�� 08�� 31��
========================================================================*/
function toHTTPS() 
{
    //http: --> https: �� �̵� �Ǵ°� �����Ұ�� �� Tag ���� <input type="hidden" name="https" id="https">
   if(typeof(document.all["https"]) == "undefined")   
   {
      if(window.location['href'].split("/")[2] == "www.narasarangcard.co.kr" || window.location['href'].split("/")[2] == "147.6.81.46")
	  {
		   var sPRTC = window.location['protocol'];
		   var sHREF = window.location['href'];

		   if( sPRTC.toUpperCase() != 'HTTPS:' ) {
			   sHREF = 'https:' + sHREF.substring(sPRTC.length, sHREF.length); 
			   window.location.replace(sHREF);
		   }
      }
   }else{ //https: --> http: �� �̵���Ŵ
      if(window.location['href'].split("/")[2] == "www.narasarangcard.co.kr" || window.location['href'].split("/")[2] == "147.6.81.46")
	  {
		   var sPRTC = window.location['protocol'];
		   var sHREF = window.location['href'];

		   if( sPRTC.toUpperCase() != 'HTTP:' ) {
			   sHREF = 'http:' + sHREF.substring(sPRTC.length, sHREF.length); 
			   window.location.replace(sHREF);
		   }
      }
   }

}

/*=======================================================================
Function��	: MailCheck()
��      ��	: ����üũ
Parameter	: 
return		:
�����ۼ���	: ����
�����ۼ���	: 2009�� 12�� 11��
����������	: 2009�� 12�� 11��
========================================================================*/
function MailCheck(strEmailA, strEmailB)
{    	
	var ObjMail = strEmailA + "@" + strEmailB;
    
    if(strEmailA.substring(strEmailA.length -1, strEmailA.length) == ".") return false;
    
	if(strEmailB.substring(strEmailB.length -1, strEmailB.length) == ".") return false;

    if(strEmailA.indexOf(".") != -1)
    {   
		if (ObjMail.search(/(\S+)\.(\S+)@(\S+)\.(\S+)/) == -1 ) 
		{
			return false;    
		}
		return true; 
    }else{
		if (ObjMail.search(/(\S+)@(\S+)\.(\S+)/) == -1 ) 
		{
			return false;    
		}
		return true; 
    }	
}


/*=======================================================================
Function��	: doPrint()
��      ��	: Ư�� ���� �μ�
Parameter	: (�μ� DIV ���� id = print)
return		:
�����ۼ���	: ��ȣ��
�����ۼ���	: 2009�� 09�� 11��
����������	: 2009�� 09�� 11��
========================================================================*/
var bodyTag;

function doPrint()
{
    window.print();
}

function beforePrint()
{
    bodyTag = document.body.innerHTML;
    document.body.innerHTML = document.all.print.innerHTML;
    document.body.style.textAlign = "center";
}

function afterPrint()
{
    document.body.innerHTML = bodyTag;
    document.body.style.textAlign = "left";
}

window.onbeforeprint = beforePrint;
window.onafterprint = afterPrint;
