/**
 * 리스트에  전체선택/취소 함수
 * @param obj
 * @param targetItems
 * @return
 */
function toggleCheckbox(/*전체선택체크박스*/obj, /*체크될 항목*/targetName){
  if( arguments.length == 2 ){
    var targets = document.getElementsByName(targetName);
    if(targets){
      var checked = obj.checked;
      for( var i = 0; i < targets.length; i++ ){
        targets[i].checked = checked;
      }
    }
  }
}

/*
 * 작성자: 채영재
 * 작성일: 2009/ 2/ 10
 * 내   용: 플래쉬 파일 클릭시 해당링크 Script 
 * */
function world_fun(n){
  if(n==1){
    goHref('001001003002002');//Europe
  }
  if(n==2){
    goHref('001001003002001');//Aisa
  }
  if(n==3){
    goHref('001001003002004');//Oceania
  }
  if(n==4){
    goHref('001001003002003');//America
  }
}     


function Trim( str ) {
	  var len = str.length;
	  var boolAllSpace = true;
	  // left trim
	  for(iLoop=0;iLoop<len;iLoop++){
	    if(str.charAt(iLoop) != " "){
	      boolAllSpace = false;
	      str = str.substr(iLoop, len-iLoop);
	    break;
	    }
	  }
	  if (boolAllSpace){
	    str="";
	    return str;
	  }
	  // right trim
	  len = str.length;
	  for(iLoop=len-1;iLoop>=0;iLoop--){
	    if(str.charAt(iLoop) != " "){
	      str = str.substr(0, iLoop+1);
	      break;
	    }
	  }
	  return str;
	}

String.prototype.trim = function() {
	  return this.replace(/\s/g, "");
	 }

/**
 * 아이프레임 리사이즈
 * 사용법:resizeFrame('부모창 아이프레임id값')
 */



/*
 * 작성자: 채영재
 * 작성일: 2009-2-13
 * 내   용: IE6으로 인한 다운로드 인코딩
 * */
function download(dirName,fileName){
  var uDirname= toUTF8(dirName);
  var uFilename=toUTF8(fileName);
  location.href='download.jsp?dirName='+uDirname+'&fileName='+uFilename;
  }


function toUTF8(szInput)
{
 var wch,x,uch="",szRet="";
 for (x=0; x<szInput.length; x++)
  {
  wch=szInput.charCodeAt(x);
  if (!(wch & 0xFF80)) {
   szRet += "%" + wch.toString(16);
  }
  else if (!(wch & 0xF000)) {
   uch = "%" + (wch>>6 | 0xC0).toString(16) +
      "%" + (wch & 0x3F | 0x80).toString(16);
   szRet += uch;
  }
  else {
   uch = "%" + (wch >> 12 | 0xE0).toString(16) +
      "%" + (((wch >> 6) & 0x3F) | 0x80).toString(16) +
      "%" + (wch & 0x3F | 0x80).toString(16);
   szRet += uch;
  }
 }
 return(szRet);
}
//***************************************





//날짜: 2009. 1. 9 | 작성자: 채영재 | 내용:프린트 PopUp창 ---------------------------
function printDiv(iWidth, iHeight, Div){
//try{
var nowUrl = location.href;
var p1 = nowUrl.lastIndexOf("/");
var baseUrl = location.href.substring(0, p1+1);
var tForm = document.generalPrintForm;
var DivValue= Div;
var divPrint = document.getElementById(DivValue);
var divText ="";
try{
if(iWidth.length <= 0)       iWidth = 720;
if(iHeight.length <= 0)      iHeight = 700;
if(divPrint==null){
alert('정보통지서가 존재하지 않습니다 \n\r확인해주십시오.');
return false;
}

}catch (e){
iWidth  = 745;
iHeight = 700;
}
divText = "<div id=\"content\">" + divPrint.innerHTML + "</div>";
divText = divText.replace(/ü/g,"&#252;");
divText = divText.replace(/<a/g, "<as");
divText = divText.replace(/<A/g, "<AS");
divText = divText.replace(/<input type="text"/g,"<input type=\"text\" readonly");
divText = divText.replace(/input-text-search/g,"input-text-search readonly ");
divText = divText.replace(/type=image/g,"type=image readonly ");
divText = divText.replace(/<select/g,"<select disabled");
divText = divText.replace(/<SELECT/g,"<SELECT DISABLED");
divText = divText.replace(/•/g,"&#149;");
divText = divText.replace(/∙/g,"&#183;");
divText = divText.replace(/·/g,"&#183;");
divText = divText.replace(/ü/g,"&#252;");
divText = divText.replace(/é/g,"&#233;");
divText = divText.replace(/ë/g,"&#235;");
divText = divText.replace(/ê/g,"&#234;");
divText = divText.replace(/ï/g,"&#239;");
divText = divText.replace(/ⅲ/g,"iii");
divText = divText.replace("É","&#201;");
divText = divText.replace(/’/g,"&#146;");
divText = divText.replace(/ô/g,"&#212");
divText = divText.replace(/ä/g,"&#228");
divText = divText.replace(/ö/g,"&#214");
tForm.divText.value=divText;
tForm.baseUrl.value = baseUrl;

window.open("", "printWindow", "width="+ iWidth +", height="+ iHeight +", left=50, top=50, scrollbars=yes");

tForm.target = "printWindow";
tForm.action = "/karts/inc/PrintPopUp.jsp";
tForm.method = "post";
tForm.submit();
return false;
//}catch (e){ alert(e); }
}
//-------------------------------------------------------------------------------

function resizeFrame(id){
  var Browser  = {
      IE:     !!(window.attachEvent && !window.opera),  
      Opera:  !!window.opera,  
      WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,  
      Gecko:  navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1  
  };
  var tmpFrame = parent.document.getElementById(id);  
  if(tmpFrame != null){
      tmpFrame.style.display="block";  
      if(Browser.IE){
        tmpFrame.style.height = document.body.scrollHeight+"px";
      }else{
        tmpFrame.style.height = document.body.offsetHeight+"px";
      }
  }  
}  