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_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];}
}

// 로그인 정보 저장
function confirmSave(checkbox)
{
  var isRemember;
  
  // 로그인 정보 저장한다고 선택할 경우
  if(checkbox.checked)
  {
    //isRemember = confirm("이 PC에 로그인 정보를 저장하시겠습니까? \n\nPC방등의 공공장소에서는 개인정보가 유출될 수 있으니 주의해주십시오.");
    
    //if(!isRemember)
    //  checkbox.checked = false;
  }
} 
 
// 쿠키값 가져오기
function getCookie(key)
{
  var cook = document.cookie + ";";
  var idx =  cook.indexOf(key, 0);
  var val = "";
 
  if(idx != -1)
  {
    cook = cook.substring(idx, cook.length);
    begin = cook.indexOf("=", 0) + 1;
    end = cook.indexOf(";", begin);
    val = unescape( cook.substring(begin, end) );
  }
 
  return val;
}
 
// 쿠키값 설정
function setCookie(name, value, expiredays)
{
  var today = new Date();
  today.setDate( today.getDate() + expiredays );
  document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + today.toGMTString() + ";"
}
 
// 쿠키에서 로그인 정보 가져오기
function getLogin()
{
 var frm = document.loginform;
 
 // userid 쿠키에서 id 값을 가져온다.
 var id = getCookie("userid");
 // 가져온 쿠키값이 있으면
 if(id != "")
 {
  frm.login_id.value = id;
  frm.saveid.checked = true;
 }
}
 
// 쿠키에 로그인 정보 저장
function saveLogin(id)
{
 if(id != "")
 {
  // userid 쿠키에 id 값을 30일간 저장
  setCookie("userid", id, 30);
 }else{
  // userid 쿠키 삭제
  setCookie("userid", id, -1);
 }
}



//======================================================================================
// Description	:	1000 -> 1,000 으로 변경함
// Writer       :   
// Parameter	:	number	/ 변경할 숫자
// Return Value	:	세자리마다 컴마가 찍힌 문자열
//======================================================================================
function FormatNumber(number)
{ 
        if (number < 0) { number *= -1; var minus = true; }
        else var minus = false;

        var dotPos = (number + "").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;
}


function intcheck(oil)
{

  for(int01=0;int01<oil.value.length;int01++)
    {
     if ((oil.value.charAt(int01)<'0') || (oil.value.charAt(int01)>'9'))
	   {
	alert("숫자로만 입력하세요.");
	oil.value="";
	oil.focus();
    return;
   	   }
    }
}


function r_check(form) 
{
if (form.tbxviewname.value=="")
{alert("이름을 입력하세요.");
return false;}
return true;
}

function opi_check(form) 
{
if (form.opiname.value=="")
{alert("이름을 입력하세요.");
return false;}

if (form.opinion.value=="")
{alert("내용을 입력하세요.");
return false;}


return true;
}

function del_opi(s)
{
    if( confirm("정말 삭제하시겠습니까?")==false ) 
	{    }
	else{
       document.opidel_form.opi_seq.value=s;
       document.opidel_form.submit();
    }		
}

function ctrl_c() {
    var range, obj;

    if ( !document.all ) {
        alert("파이어폭스는 지원하지 않으니 복사해 주시길바랍니다.");
        return;
    }

    obj = document.getElementById('track_url');
    obj.select();

    range = obj.createTextRange();
    range.execCommand("Copy")

    alert("트랙백 주소가 복사되었습니다.");
    return;
}

function toggleLayer(id) {
	try {
	var obj = document.getElementById(id);
	obj.style.display = (obj.style.display == "none") ? "block" : "none";
	} catch (e) {
		
	}
	return true;
}


function del_view(s)
{
    if( confirm("정말 삭제하시겠습니까?")==false ) 
	{    }
	else{
 
       document.opidel_form.action="board_delete.asp";
       document.opidel_form.idx.value=s;
       document.opidel_form.submit();
    }		
}

function del_view2(s,url)
{
    if( confirm("정말 삭제하시겠습니까?")==false ) 
	{    }
	else{
 
       document.opidel_form.action=url;
       document.opidel_form.idx.value=s;
       document.opidel_form.submit();
    }		
}

function OpenView(strUrl) 
{ 
	var intWidth = 600; 
	var intHeight = 750; 

	var intTop = (window.screen.availHeight - intHeight) / 2; 
	var intLeft = (window.screen.availWidth - intWidth) / 2; 

	if(intLeft <0) intLeft = 0; 
	if(intTop <0) intTop = 0; 

	var result = window.open( 
		strUrl 
		, "ImageViewer" 
		, "top=" + intTop + ",left=" + intLeft + ",width=" + intWidth + ",height=" + intHeight + ",fullscreen=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes" 
	) 

	result.focus(); 
} 


