/* ¼­¹ö·Î Àü¼ÛÃ³¸®*/

deny_ext = "jsp,php,html,inc,phtm,htm,shtm,ztx,dot,asp,cgi,pl,dat";

function doSubmit(actionID, submitForm, targetName)
{
	submitForm.method = 'post';
	submitForm.target = getTargetName(targetName);
	submitForm.action = actionID;

	if ( submitForm.file != null)
	{
		if(deny_ext.length>0)
		{
			var deny_exts=","+deny_ext.replace(/ /g,'').toLowerCase()+",";

			if ( submitForm.file.length == null )
			{
				if(submitForm.file.value.length>0){
					var ext=submitForm.file.value.substring(submitForm.file.value.lastIndexOf('.')+1).toLowerCase();

					if(deny_exts.indexOf(ext)>=0)
					{
						alert("¾÷·Îµå°¡ Á¦ÇÑµÈ ÆÄÀÏÀÔ´Ï´Ù.");
						return false;
					}
				}
			}
			else
			{
				for(i=0; i<submitForm.file.length; i++)
				{
					if(submitForm.file[i].value.length>0){
						var ext=submitForm.file[i].value.substring(submitForm.file[i].value.lastIndexOf('.')+1).toLowerCase();

						if(deny_exts.indexOf(ext)>=0)
						{
							alert("¾÷·Îµå°¡ Á¦ÇÑµÈ ÆÄÀÏÀÔ´Ï´Ù.");
							return false;
						}
					}
				}
			}

		}
	}
	submitForm.submit();
	return false;
}


/* ¼­¹ö·Î Àü¼ÛÃ³¸®*/
function doGetSubmit(actionID, submitForm, targetName)
{
	submitForm.method = 'get';
	submitForm.target = getTargetName(targetName);
	submitForm.action = actionID;
	submitForm.submit();
	return false;
}

function getObjType( obj )
{
	if (!obj) {
		return;
	}

	var typeArr = new Array (
		"text", "hidden", "textarea", "select-one","select-multiple", "checkbox", "radio"
	);

	var i;

	for (i=0;i<typeArr.length;i++) {
		if ( obj.type && obj.type==typeArr[i] ) return typeArr[i];
		else if ( !obj.type && obj.length && obj[0].type ==typeArr[i] ) return typeArr[i];
	}

	return null;
}


function setValue(obj , val)
{
	if (!obj) {
		return;
	}

	switch(getObjType( obj )) {
		case "text":
		case "hidden":
		case "textarea":
			setTextField(obj , val);
			break;
		case "select-one":
		case "select-multiple":
			setComboBoxVal(obj , val);
			break;
		case "checkbox":
		case "radio":
			setCheckBoxVal(obj , val);
			break;
		default: return;
	}
}


function setTextField(sObj, val)
{
	if (!sObj) {
		return;
	}
	sObj.value = val;
}


function setComboBoxVal(sObj, val)
{
	if(!sObj) {
		// alert("[setComboBoxVal] sObj is null. T.T");
		return;
	}

	var i;
	for (i=0;i<sObj.options.length;i++)	{
		if (sObj.options[i].value == val) {
			sObj.options.selectedIndex = i;
			break;
		}
	}
}


function setCheckBoxVal(sObj, val)
{
	if (!sObj) {
		return;
	}

	if (!sObj.length && sObj.value && sObj.value == val) {
		sObj.checked=true;
	} else {
		var i;
		for (i=0;i<sObj.length;i++)	{
			if (sObj[i].value == val) {
				sObj[i].checked=true;
				break;
			}
		}
	}
}


function getCheckCount( obj )
{
	var nChkTemp = 0;

	if ( obj.length == null )
	{
		if ( obj.checked )
		{
			nChkTemp++;
		}
	}
	else
	{
		for ( var i = 0; i <  obj.length; i++ )
		{
			if ( obj[i].checked )
			{
				nChkTemp ++;
			}
		}
	}

	return nChkTemp;
}


function getCheckIndex( obj)
{
	var nFistChk='';

	if ( obj.length == null )
	{
		if ( obj.checked )
		{
			nFistChk =  0;
		}
	}
	else
	{
		for ( var i = 0; i <  obj.length; i++ )
		{
			if ( obj[i].checked )
			{
				nFistChk = i
			}
		}
	}

	return nFistChk;
}



function LaunchCenter(url, name, width, height, scrollbars) {
	var win_height = height;
	var win_width = width;
	var win_top = window.screen.height/2 - win_height/2;
	var win_left = window.screen.width/2 - win_width/2;
	var wintype="width=" +win_width+ ",height="+win_height+", top="+win_top+",left="+win_left+", menubar=no, scrollbars="+scrollbars+", resizable=no, status=yes, toolbar=no";

	window.open(url, name, wintype);
}

function showFlash (src, width, height) {
	var flash_tag = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"" + width + "\" height=\"" + height + "\" id=\"menu\" align=\"middle\">\n"
				  + "<param name=movie value=\"" + src + "\">\n"
				  + "<param name=quality value=high>\n"
				  + "<param name=wmode value=transparent>\n"
				  + "<embed src=\"" + src + "\" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"" + width + "\" height=\"" + height +"\"></embed>\n"
				  + "</object>";

	document.write (flash_tag);
}

 function showFlash2(src, width, height) {
	 var flash_tag ="<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"" + width + "\" height=\"" + height +"\" id=\"topmenu\" align=\"middle\">\n"
				+ "<param name=\"allowScriptAccess\" value=\"sameDomain\" /><param name=\"movie\" value=\"" + src + "\" />\n"
				+ "<param name=\"quality\" value=\"high\" />\n"
				+ "<param name=\"wmode\" value=\"transparent\" />\n"
				+ "<param name=\"bgcolor\" value=\"transparent\" />\n"
				+ "<embed src=\"" + src + "\" quality=\"high\" wmode=\"transparent\" bgcolor=\"transparent\" width=\"" + width + "\" height=\"" + height +"\" name=\"topmenu\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />\n"
				+ "</object>";
	document.write (flash_tag);
 }

function popMsg(msg) {
	alert(msg);
	return;
}

function LoadImg(img,size){
	newImage = new Image();
	newImage.src = img.src;
	wx = newImage.width;
	if (wx > size) {
		img.width = size;
	}
}


function checkDateType(dateStr)
{
	dateStr = dateStr.replace(/-/gi, '');

	if( dateStr.length == 0 || dateStr.length != 8 )
		return false;
	for(var i=0; i<dateStr.length; i++){
		if( !(isNum(dateStr.charAt(i))) )
			return false;
	}

	var year = dateStr.substring(0, 4);
	var month = dateStr.substring(4, 6);
	var day = dateStr.substring(6, 8);

	if ( year < 1970) return false;
	if ( month > 12 || month < 1 ) return false;
	if ( day > getEndDayOfMonth(year, month) || day < 1 ) return false;

	return true;
}

