var excelLocation = "http://61.74.195.84/excel/eboss1/"

function isDate(yyyy,mm,dd)
{
   if (yyyy.length != 4)
      return false;
   else {   
      yyyy=parseInt(yyyy,10);
      mm=parseInt(mm,10);
      dd=parseInt(dd,10);
      d = new Date(yyyy,mm-1,dd);
      if (d=="NaN") return false;
      if (yyyy == d.getFullYear() &&
         mm == d.getMonth()+1 &&
         dd == d.getDate() ) return true;
      return false;
   }   
}

function isDate_yyyy_m_d(s)// yyyy-mm-dd ÇüÅÂ
{
   s=s.replace(/\s/g,""); // °ø¹éÁ¦°Å
   if (s.match(/\d+\-\d+\-\d+/g)!=s) 
      return false; // 1111-11-11 Æ÷¸ËÀÌ ¾Æ´Ô
   var d = s.split(/\-/g);
   return isDate(d[0],d[1],d[2]);
}

function checkIt(s)
{
   var isD

   isD=isDate_yyyy_m_d(s);
   if (isD) 
      return true;
   else
      return false;
}

function correctDate(s)// yyyy-mm-dd ÇüÅÂ
{
   s=s.replace(/\s/g,""); // °ø¹éÁ¦°Å
   var d = s.split(/\-/g);
   if (d[1].length == 1)
      d[1] = "0" + d[1];
   if (d[2].length == 1)
      d[2] = "0" + d[2];  
   return d[0] + "-"  + d[1] + "-" + d[2];
}

/* ÁÂ¿ì °ø¹é Á¦°Å */
function trim(parm_str) {
return rtrim(ltrim(parm_str));
}

/* ÁÂÃø °ø¹é Á¦°Å */
function ltrim(parm_str) {
str_temp = parm_str ;
while (str_temp.length != 0) {
if (str_temp.substring(0, 1) == " ") {
str_temp = str_temp.substring(1, str_temp.length) ;
} else {
return str_temp ;
}
}
return str_temp ;
}

/* ¿ìÃø °ø¹é Á¦°Å */
function rtrim(parm_str) {
str_temp = parm_str ;
while (str_temp.length != 0) {
int_last_blnk_pos = str_temp.lastIndexOf(" ");
if ((str_temp.length - 1) == int_last_blnk_pos) {
str_temp = str_temp.substring(0, str_temp.length - 1);
} else {
return str_temp;
}
}
return str_temp;
}


function NullCheck(str) {
   if (str) 
      return str;
   else      
      return 0;
}


function DeleteSpace(source) {
   var i = 0;
   var str_temp = "";

   for (i = 0; i < source.length; i++)
      if (source.substring(i, i + 1) != " ")
         str_temp += source.substring(i , i + 1) 
   return str_temp ;
}


function DayAdd(targetDate, defaultDate, term) {
   if (!targetDate) {
      targetDate = defaultDate;
   }    	
   var newdate=new Date(targetDate.substring(0, 4), parseInt(targetDate.substring(5, 7)) - 1, targetDate.substring(8, 10)); 
   var newtimems=newdate.getTime()+(term * 24 * 60 * 60 * 1000); 
   newdate.setTime(newtimems); 
   var month1=newdate.getMonth() + 1;
   var date1=newdate.getDate(); 
   var year1=newdate.getYear(); 
   if (year1 < 2000)    
      year1 = year1 + 1900; 
   return correctDate(year1 + "-" + month1 + "-" + date1); 
}

function DaysAfter(startDate, endDate) {
   var today = new Date(endDate.substring(0, 4), parseInt(endDate.substring(5, 7)) - 1, endDate.substring(8, 10));      
   var xday = new Date(startDate.substring(0, 4), parseInt(startDate.substring(5, 7)) - 1, startDate.substring(8, 10));
   xday.setYear = today.getYear;   
   return Math.round((today.getTime() - xday.getTime()) / (1000*60*60*24)); 
}

