function checkBoxAllCheck(id, flag){
    var checkBoxTemp = document.getElementsByName(id);
    
    for(var i = 0; i < checkBoxTemp.length; i++){
    	if(!checkBoxTemp[i].disabled){
    		checkBoxTemp[i].checked = flag;
    	}
    }
}

function moreStringToDot(target, length){
	if(target.length < length){
		target = target.substring(0, length) + " ... ";
	}
}

function clearField(targetObject){
	targetObject.value = "";
}

var tempDate = new Date();

var toDate = "";
var toDateToKorea = "";
var deafultStartDate = "2003-01-01";

var toDay = tempDate.getDate();
var toMonth = tempDate.getMonth() + 1;

if(toMonth < 10){
    toMonth = "0" + toMonth;
}

if(toDay < 10){        
    toDay = "0" + toDay;
}

toDate = "" + tempDate.getFullYear() + "-" + toMonth + "-" + toDay;

toDateToKorea = "" + tempDate.getFullYear() + "³â " + toMonth + "¿ù " + toDay + "ÀÏ";

function nullToBlank(targetValue){
	if(targetValue == ""){
		targetValue = " ";
	}
	
	return targetValue;
}

function openVideoLend(controlId){
	var reVal = "";
	reVal = window.open("/servlet/myelit/videoService?cmd=LISTLEND&controlId=" + controlId, "LISTLEND", "scrollbars=yes,toolbar=no,status=no,menubar=no,width=580,height=330");
	reVal.focus();
}

function isCheckBox(value){
	var boolean = false;
	var target = document.getElementsByName(value);
		for(var i = 0; i < target.length; i++) {
			if(target[i].checked == true){
			boolean = true;
		} 
	}
	
	return boolean;          
}

function targetLengthCheckForByte(msg){
	var nbytes = 0;

	for (i = 0; i < msg.length; i++){
		var ch = msg.charAt(i);

		if(escape(ch).length > 4){
			nbytes += 2;
		}else if (ch == '\n'){
			if (msg.charAt(i-1) != '\r'){
				nbytes += 1;
			}
		}else if (ch == '<' || ch == '>'){
			nbytes += 4;
		}else{
			nbytes += 1;
		}
	}
			
	return nbytes;
}

function fnFileDown(filepath, rfilename, ofilename){
	var goURL = "/servlet/common?cmd=DOWNLOAD2" + "&path=" + filepath + "&rfile=" + rfilename + "&ofile=" + ofilename;
	location.href = goURL;
}

function trim(str){  
    return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');  
}  