function getEndDayOfMonth(month) {
	var today = new Date();
	var year = today.getYear();

	var monarr = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
	if(((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
		monarr[1] = "29";

	return monarr[month-1];
}


function getEndDayOfMonth(year, month) {
	var monarr = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
	if(((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
		monarr[1] = "29";

	return monarr[month-1];
}


function isNum(ch) {
	if ( ch < "0" || ch > "9" ) return false;
	return true;
}

function isEng(ch) {
	if ( "a" <= ch && ch <= "z" || "A" <= ch && ch <= "Z" ) return true;
	return false;
}

function isUpperEng(ch) {
    if ( ("A" <= ch && ch <= "Z") || ch == ' ' ) return true;
    return false;
}


function checkUpperEng(str) {
    var len = str.length;
    for( var i = 0; i < len; i++ ) {
        if( !isUpperEng( str.charAt(i) ) ) return false;
    }
    return true;
}


function toDateFormat(element) {

  var buf = element.value.replace(/-/gi, '');

  if ( buf.length != 0 )
  {
  	 var tgt = '';

  tgt += buf.substring(0, 4) + '-';
  tgt += buf.substring(4, 6) + '-';
  tgt += buf.substring(6, 8);

  element.value = tgt;
	}

}

function getStringLength(str){
	var tem = 0;
	for(var i=0; i<str.length; i++) {
		if( str.charCodeAt(i) > 127 ) {
			tem = tem + 2;
		}else{
			tem = tem + 1;
		}
	}
	return tem;
}


function submitDateFormat(element) {
  element.value = element.value.replace(/\//gi, '');
  element.value = element.value.replace(/-/gi, '');
  element.value = element.value.replace(/\./gi, '');
}

function submitMoneyFormat( element )
{
	element.value = element.value.replace(/,/gi, '');
}


function getTargetName(targetName, width, height) {
	var openedWin = newWin('', targetName, width, height);
	openedWin.focus();
	return targetName;
}

function newWin(url, winName, width, height) {
	var nLeft  = screen.availWidth/2 - (width/2);
    var nTop  = screen.availHeight/2 - (height/2);
    var opt = ",width=" + width + ",height=" + height + ",toolbar=no,menubar=no,location=no,scrollbars=no,status=no,resizable=no";
    return window.open(url, winName, "left=" + nLeft + ",top=" +  nTop +opt);
}

function newWinPostData( url, winName, frm, width, height )
{
	var nLeft  = screen.availWidth/2 - (width/2);
    var nTop  = screen.availHeight/2 - (height/2);
	window.open('',winName,'width='+width+',height='+height+',top='+nTop+',left='+nLeft+',scrollbars=1')
	frm.target = winName;
	frm.action = url ;
	frm.submit();
}

function copyTrOutLine( srcTRID, desTableID )
{
    var desTbl			= document.getElementById(desTableID);
    var desLastRow	= desTbl.rows.length;

    //addTbody = document.createElement("TBODY");    // TBODY
    addTbody = desTbl.tBodies(0);// TBODY

    var cloneTR = eval( srcTRID + ".cloneNode(true)"); //
    cloneTR.id = '';
    cloneTR.style.display = 'inline';

    addTbody.appendChild(cloneTR);
    //desTbl.appendChild(addTbody);

    return desLastRow;
}

function copyTrOutLineWithMsg ( srcTRID, desTableID, msgTableID )
{
    var lastRow = copyTrOutLine( srcTRID, desTableID );
    var tbMsg = document.getElementById(msgTableID);


    tbMsg.style.display = 'none';

    return lastRow;
}

function getCellValue(tableID, obj)
{
  var tbl = document.getElementById(tableID);

  var rowCnt = tbl.rows.length;
  var rowIndex = eval(tableID+".clickedRowIndex");

  if ( rowCnt > 1 )
    {
        obj = obj[ rowIndex -1 ];
    }


  return obj.value;
}

function getSum( carNm )
{
    var obj = carNm;
    var ret = 0;
    var tmp = 0;

    if ( obj == null ) return 0;

    if ( obj.length == null )
    {
        if ( !checkDigit(obj.value) )
        {
            ret = "0";
        }
        else
        {
            ret = obj.value;
        }
    }
    else
    {
        for ( var i = 0; i < obj.length; i++ )
        {
            tmp = trim( obj[i].value );
            tmp = tmp.replace(/,/gi, '');

            if ( !checkDigit( tmp ) )
            {
                tmp = 0;
            }

            ret += tmp * 1;
        }
    }
    return ret;
}

function tableReset( objTableID, leaveRow)
{
    var tbl = objTableID;
    var row = tbl.rows.length;

    for ( var i = leaveRow; i < row; i ++)
    {
        tbl.deleteRow( leaveRow );
    }
}

function setCellValue(tableID, row, col, sz)
{
  var tbl = document.getElementById(tableID);

  tbl.rows[row].cells[col].firstChild.value = sz;
}

function trim(str) {
    var temp = null;
    temp = ltrim(str);
    str = rtrim(temp);
    return str;
}

function ltrim(str) {
    var len = str.length;
    var i;
    for(i=0; i < len; i++) {
        if( str.charAt(i) != ' ' ) break
    }
    return str.substring(i, len);
}

function rtrim(str) {
    var len = str.length;
    var i;
    for(i=len-1; i >= 0; i--) {
        if( str.charAt(i) != ' ' ) break
    }
    return str.substring(0, i+1);
}

function onlyNumDecimalInput(){
 var code = window.event.keyCode;

  if ((code >= 48 && code <= 57) || (code >= 96 && code <= 105) || code == 110 || code == 190 || code == 8 || code == 9 || code == 13 || code == 46)
    {
        window.event.returnValue = true;
        return;
  }
  window.event.returnValue = false;
}


function checkLen(str) {
    var t;
    var msglen = 0;
    var l = str.length;
    for(k=0; k < l ; k++) {
        t = str.charAt(k);
        if (escape(t).length > 4) msglen += 2; else msglen++;
        }
        return msglen;
}



function isEmpty(field, error_msg)
{
if(error_msg == "") {
    if(!CheckValid(field.value, false)) 	{
        return true;
    } else {
        return false;
    }
} else {
    if(!CheckValid(field.value, false)) {
        alert(error_msg);
        field.focus() ;
        return true;
    } else {
        return false;
    }
}
}


function CheckValid(String, space)
{

var retvalue = false;

for (var i=0; i<String.length; i++)
{
  if (space == true)
  {
     if (String.charAt(i) == ' ')
     {
        retvalue = true;
        break;
     }
  } else {
     if (String.charAt(i) != ' ')
     {
        retvalue = true;
        break;
     }
  }
}

return retvalue;
}


function setdivcontentWidth(){
var gat = document.getElementById("divcontent");
var obj = gat.getElementsByTagName("IMG");
var twidths;
imgedit= new Image();
for(i =0; i < obj.length; i++){
    imgedit.src = obj[i].src;
    if(imgedit.width > 500){
        obj[i].width = 500;
        obj[i].height = imgedit.height * (500/imgedit.width);
    }
}
}

function setDate(fromObj , toObj , term)
{
    var today = new Date() ;
    var preDay  ;
    var yyyy = today.getYear()  ;

    var mm = today.getMonth()+1 ;
    var dd = today.getDate() ;

    dd = (dd<10)?'0'+dd:dd;
    mm = (mm<10)?'0'+mm:mm;
    preDay = getPrevDate(yyyy + mm + dd, term) ;

    fromObj.value = getPrevDate(yyyy + mm + dd, term) ;
    toObj.value = getPrevDate(yyyy + mm + dd, "0d") ;
}


function getPrevDate(yyyymmdd, term)
{
    var  yyyy
    var mm
    var dd
    if ( yyyymmdd.length != 8  )
    {

        var today = new Date() ;
        yyyy = today.getYear()  ;
        mm = today.getMonth()+1 ;
        dd = today.getDate() ;
        dd = (dd<10)?'0'+dd:''+dd;
        mm = (mm<10)?'0'+mm:''+mm;

    }
    else
    {
        yyyy = yyyymmdd.substring(0, 4);
        mm = yyyymmdd.substring(4, 6);
        dd = yyyymmdd.substring(6, 8);

    }
    var myDate = new Date();
    myDate.setFullYear(yyyy);
    myDate.setMonth(mm-1);
    myDate.setDate(dd);

    if(term.charAt(term.length-1) == 'd')
    {
        term = term.substring(0, term.length-1);
        myDate.setDate(dd - eval(term) );
    }

    if(term.charAt(term.length-1) == 'm')
    {
        term = term.substring(0, term.length-1);

        if(getLastDay(yyyy,mm) == dd) {
            myDate.setDate('01');
            myDate.setMonth(mm - eval(term));

        } else {
            myDate.setMonth(mm - eval(term) -1);
            myDate.setDate(myDate.getDate() + 1);
        }
    }

    yyyy = myDate.getYear();
    mm = myDate.getMonth()+1;
    dd = myDate.getDate();

    dd = (dd<10)?'0'+dd:dd;
    mm = (mm<10)?'0'+mm:mm;

    return yyyy+'-'+mm+'-'+dd;

}

function getLastDay(year, month)
{
    var lastDay;

    if(month == 1
        || month == 3
        || month == 5
        || month == 7
        || month == 8
        || month == 10
        || month == 12
    )
        lastDay = 31;
    else if(month == 4
        || month == 6
        || month == 9
        || month == 11
    )
        lastDay = 30;
    else
    {
        if((year % 400) == 0)
            lastDay = 29;
        else if((year % 100) == 0)
            lastDay = 28;
        else if((year % 4) == 0)
            lastDay = 29;
        else
            lastDay = 28;
    }
    return lastDay;
}

function checkDateType(dateStr)
{
	dateStr = dateStr.replace(/-/gi, '');

	if( dateStr.length == 0 || dateStr.length != 8 )
		return false;
	for(var i=0; i<dateStr.length; i++){
		if( !(isNum(dateStr.charAt(i))) )
			return false;
	}

	var year = dateStr.substring(0, 4);
	var month = dateStr.substring(4, 6);
	var day = dateStr.substring(6, 8);

	if ( year < 1970) return false;
	if ( month > 12 || month < 1 ) return false;
	if ( day > getEndDayOfMonth(year, month) || day < 1 ) return false;

	return true;
}

function goSubMenuPage( szPath, szTarget )
{
	if ( szTarget == null )
	{
		location.href = szPath;
	}
	else
	{
		if ( szTarget == '_self')
		{
			location.href = szPath;



		}
		else
		{
			if ( szTarget == '_blank')
			{
				window.open(szPath);
			}
			else
			{
				//window.open(szPath, ');
				window.open(szPath, '_blank', szTarget);
			}
		}

	}

}

function goSubMenuPageMax( szPath, szTarget )
{
	if ( szTarget == null )
	{
		location.href = szPath;
	}
	else
	{
		if ( szTarget == '_self')
		{
			location.href = szPath;



		}
		else
		{
			if ( szTarget == '_blank')
			{
				window.open(szPath);
			}
			else
			{
				//window.open(szPath, ');
				window.open(szPath, '_blank', "toolbar=0,status=0,scrollbars=0,width="+screen.width+",height="+screen.height+",left=0,top=0,location=0,menubar=0,resizable=0");
			}
		}

	}

}

function goSubMenuPageMax2( szPath, szTarget )
{
	if ( szTarget == null )
	{
		location.href = szPath;
	}
	else
	{
		if ( szTarget == '_self')
		{
			location.href = szPath;



		}
		else
		{
			if ( szTarget == '_blank')
			{
				window.open(szPath);
			}
			else
			{
				//window.open(szPath, ');
				window.open(szPath, '_blank', "toolbar=0,status=0,scrollbars=0,width="+screen.width+",height="+screen.height+",left=0,top=0,location=0,menubar=0,resizable=1");
			}
		}

	}

}

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_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.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];}
}


/******************************************************************************/
/* XML Parsing Function														  */
/******************************************************************************/
var xmlDoc , lineMapStr = "",lineLeftMapStr="", currentPath="", index = 0;
var moz = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined');
var ie = (typeof window.ActiveXObject != 'undefined');

function importXML(file) {
	if (moz) {
		xmlDoc = document.implementation.createDocument("","",null);
		xmlDoc.async = false;

		//xmlDoc = new XPathEvaluator();
		//xmlDoc = (new DOMParser()).parseFromString(file,"text/xml");

		//xmlDoc = (new XMLSerializer()).serializeToString(file);
		//xmlDoc.load('/inc/menu_.jsp');
	} else if (ie) {
		xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.async = false;

	}

	xmlDoc.load(file);

}

function getLineMapNode(id){
	var menuXpath , node;
	menuXpath = "//menu[@id='" + id + "']";
	if (moz) {

		//menuXpath = "//menu[id='" + id + "']";
		node = xmlDoc.evaluate(menuXpath , xmlDoc, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;

		//XPathResult.ORDERED_NODE_ITERATOR_TYPE

	} else if (ie) {
		node = xmlDoc.selectSingleNode(menuXpath);
	}
	return node;
}

function path(id){
	try{
		var node = getLineMapNode(id);
		lineMapStr = "";
		index = 0;
		currentPath=id;
		setString(node);
		document.write(lineMapStr);
	}catch(e){
		if(node == null){
			//document.write("no id : " + id);
		}else{
			document.write("except : " +  e);
		}
	}
}


function pathSearch(id){
	try{
		var node = getLineMapNode(id);
		lineMapStr = "";
		index = 0;
		currentPath=id;
		setStringSearch(node);
		document.write(lineMapStr);
	}catch(e){
		if(node == null){
			//document.write("no id : " + id);
		}else{
			document.write("except : " +  e);
		}
	}
}

function pathEng(id)
{
	try{
	importXML('/Common/menuEng.jsp');
		var node = getLineMapNode(id);
		lineMapStr = "";
		index = 0;
		currentPath=id;
		setString(node);
		document.write(lineMapStr);
	}catch(e){
		if(node == null){
			//document.write("no id : " + id);
		}else{
			document.write("except : " +  e);
		}
	}
}

function pathSearchEng(id)
{
	importXML('/Common/menuEng.jsp');
	try{
		var node = getLineMapNode(id);
		lineMapStr = "";
		index = 0;
		currentPath=id;
		setStringSearch(node);
		document.write(lineMapStr);
	}catch(e){
		if(node == null){
			//document.write("no id : " + id);
		}else{
			document.write("except : " +  e);
		}
	}
}

function setString(node){
	var spStr = "" , last="";
	var name = node.getAttribute("name");
	var url  = node.getAttribute("url");
	var nodeId  = node.getAttribute("id");
	var cls = node.getAttribute("cls");


	if(node != xmlDoc.documentElement )     setString(node.parentNode);
	if ( nodeId != ""){
		if(currentPath != nodeId)
		lineMapStr += "<a href='"+url+"'>"+ name+"</a>&nbsp;&gt;&nbsp;";
		else
			lineMapStr += "<a>"+ name + "</a>";
	}

}

function setStringSearch(node){
	var spStr = "" , last="";
	var name = node.getAttribute("name");
	var url  = node.getAttribute("url");
	var nodeId  = node.getAttribute("id");
	var cls = node.getAttribute("cls");

	if(node != xmlDoc.documentElement ) 	setStringSearch(node.parentNode);

	if ( nodeId != "0"){
		if(currentPath != nodeId)
		lineMapStr += "<a href='"+url+"' target='_blank' class='CLink'>"+ name+"</a>&nbsp;&gt;&nbsp;";
		else
			lineMapStr += "<a href='"+url+"' target='_blank' class='CLink'>"+ name+"</a>";
	}

}

function getValue(id, attrNm){
	var node = getLineMapNode(id);
	var val = null;
	if ( node != null)
	{
		val  = node.getAttribute(attrNm);
	}
	return val;
}
/*
function goPage( url)
{
	location.href=url;
}
*/

function goPageID(szId, param)
{
	var url		= getValue(szId, 'url');
	var target	= getValue(szId, 'target');
	var option  = getValue(szId, 'option');

	if (param != null)
	{
		url += param;
	}

	if ( target == "_blank")
	{
		if ( option != null)
		{
			window.open(url, '_blank', option);
		}
		else
		{
			window.open(url);
		}
	}
	else if (target=="_email")
	{
		location.href ='mailto:' + szId;
	}
	else if (target=="_print")
	{
		window.print();
	}
	else
	{
		location.href=url;
	}

}

function goPageSearch(szId, param)
{
	var url		= getValue(szId, 'url');

	if ( szId == '111114'){
		url = "http://www.smrt.co.kr/vocsmrt/petition/m111112/view.jsp";
	}

	if ( url == null)
	{
		alert('ÁË¼ÛÇÕ´Ï´Ù. »èÁ¦µÇ¾ú°Å³ª, °Ô½Ã¹°À» Ã£À» ¼ö ¾ø½À´Ï´Ù');
		return;
	}
	else if ( url == "#")
	{
		alert('ÁË¼ÛÇÕ´Ï´Ù. »èÁ¦µÇ¾ú°Å³ª, °Ô½Ã¹°À» Ã£À» ¼ö ¾ø½À´Ï´Ù');
		return;
	}

	else
	{
		if (param != null)
		{
			if ( url.indexOf("?") > 0)
			{
				url += "&"+param;
			}
			else
			{
				url += "?"+param;
			}

		}
		window.open(url);
		//location.href=url;
	}

}

function goPageSearchRedirect( code, seq, srchflag ) // SRCH_FLAG
{
	var frm = document.frmMove;
	frm.CODE.value = code;
	frm.SEQ.value = seq;
	frm.SRCH_FLAG.value =  srchflag;

	//newWinPostData( '/Search/SendPage.jsp', 'search', frm, 800, 1200 );
	window.open('','search')
	frm.target = 'search';
	frm.action = '/Search/SendPage.jsp' ;
	frm.submit();

	frm.CODE.value = '';
	frm.SEQ.value = '';
	frm.SRCH_FLAG.value =  '';

	//window.open('/Search/SendPage.jsp?CODE='+code+"&SEQ="+seq+"&SRCH_FLAG="+srchflag);
}



function getPageUrl(szId)
{
	var url = getValue(szId, 'url');
	return url;

}

function openUrl(szId)
{
	var url = getPageUrl(szId);
	window.open(url);
}

function totalSearch1234( szSrch )
{
	if ( szSrch == null) szSrch = "";
	var srchText = trim(szSrch);
	if ( srchText.length == 0 )
	{
		alert('°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä');
		return false;
	}
	else
	{
		window.open('/Search/Search_01.jsp?SRCH_TEXT=' + srchText);
	}
}

function totalSearch12345( szSrch )
{
	if ( szSrch == null) szSrch = "";
	var srchText = trim(szSrch);
	if ( srchText.length == 0 )
	{
		alert('°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä');
		return false;
	}
	else
	{
		window.open('/Search/Search_01_test.jsp?SRCH_TEXT=' + srchText);
	}
}

function totalSearch5678( szSrch )
{
	if ( szSrch == null) szSrch = "";
	var srchText = trim(szSrch);
	if ( srchText.length == 0 )
	{
		alert('Please Input Keyword');
		return false;
	}
	else
	{
		window.open('/Search/Search_Eng.jsp?SRCH_TEXT=' + srchText);
	}
}

importXML('/Common/menu.jsp');

/******************************************************************************/
/* È­¸é ÇÁ¸°Æ® Ã³¸®																*/
/******************************************************************************/


function goPrint( szDivAreaNm, width, heig )

{

	var printwin;
	var printWidth	= '850';
	var printHeight = '600';

	if ( szDivAreaNm == null)
	{
		szDivAreaNm = '';
	}

	if ( width != null)
	{
		printWidth = width;
	}

	if ( heig != null)
	{
		printHeight = heig;
	}
    printwin = window.open("/Common/print.jsp?div_area=" + szDivAreaNm,"print","left=5px,top=10px,height="+printHeight+",width="+printWidth+",scrollbars=yes,toolbar=yes,menubar=yes, resizable=yes");
    if(printwin == null) alert('Â÷´ÜµÈ ÆË¾÷À» ÇØÁöÇØ ÁÖ¼¼¿ä');
    else printwin.focus();
}

/******************************************************************************/
/* È­¸é ÇÁ¸°Æ® Ã³¸®																*/
/******************************************************************************/
function goAdminPrint( szDivAreaNm, width, heig )
{
	var printwin;
	var printWidth	= '800';
	var printHeight = '600';

	if ( szDivAreaNm == null)
	{
		szDivAreaNm = '';
	}

	if ( width != null)
	{
		printWidth = width;
	}

	if ( heig != null)
	{
		printHeight = heig;
	}
    printwin = window.open("/Common/print_admin.jsp?div_area=" + szDivAreaNm,"print","left=10px,top=10px,height="+printHeight+",width="+printWidth+",scrollbars=yes,toolbar=yes,menubar=yes, resizable=yes");
    if(printwin == null) alert('Â÷´ÜµÈ ÆË¾÷À» ÇØÁöÇØ ÁÖ¼¼¿ä');
    else printwin.focus();
}

/******************************************************************************/
/* ¿µ¹® È­¸é ÇÁ¸°Æ® Ã³¸®																*/
/******************************************************************************/
function goEngPrint( szDivAreaNm, width, heig )
{
	var printwin;
	var printWidth	= '800';
	var printHeight = '600';

	if ( szDivAreaNm == null)
	{
		szDivAreaNm = '';
	}

	if ( width != null)
	{
		printWidth = width;
	}

	if ( heig != null)
	{
		printHeight = heig;
	}
    printwin = window.open("/Eng/Common/print.jsp?div_area=" + szDivAreaNm,"print","left=10px,top=10px,height="+printHeight+",width="+printWidth+",scrollbars=yes,toolbar=yes,menubar=yes, resizable=yes");
    if(printwin == null) alert('Â÷´ÜµÈ ÆË¾÷À» ÇØÁöÇØ ÁÖ¼¼¿ä');
    else printwin.focus();
}


/******************************************************************************/
/* Font Size ZoomIn, ZoomOut												  */
/******************************************************************************/
//¹®ÀÚÈ®´ë,Ãà¼Ò
var mFirst=[12,20];
var mFont;
var cFont;
var objs_iframe;
var moFirst, mClass;
var initFlag = false;
var TF = 12;

// ÃÊ±âÈ­
//zoom_it(0)

function zoom_reset()
{
	 TF = 12;
	zoom_it(0);
}

function zoom_it(n) {

	//var mFont=getCookie("cFont");
    var mFont = TF ;

    /*try {
		if(mFont == undefined)
			mFont=12;
		mFont=parseInt(mFont);
	} catch(e) {mFont=12;}
    */

	n=parseInt(n);
	mFont+=n;

	//ºÎ¸ðÃ¢
	zoom_parent(n);

	var class_name="main01";

	if (mFont<mFirst[0]) mFont=mFirst[0];
	if (mFont>mFirst[1]) mFont=mFirst[1];

	// tdÀÇ ÆùÆ® Á¶Àý
	moFirst=document.getElementsByTagName("td");

	mClass=class_name ? class_name : "Sfont";

	objs=moFirst;

	for (i=0;i<objs.length;i++) {
		try {
			objs[i].style.fontSize=mFont+'px';
			if (initFlag) moFirst[i]=objs[i];
		} catch(e) {}
	}

	// aÀÇ ÆùÆ® Á¶Àý
	moFirst=document.getElementsByTagName("a");

	mClass=class_name ? class_name : "Sfont";

	objs=moFirst;
	for (i=0;i<objs.length;i++) {
		try {
			objs[i].style.fontSize=mFont+'px';
			if (initFlag) moFirst[i]=objs[i];
		} catch(e) {}
	}

	//dd
	moFirst=document.getElementsByTagName("dd");

	mClass=class_name ? class_name : "Sfont";

	objs=moFirst;
	for (i=0;i<objs.length;i++) {
		try {
			objs[i].style.fontSize=mFont+'px';
			if (initFlag) moFirst[i]=objs[i];
		} catch(e) {}
	}

	//dt
	moFirst=document.getElementsByTagName("dt");

	mClass=class_name ? class_name : "Sfont";

	objs=moFirst;
	for (i=0;i<objs.length;i++) {
		try {
			objs[i].style.fontSize=mFont+'px';
			if (initFlag) moFirst[i]=objs[i];
		} catch(e) {}
	}

	//li
	moFirst=document.getElementsByTagName("li");

	mClass=class_name ? class_name : "Sfont";

	objs=moFirst;
	for (i=0;i<objs.length;i++) {
		try {
			objs[i].style.fontSize=mFont+'px';
			if (initFlag) moFirst[i]=objs[i];
		} catch(e) {}
	}

	//th
	moFirst=document.getElementsByTagName("th");

	mClass=class_name ? class_name : "Sfont";

	objs=moFirst;
	for (i=0;i<objs.length;i++) {
		try {
			objs[i].style.fontSize=mFont+'px';
			if (initFlag) moFirst[i]=objs[i];
		} catch(e) {}
	}

/////////////////////iframe

	objs_iframe=document.getElementsByTagName("iframe");
		mClass=class_name ? class_name : "Sfont";

	if(objs_iframe[0] != null){

		// thÀÇ ÆùÆ® Á¶Àý
		moFirst=objs_iframe[0].contentWindow.document.getElementsByTagName("td");

		mClass=class_name ? class_name : "Sfont";

		objs=moFirst;

		for (i=0;i<objs.length;i++) {
			try {
				objs[i].style.fontSize=mFont+'px';
				if (initFlag) moFirst[i]=objs[i];
			} catch(e) {}
		}
	}

	if(objs_iframe[1] != null){
		// thÀÇ ÆùÆ® Á¶Àý
		moFirst=objs_iframe[1].contentWindow.document.getElementsByTagName("td");

		mClass=class_name ? class_name : "Sfont";

		objs=moFirst;

		for (i=0;i<objs.length;i++) {
			try {
				objs[i].style.fontSize=mFont+'px';
				if (initFlag) moFirst[i]=objs[i];
			} catch(e) {}
		}

			// tdÀÇ ÆùÆ® Á¶Àý
		moFirst=objs_iframe[1].contentWindow.document.getElementsByTagName("th");

		mClass=class_name ? class_name : "Sfont";

		objs=moFirst;

		for (i=0;i<objs.length;i++) {
			try {
				objs[i].style.fontSize=mFont+'px';
				if (initFlag) moFirst[i]=objs[i];
			} catch(e) {}
		}
	}

	if(objs_iframe[2] != null){
		// tdÀÇ ÆùÆ® Á¶Àý
		moFirst=objs_iframe[2].contentWindow.document.getElementsByTagName("th");

		mClass=class_name ? class_name : "Sfont";

		objs=moFirst;

		for (i=0;i<objs.length;i++) {
			try {
				objs[i].style.fontSize=mFont+'px';
				if (initFlag) moFirst[i]=objs[i];
			} catch(e) {}
		}

		// tdÀÇ ÆùÆ® Á¶Àý
		moFirst=objs_iframe[2].contentWindow.document.getElementsByTagName("td");

		mClass=class_name ? class_name : "Sfont";

		objs=moFirst;

		for (i=0;i<objs.length;i++) {
			try {
				objs[i].style.fontSize=mFont+'px';
				if (initFlag) moFirst[i]=objs[i];
			} catch(e) {}
		}
	}


///////////////////////////


	//setCookie("cFont", mFont , 1);
    TF = mFont;

}

function zoom_parent(n) {
	//var mFont=getCookie("cFont");
    mFont = TF;
    /*
	try {
		if(mFont == undefined)
			mFont=12;
		mFont=parseInt(mFont);
	} catch(e) {mFont=12;}
    */

	n=parseInt(n);
	mFont+=n;

	var class_name="main01";

	if (mFont<mFirst[0]) mFont=mFirst[0];
	if (mFont>mFirst[1]) mFont=mFirst[1];

	// tdÀÇ ÆùÆ® Á¶Àý
	//ºÎ¸ðÃ¢
	moFirst=parent.document.getElementsByTagName("td");

	mClass=class_name ? class_name : "Sfont";
	//alert(mFont);
	objs=moFirst;
	for (i=0;i<objs.length;i++) {
		try {

			objs[i].style.fontSize=mFont+'px';

			if (initFlag) moFirst[i]=objs[i];
		} catch(e) {}
	}

	// aÀÇ ÆùÆ® Á¶Àý
	//ºÎ¸ðÃ¢
	moFirst=parent.document.getElementsByTagName("a");

	mClass=class_name ? class_name : "Sfont";

	objs=moFirst;
	for (i=0;i<objs.length;i++) {
		try {
			objs[i].style.fontSize=mFont+'px';
			if (initFlag) moFirst[i]=objs[i];
		} catch(e) {}
	}

	//ºÎ¸ðÃ¢ dd dt li
	moFirst=parent.document.getElementsByTagName("dd");

	mClass=class_name ? class_name : "Sfont";

	objs=moFirst;
	for (i=0;i<objs.length;i++) {
		try {
			objs[i].style.fontSize=mFont+'px';
			if (initFlag) moFirst[i]=objs[i];
		} catch(e) {}
	}

	//ºÎ¸ðÃ¢
	moFirst=parent.document.getElementsByTagName("dt");

	mClass=class_name ? class_name : "Sfont";

	objs=moFirst;
	for (i=0;i<objs.length;i++) {
		try {
			objs[i].style.fontSize=mFont+'px';
			if (initFlag) moFirst[i]=objs[i];
		} catch(e) {}
	}

	//ºÎ¸ðÃ¢
	moFirst=parent.document.getElementsByTagName("li");

	mClass=class_name ? class_name : "Sfont";

	objs=moFirst;
	for (i=0;i<objs.length;i++) {
		try {
			objs[i].style.fontSize=mFont+'px';
			if (initFlag) moFirst[i]=objs[i];
		} catch(e) {}
	}

	//th
	moFirst=parent.document.getElementsByTagName("th");

	mClass=class_name ? class_name : "Sfont";

	objs=moFirst;
	for (i=0;i<objs.length;i++) {
		try {
			objs[i].style.fontSize=mFont+'px';
			if (initFlag) moFirst[i]=objs[i];
		} catch(e) {}
	}
}

function ttsToggle(status) {
	setCookie('ttsStatus',status,'');
}


/**
 ###############################################################################
 	³¯Â¥ °ü·Ã ÇÔ¼ö
 ###############################################################################
 */
/**
 * ³¯Â¥¸¦ ¾ò´Â´Ù. (YYYYMMDD Çü½Ä)
 *
 * param
 *   date JavascriptÀÇ Date °´Ã¼
 *   format YYYYMMDD Çü½Ä. ¿¹) getCurrentDate('YYYYMMDD'), getCurrentDate('YYYY'), getCurrentDate('MM')
 * return
 *   ³¯Â¥(YYYYMMDD)
 * author
 *   freebird
 */
function getDate(date, format) {
 	var currIndex = 0;
	var returnDate = '';
	var f_year, f_month, f_date;
	f_year = f_month = f_date = '';

	for(var i = 0 ; i < 3 ; i++) {
		if( format.search(/YYYY/i) == currIndex ) {
			f_year =  date.getYear();
			returnDate +=  f_year < 2000 ? f_year + 1900 : f_year;
			currIndex += 4;
			continue;
		}

		if( format.search(/MM/i) == currIndex ) {
			f_month = date.getMonth() + 1;
			returnDate +=  f_month < 10 ? '0' + f_month : f_month;
			currIndex += 2;
			continue;
		}

		if( format.search(/DD/i) == currIndex ) {
			f_date = date.getDate();
			returnDate +=  f_date < 10 ? '0' + f_date : f_date;
			currIndex += 2;
			continue;
		}
	}

	return returnDate;
}

/**
 * ÇöÀç ³¯Â¥¸¦ ¾ò´Â´Ù. (YYYYMMDD Çü½Ä)
 *
 * return
 *   ÇöÀç ³¯Â¥(YYYYMMDD)
 * author
 *   freebird
 */
function getCurrentDate() {
	var date = new Date();
	return( getDate(date, 'YYYYMMDD') )
}

/**
 * ÇöÀç ³¯Â¥¸¦ ¾ò´Â´Ù. (YYYY-MM-DD Çü½Ä)
 *
 * return
 *   ÇöÀç ³¯Â¥(YYYY-MM-DD)
 * author
 *   freebird
 */
function getCurrentDate2() {
	var date = new Date();
	var sDate= getDate(date, 'YYYYMMDD');
	return (sDate.substring(0,4)+'-'+sDate.substring(4,6)+'-'+sDate.substring(6,8));
}

/**
 * ¾îÁ¦ ³¯Â¥¸¦ ¾ò´Â´Ù. (YYYYMMDD Çü½Ä)
 *
 * return
 *   ¾îÁ¦ ³¯Â¥(YYYYMMDD)
 * author
 *   freebird
 */
function getPreviousDate() {
	var ADAY = 1000 * 60 * 60 * 24;
	var date = new Date();
	date = new Date( date.getTime() - ADAY );

	return( getDate(date, 'YYYYMMDD') )
}

/**
 * ÇöÀç´ÞÀÇ ½ÃÀÛÀÏ°ú ³¡ÀÏÀ» ±¸ÇØ¼­ begin, end element¿¡ ¼ÂÆÃÇÑ´Ù.
 *
 * param
 *   begin ½ÃÀÛÀÏÀ» ¼ÂÆÃÇÏ°í ½ÍÀº element ÀÌ¸§
 *   end ³¡ÀÏÀ» ¼ÂÆÃÇÏ°í ½ÍÀº element ÀÌ¸§
 * author
 *   freebird
 */
function setCurrentMonth(begin, end) {
	var date = new Date();
	var year = getDate(date, 'YYYY');
	var month = getDate(date, 'MM');
	begin.value = year + month + '01';
	end.value = year + month + getEndDayOfMonth(month);
}


/**
 * ÀÌÀü´ÞÀÇ ½ÃÀÛÀÏ°ú ³¡ÀÏÀ» ±¸ÇØ¼­ begin, end element¿¡ ¼ÂÆÃÇÑ´Ù.
 *
 * param
 *   begin ½ÃÀÛÀÏÀ» ¼ÂÆÃÇÏ°í ½ÍÀº element ÀÌ¸§
 *   end ³¡ÀÏÀ» ¼ÂÆÃÇÏ°í ½ÍÀº element ÀÌ¸§
 * author
 *   freebird
 */
function setPreviousMonth(begin, end) {
	var date = new Date();
	var year = getDate(date, 'YYYY');
	var month = getDate(date, 'MM');

	month = month - 1;
	if(month == '0'){
		month = '12';
		year = year -1;
	}

	begin.value = year + month + '01';
	end.value = year + month + getEndDayOfMonth(month);
}

/**
 * ÀÌÀü´ÞÀÇ ½ÃÀÛÀÏ°ú ³¡ÀÏÀ» ±¸ÇØ¼­ begin, end element¿¡ ¼ÂÆÃÇÑ´Ù.
 *
 * param
 *   begin ½ÃÀÛÀÏÀ» ¼ÂÆÃÇÏ°í ½ÍÀº element ÀÌ¸§
 *   end ³¡ÀÏÀ» ¼ÂÆÃÇÏ°í ½ÍÀº element ÀÌ¸§
 * author
 *   jamesk // 2¿ù 1ÀÏ ¼öÁ¤
 */
function setPreviousMonth1(begin, end) {
	var date = new Date();
	var year = getDate(date, 'YYYY');
	var month = getDate(date, 'MM');
	//var month = '02';

	month = month - 1;
	if(month == '0'){
		month = '12';
		year = year -1;
	}
	if(month >=10){
		begin.value = year + month + '01';
		end.value = year + month + getEndDayOfMonth(month);
	}else{
		begin.value = year + '0'+month + '01';
		end.value = year + '0'+month + getEndDayOfMonth(month);
	}
}

/**
 * ÇØ´ç´ÞÀÇ ¸¶Áö¸· ³¯ÀÚ¸¦ ¾ò´Â´Ù.
 * ÇöÀç ³âµµ¸¸ °¡´É
 * param
 *   month ¸¶Áö¸· ³¯Â¥¸¦ ¾ò°íÀÚ ÇÏ´Â ´Þ. 1, 2, 3 ... , 12
 * return
 *   ÇØ´ç´ÞÀÇ ¸¶Áö¸· ³¯Â¥
 * author
 *   freebird
 */
function getEndDayOfMonth(month) {
	var today = new Date();
	var year = today.getYear();

	var monarr = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
	if(((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
		monarr[1] = "29";

	return monarr[month-1];
}


/**
 * ÇØ´ç´ÞÀÇ ¸¶Áö¸· ³¯ÀÚ¸¦ ¾ò´Â´Ù.
 * ¸ðµç ³âµµ°¡ °¡´É
 * param
 *   month ¸¶Áö¸· ³¯Â¥¸¦ ¾ò°íÀÚ ÇÏ´Â ´Þ. 1, 2, 3 ... , 12
 * return
 *   ÇØ´ç´ÞÀÇ ¸¶Áö¸· ³¯Â¥
 * author
 *   freedae
 */
function getEndDayOfMonth2(year, month) {
	var monarr = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
	if(((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
		monarr[1] = "29";

	return monarr[month-1];
}

/**
 * ÇØ´ç ÁÖÀÇ ½ÃÀÛÀÏ°ú ³¡ÀÏÀ» form element¿¡ ¼ÂÆÃÇÑ´Ù.
 *
 * param
 *   date Javascript Date °´Ã¼
 *   begin ½ÃÀÛÀÏÀ» ¼ÂÆÃÇÏ°í ½ÍÀº element ÀÌ¸§
 *   end ³¡ÀÏÀ» ¼ÂÆÃÇÏ°í ½ÍÀº element ÀÌ¸§
 * author
 *   freebird
 */
function setWeek(date, begin, end) {
	var dayOfWeek = date.getDay();
	var day = date.getDate();
	var month = date.getMonth();
	var year = date.getYear();

	year += (year < 2000) ? 1900 : 0;
	var weekStartDate = new Date(year, month, day - dayOfWeek);
	var weekEndDate = new Date(year, month, day + (6 - dayOfWeek));

	begin.value = getDate(weekStartDate, 'YYYYMMDD');
	end.value = getDate(weekEndDate, 'YYYYMMDD');
}

/**
 * ÇöÀçÀÏÀ» Æ÷ÇÔÇÏ´Â ÁÖÀÇ ½ÃÀÛÀÏ°ú ³¡ÀÏÀ» form element¿¡ ¼ÂÆÃÇÑ´Ù.
 *
 * param
 *   begin ½ÃÀÛÀÏÀ» ¼ÂÆÃÇÏ°í ½ÍÀº element ÀÌ¸§
 *   end ³¡ÀÏÀ» ¼ÂÆÃÇÏ°í ½ÍÀº element ÀÌ¸§
 * author
 *   freebird
 */
function setCurrentWeek(begin, end) {
	var date = new Date();
	setWeek(date, begin, end);
}


/**
 * ÇöÀçÀÏÀÇ 7ÀÏÀüÀ» Æ÷ÇÔÇÏ´Â ÁÖÀÇ ½ÃÀÛÀÏ°ú ³¡ÀÏÀ» form element¿¡ ¼ÂÆÃÇÑ´Ù.
 *
 * param
 *   begin ½ÃÀÛÀÏÀ» ¼ÂÆÃÇÏ°í ½ÍÀº element ÀÌ¸§
 *   end ³¡ÀÏÀ» ¼ÂÆÃÇÏ°í ½ÍÀº element ÀÌ¸§
 * author
 *   freebird
 */
function setPreviousWeek(begin, end) {
	var AWEEK = 1000 * 60 * 60 * 24 * 7;
	var date = new Date();
	date = new Date( date.getTime() - AWEEK );
	setWeek(date, begin, end);
}

/**
 * stringÀÌ ³¯Â¥ Çü½ÄÀÌ ¸Â´ÂÁö °Ë»çÇÑ´Ù.
 * (ÇöÀç ³âµµ¸¸ °¡´É)
 * param
 *   date YYYYMMDD Çü½ÄÀÇ string
 * author
 *   freebird
 */
function checkDateFormat(dateStr)
{
	dateStr = dateStr.replace(/-/gi, '');
	if( dateStr.length == 0 || dateStr.length != 8 )
		return false;

	var year = dateStr.substring(0, 4);
	var month = dateStr.substring(4, 6);
	var day = dateStr.substring(6, 8);

	if ( year < 1970) return false;
	if ( month > 12 || month < 1 ) return false;
	if ( day > getEndDayOfMonth(month) || day < 1 ) return false;

	return true;
}


/**
 * dateStrÀÌ ³¯Â¥ Çü½ÄÀÌ ¸Â´ÂÁö °Ë»çÇÑ´Ù.
 * (¸ðµç ³âµµ°¡ °¡´É)
 * param
 *   date YYYYMMDD Çü½ÄÀÇ string
 * author
 *   freedae
 */
function checkDateType(dateStr)
{
	dateStr = dateStr.replace(/-/gi, '');

	if( dateStr.length == 0 || dateStr.length != 8 )
		return false;
	for(var i=0; i<dateStr.length; i++){
		if( !(isNum(dateStr.charAt(i))) )
			return false;
	}

	var year = dateStr.substring(0, 4);
	var month = dateStr.substring(4, 6);
	var day = dateStr.substring(6, 8);

	if ( year < 1970) return false;
	if ( month > 12 || month < 1 ) return false;
	if ( day > getEndDayOfMonth2(year, month) || day < 1 ) return false;

	return true;
}

/**
 * ³¯Â¥¿¡ ³¯À» ´õÇÑ´Ù.
 *
 * param
 *    ³¯Â¥(YYYYMMDD)
 *    ´õÇÏ°íÀÚ ÇÏ´Â ³¯(intÇü ¼ö)
 * return
 *    ³¯Â¥(YYYYMMDD)
 * author
 *   freedae
 */
function addDate(date, addDate) {
	var ADAY = 1000 * 60 * 60 * 24 ;
	var addedTime = ADAY * addDate;
	var addedDate = new Date( date.getTime() + addedTime );
	return getDate(addedDate, 'YYYYMMDD');
}

/**
 * ÇöÀç³¯Â¥¿¡¼­ day¸¸Å­ ´õÇÏ°Å³ª »« ³¯Â¥¸¦ ¾ò´Â´Ù.
 * param
 *  day : ÇöÀç³¯Â¥¿¡¼­ ´õÇÏ°Å³ª »« ÀÏÀÚ
 *	form : ¹®ÀÚ¿­ Çü½Ä
 * return
 * author
 *   ±èÅÂ¶ô
 */
function getWantedDate(day, form)
{
	var ADAY = 1000 * 60 * 60 * 24 * day;
	var date = new Date();
	date = new Date( date.getTime() + ADAY );

	if( form == null )
		return( getDate(date, 'YYYYMMDD') );
	else
		return( getDate(date, form) );
}


/**
 * µÎ ³¯Â¥ÀÇ ³¯¼ö¸¦ °è»êÇØ ÁØ´Ù.
 *
 * param
 *    from day(YYYYMMDD)
 *    to   day(YYYYMMDD)
 * return
 *    from day¿Í to dayÀÇ Â÷ÀÌ¸¦ ¸®ÅÏÇÑ´Ù.
 * author
 *   freedae
 */
function numberOfDays(fromDay, toDay){
	var fromD = new Date(fromDay.substring(0,4),fromDay.substring(4,6)-1,fromDay.substring(6,8));
	var toD = new Date(toDay.substring(0,4),toDay.substring(4,6)-1,toDay.substring(6,8));
	var totD = toD.getTime() - fromD.getTime();
	totD = totD / 1000 / 60 / 60 / 24+1;
	return totD;
}


/**
 * ¿À´Ã ³¯Â¥¿Í ÇØ´ç ÀÏÀÚ ¸¸Å­ÀÇ ±â°£À» ¼³Á¤ÇÑ´Ù.
 *
 * param
 *   obj : radio ¹öÆ°
 *   dt_fr : ±â°£ÀÇ ½ÃÀÛÀÏÀÌ ¼³Á¤µÉ ¿ÀºêÁ§Æ®
 *   dt_to : ±â°£ÀÇ Á¾·áÀÏÀÌ ¼³Á¤µÉ ¿ÀºêÁ§Æ®
 *   in_year : ÇöÀç ½Ã½ºÅÛÀÇ ³â - ¹®ÀÚ¿­
 *   in_month : ÇöÀç ½Ã½ºÅÛÀÇ ¿ù - ¹®ÀÚ¿­
 *   in_date : ÇöÀç ½Ã½ºÅÛÀÇ ÀÏ - ¹®ÀÚ¿­
 *   want_term_day : ¿À´Ã ³¯ÀÚ¸¦ ±âÁØÀ¸·Î ±¸ÇÏ°íÀÚ ÇÏ´Â ±â°£(ÀÏ¼ö) (°ú°Å ÀÏÁÖÀÏ : -7, ¹Ì·¡ ÀÏÁÖÀÏ : 7)
 *   want_format : ±¸ºÐÀÚ (¾È³Ñ±æ°æ¿ì ±âº» ±¸ºÐÀÚ´Â "/" ÀÓ) 2005/03/12
 *
 * author
 *
 */
function setWantedTerm(obj, dt_fr, dt_to, in_year, in_month, in_date, want_term_day, want_format) {
	if (obj.checked == true) {
		var date = new Date(parseInt(in_year),parseInt(in_month)-1,parseInt(in_date));
		var s_cur = getDate(date, 'YYYYMMDD');

		var term = 1000 * 60 * 60 * 24 * parseInt(want_term_day);
		date = new Date(date.getTime() + term);
		var s_wnt = getDate(date, 'YYYYMMDD');

		if (want_format == null) {
			s_cur = s_cur.substring(0,4)+'/'+s_cur.substring(4,6)+'/'+s_cur.substring(6,8);
			s_wnt = s_wnt.substring(0,4)+'/'+s_wnt.substring(4,6)+'/'+s_wnt.substring(6,8);
		} else {
			s_cur = s_cur.substring(0,4)+want_format+s_cur.substring(4,6)+want_format+s_cur.substring(6,8);
			s_wnt = s_wnt.substring(0,4)+want_format+s_wnt.substring(4,6)+want_format+s_wnt.substring(6,8);
		}

		if (parseInt(want_term_day) > 0) {
			dt_fr.value = s_cur;
			dt_to.value = s_wnt;
		} else {
			dt_fr.value = s_wnt;
			dt_to.value = s_cur;
		}
	}
}


/**
 * ¹®ÀÚ¿­ÀÇ ±æÀÌ¸¦ Ã¼Å©ÇØÁØ´Ù.
 *
 * param
 *   ¹®ÀÚ¿­
 *   ºñ±³ÇÏ°íÀÚ ÇÏ´Â ¹®ÀÚ¿­ÀÇ ±æÀÌ
 * return
 *   ºñ±³ÇÏ°íÀÚ ÇÏ´Â ¹®ÀÚ¿­º¸´Ù ¹®ÀÚ¿­ÀÇ ±æÀÌ°¡ Å©´Ù¸é false, ±×·¸Áö ¾Ê´Ù¸é true
 * author
 *   freedae
 */
function stringLength(sl, co){
	var tem = 0;
	for(var i=0; i<sl.length; i++){
		if(sl.charCodeAt(i) > 127){
			tem = tem + 2;
		}else{
			tem = tem + 1;
		}
	}

	if(co < tem)
		return false;
	else
		return true;
}


/**
 * ±Ý¾×ÀÇ Å©±â¸¦ Ã¼Å©ÇØÁØ´Ù.
 *
 * param
 *   ±Ý¾×(½±Ç¥°¡ ¾ø´Â)
 * return
 *   ±Ý¾×ÀÇ Å©±â°¡ Å©´Ù¸é false, ±Ý¾×ÀÇ Å©±â°¡ ¾çÈ£ÇÏ¸é true
 * author
 *   freedae
 */
function moneyLength(sl){
	if(parseFloat(sl) > '99999999999999.99')
		return false;
	else
		return true;
}


/**
 *	select : select¿¡¼­ ¼±ÅÃµÈ °ª ¸®ÅÏ
 *	(2002.06.11)
 */
function getSelectedOption(obj)
{
	var idx = obj.selectedIndex;
	var v_sel = obj.options[idx].value;
	return v_sel;
}

/**
 *	¼±ÅÃÇÑ ³âµµ, ¿ù¿¡ µû¶ó ÀÏ select¿¡ ³¯Â¥¸¦ displayÇÑ´Ù
 */
function displayDay(obj_year, obj_month, obj_day)
{
 	var s_day = getSelectedOption(obj_day);
 	var YEAR=obj_year.options[obj_year.selectedIndex].value;
 	var MONTH=obj_month.options[obj_month.selectedIndex].value;
 	var daysInMonth=new Date(new Date(YEAR,MONTH,1)-86400000).getDate();
 	for(var i=0; i<obj_day.length; i++) obj_day.options[i]=null;
 	for(var j=0; j<daysInMonth; j++) {
 		if(j<9) var k="0"+(j+1); else var k=j+1;
 		obj_day.options[j]=new Option(k, k);
 		if(s_day==k)
 			obj_day.options[j].selected = true;
 	}
}

/**
 * ¹®ÀÚ¿­ÀÇ ±æÀÌ¸¦ Ã¼Å©ÇØÁØ´Ù.
 *
 * param
 *   ¹®ÀÚ¿­
 *   ºñ±³ÇÏ°íÀÚ ÇÏ´Â ¹®ÀÚ¿­ÀÇ ±æÀÌ
 * return
 *   ºñ±³ÇÏ°íÀÚ ÇÏ´Â ¹®ÀÚ¿­º¸´Ù ¹®ÀÚ¿­ÀÇ ±æÀÌ°¡ Å©´Ù¸é false, ±×·¸Áö ¾Ê´Ù¸é true
 * author
 *   freedae
 */
function stringLength(sl, co){
	var tem = 0;
	for(var i=0; i<sl.length; i++){
		if(sl.charCodeAt(i) > 127){
			tem = tem + 2;
		}else{
			tem = tem + 1;
		}
	}

	if(co < tem)
		return false;
	else
		return true;
}


/*
 * 1.ÆË¾÷Ã¢À» Áß¾Ó¿¡ ¹èÄ¡½ÃÅ²´Ù.
 * 2.ÆË¾÷¿¡ ¸Â´Â ¸®»çÀÌÂ¡À» ÇÑ´Ù.
 */
function wResize( nWidth, nHeight) {dWidth=nWidth; dHeight=nHeight; window.moveTo((screen.width-dWidth)/2, (screen.Height-dHeight)/3);window.resizeTo(dWidth, dHeight);}



function Smrtpollgo_opn( szRegSeq) {
	LaunchCenter('/Smrtpoll/Smrtpoll_popup.jsp?REG_SEQ='+szRegSeq, 'opn_pop', 340, 340, 1);
}