function intcheck(oil)
{

  for(int01=0;int01<oil.value.length;int01++)
    {
     if ((oil.value.charAt(int01)<'0') || (oil.value.charAt(int01)>'9'))
	   {
	alert("숫자로만 입력하세요.");
	oil.value="";
	oil.focus();
    return;
   	   }
    }
}


function contents_cp()
    {
        if (window.event)
        {
            window.event.returnValue = true;
            window.setTimeout('attach_kinref()', 25);
        }
    }

function attach_kinref()
    {
        if (window.clipboardData) // IE
        {
            // get data from clipboard
            var txt = window.clipboardData.getData('Text');

            // attach the source at the end of text
            txt = txt + '\r\n(출처 : \''+title_js_var+'\' - BCIC 인트라넷)\r\n';

            // set data to clibboard
            var result = window.clipboardData.setData('Text', txt);
        }
    }


function go_workdiary(id,tid)
{
location.href="workdiary.asp?work_id="+id+"&work_team="+tid;
}

function del_ubmopi(s)
{
    if( confirm("정말 삭제하시겠습니까?")==false ) 
	{    }
	else{
       document.opidel_form.opi_seq.value=s;
       document.opidel_form.submit();
    }		
}

function goUrl(url,opt)
{
if (url=="")
   {
  
   }
else
	{
      if (opt==0)
       {
	    location.href=url;
       }
      else
   	   {
        window.open (url,"win_t","")
       }
	}
}


function scaleFont(val) 
{ 
var content, lineHeight; 
content = document.getElementById("content");
if (val > 0) 
  { 
   if (fontSize <= 18) 
      {
	  fontSize = fontSize + val; 
	  lineHeight = fontSize+Math.round(1.1*fontSize);
	  content.style.fontSize = fontSize + "px"; 
	  }
   }
   else
   { 
    if (fontSize > 12)
	  {
	  fontSize = fontSize + val;
	  lineHeight = fontSize+Math.round(1.1*fontSize);
	  content.style.fontSize = fontSize + "px";
	  }
   }
//var mydate = new Date;
//mydate.setDate(mydate.getDate()+1000);
//setCookie("news_font_size", fontSize, mydate);
}
var fontSize = parseInt(getFontCookie());

function getFontCookie()
{ 
var cookie = getCookie("news_font_size");
if ( cookie == null ) return 16; 
if ( cookie.length ) return cookie; 
else return 16; 
} 


function GoPage(sURL)
{
	var sURLString, sGETString = "";
	var aGet, sTempString = "";
	var aGetTemp = new Array();
	var frm = document.gopage

	if (sURL.indexOf("?") > 0 ) {
		sURLString = sURL.substr(0,sURL.indexOf("?"));
		sTempString = sURL.substr(sURL.indexOf("?")+1);

		aGet = sTempString.split("&")
		for ( i = 0; i < aGet.length; i++ ) {
			var temp = aGet[i].split("=")
			aGetTemp[i] = new Array( temp[0], temp[1] );
		}
	} else {
		sURLString = sURL
	}
	for (var i=0;i<frm.elements.length;i++) {
		checkgetstring :
			for(var ii=0;ii < aGetTemp.length;ii++){
				if (document.gopage.elements[i].name == aGetTemp[ii][0] ){
					document.gopage.elements[i].value = aGetTemp[ii][1]
					aGetTemp.splice(ii,1)
					//delete aGetTemp[ii]
					break checkgetstring;
				}
			}
		if( i > 0 ) {
			sGETString = sGETString+"&"+document.gopage.elements[i].name+"="+document.gopage.elements[i].value;
		} else {
			sGETString = sGETString+document.gopage.elements[i].name+"="+document.gopage.elements[i].value;
		}
	}
	for( var i=0; i<aGetTemp.length; i++) {
		if (aGetTemp[i]){
			if (sGETString.length > 1) {
				sGETString = sGETString+"&"+aGetTemp[i][0]+"="+aGetTemp[i][1];
			} else {
				sGETString = sGETString+aGetTemp[i][0]+"="+aGetTemp[i][1];
			}
		}
	}
	//alert("URL:"+sURLString);
	//alert("Temp:"+sTempString);
	//alert("GET:"+sGETString);
	location.href= sURLString + "?" + sGETString

}


function openEventPopupBox(id,url,w,h,l,t) 
{ 
if ( getCookie( id ) != "done" )
	{
noticeWindow  =window.open(url,id,'left='+l+', top='+t+',width='+w+',height='+h+',intHeightoolbar=0, menubar=0, location=0, directories=0, status=0, scrollbars=no, resizable=0'); 
noticeWindow.opener = self; 
    }
}