function formatCurrency(num) { 
   num = num.toString().replace(/$|,/g,''); 
   if (isNaN(num)) 
      num = "0"; 
   cents = Math.floor((num*100+0.5)%100); 
   num = Math.floor((num*100+0.5)/100).toString(); 
   if (cents < 10) 
      cents = "0" + cents; 
   for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++) 
      num = num.substring(0,num.length-(4*i+3))+','+num.substring(num.length-(4*i+3)); 
   return (num + "." + cents); 
} 


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) { //v3.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); 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_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function AW_PersistLayer(layerName,NSpath,IEpath,firstTime){
	
	NSpath = NSpath.replace(/!!/g,"'")
	IEpath = IEpath.replace(/!!/g,"'")
	
	
	
	var offset;
	var isIE=(document.all) ? 1 : 0;
	var isNav=(document.layers) ? 1 : 0;
	
	if(NSpath =='') {	
		if(isIE){ eval('var theLayer='+layerName)}	
		else{ eval('var theLayer=document.'+layerName)	}
		}	
	else{	
		if(isIE){ eval('var theLayer='+IEpath)}	
		else{ eval('var theLayer='+NSpath)	}
		}	

		if(eval(firstTime)){
			theLayer.XPOS = 0;
			theLayer.YPOS = 0;
		}


	if(isNav){	
		offset = self.pageXOffset
		if (offset != theLayer.XPOS){
			offset=offset-theLayer.XPOS
			theLayer.left+=offset
			theLayer.XPOS = theLayer.XPOS + offset;
			}
			
		offset = self.pageYOffset
		if (offset != theLayer.YPOS){
			offset=offset-theLayer.YPOS
			theLayer.top+=offset
			theLayer.YPOS = theLayer.YPOS + offset;
			}

	}
	else{
		offset = window.document.body.scrollLeft
		if (offset != theLayer.XPOS){
			offset=offset-theLayer.XPOS
			theLayer.style.pixelLeft+=offset
			theLayer.XPOS = theLayer.XPOS + offset;
			}
			
		offset = window.document.body.scrollTop
		if (offset != theLayer.YPOS){
			offset=offset-theLayer.YPOS
			theLayer.style.pixelTop+=offset
			theLayer.YPOS = theLayer.YPOS + offset;
			}
	
	}
	
	theLayer.timerid = setTimeout("AW_PersistLayer(\""+layerName+"\",\""+NSpath+"\",\""+IEpath+"\",'false')",200);

document.MM_returnValue=false;
theLayer.document.MM_returnValue=false;

}

function moveFocus(num,fromform,toform){
	var str = fromform.value.length;
	if(str == num)
		toform.focus();
}

function GetFormatDate(strDate) { 
   var strFormatDt;

   if (strDate)
      strFormatDt = strDate.substring(0, 4) + '-' + strDate.substring(4, 6) + '-' + strDate.substring(6, 8);
   else   
      strFormatDt = "";
   return strFormatDt;
}

function PopUp(intStyle, intWidth, intHeight, strUrl) {
   var intLeft = 0, intTop = 0;
   var winstyle;            

   if (intStyle == 0) {
      intLeft = screen.width/2-intWidth/2;
      intTop = screen.height/2-intHeight/2;
      
      return window.open(strUrl, null, 'menubar =0,resizable=0,scrollbars=0,status=no,titlebar=0,toolbar=no,width='+intWidth+',height='+intHeight+',left='+intLeft+',top='+intTop);      
   }    
   else if (intStyle == 1) {
      winstyle = "dialogWidth=" + intWidth + "px; dialogHeight=" + intHeight + "px; center:yes; status=no; help:no; ";      
      return window.showModelessDialog(strUrl, window, winstyle); 
   }

   else if (intStyle == 2) {
      winstyle = "dialogWidth=" + intWidth + "px; dialogHeight=" + intHeight + "px; center:yes; status=no; help:no; ";      
      return window.showModalDialog(strUrl, window, winstyle); 
   }
//excel
   else if (intStyle == 3) {      
      intLeft = screen.width/2-intWidth/2;
      intTop = screen.height/2-intHeight/2;
      
      return window.open(strUrl, null, 'menubar =1,resizable=1,scrollbars=0,status=no,titlebar=0,toolbar=no,width='+intWidth+',height='+intHeight+',left='+intLeft+',top='+intTop);      
   }
   
}

function PopUpUpload(intWidth, intHeight, strUrl) {
      var intLeft = 0, intTop = 0;
    
      intLeft = screen.width/2-intWidth/2;
      intTop = screen.height/2-intHeight/2;
      
      return window.open(strUrl, null, 'menubar =0,resizable=0,scrollbars=0,status=no,titlebar=0,toolbar=no,width='+intWidth+',height='+intHeight+',left='+intLeft+',top='+intTop);      

}   

//--------------------------------------------------------------------------------------//
// Description  : a function for MS IE ActiveX Rollup Patch                             //
// Parameter    : id                                                                    //
// Example  :                                                                           //
// Etc      :                                                                           //
//--------------------------------------------------------------------------------------//
function __WS__(id)
{
 document.write(id.text); id.id="";
} 


function NoticePopup() {	
   mywin = open("","20071029","top=0,left=0,width=577,height=605,scrollbars=yes") 
   with (mywin.document) { 
        location.href = "popup_notice_20071029.html"; 
   }
}



	function insert_flash(f_url, f_width, f_height)
	{
		if(f_url == "undefined" || f_width == "undefined" || f_height == "undefined"){
			return;
		}else{
			document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\""
									+ " codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\""
									+ " width=\""+ f_width +"\" height=\""+ f_height +"\">"
									+ "<param name=\"movie\" value=\""+ f_url +"\">"
									+ "<param name=\"wmode\" value=\"transparent\">"
									+ "<param name=\"quality\" value=\"high\">"
									+ "<embed src=\""+ f_url +"\" quality=\"high\""
									+ " pluginspage=\"http://www.macromedia.com/go/getflashplayer\""
									+ " type=\"application/x-shockwave-flash\" width=\""+ f_width +"\" height=\""+ f_height +"\">"
									+ "</embed></object>");
		}
	}
