
//
function checkInList(f){
	for(var i = 1; i < f.chk.length; i++){
		if(f.chk[0].checked == false){ 
			f.chk[i].checked = false; 
		}else if(f.chk[0].checked == true){
			f.chk[i].checked = true; 
		}
	}
}
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////////////////////////////////
//
function MultiDeleteInList(f){
	var count = 0;
	var result = "";
	for(var i = 1; i < f.chk.length; i++){
		if(f.chk[i].checked){ 
			result += "\'" + f.chk[i].value + "\',";
			count++;
		}
	}
	if(count == 0){
		alert ("<?=$comnChooseOneAtLeastLang?>");
	}else{
		if(confirm("<?=$comnAreYouSureLang?>")) {
			f.deleteList.value = result;
			f.submit();
		}
	}
}
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////////////////////////////////
//
function singleDeleteInForm(f){
	f.proc.value = "singleDelete";
	if(confirm("<?=$comnAreYouSureLang?>")) 	f.submit();
}
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////////////////////////////////
//
function insertFormCheck(f){
		//if(f.<?=$prefix?>_name.value =="") {alert ("<?=${'chk_'.${prefix}.'_name_Lang'}?>"); f.<?=$prefix?>_name.focus(); return false; }
	f.submit();
}
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////////////
//
function showHide(obj) {  

	var elm = document.getElementById(obj);  

	if ( elm.style.display != 'none' ) { 
		elm.style.display = 'none';   
	} else {
		elm.style.display = ''; 
	}
}
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////////////
//
function popup(url,w,h)
{
	if(!w) w = 800;

	if(!h) h = 700;

	winOption = "width="+w+", height="+h+", toobar=no, scrollbars=yes, menubar=no, status, directories=no";

	window.open(url,'newwindow',winOption);
//	window.open(url,'newwindow','width=800, height=700, toobar=no, scrollbars=yes, menubar=no, status, directories=no');
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////////////////////////////////
//
var countTr = 1;

function addTr() {
	var pTbody = document.getElementById("targetTbody");
	var pTr = pTbody.rows[0].cloneNode(true);
	pTbody.appendChild(pTr);	
	pTr.id = "addTrId_" + countTr;
	countTr ++;
	//document.consultationForm.countTr.value = countTr;
}

function delTr() {
	var pTbody = document.getElementById("targetTbody");
	 if(countTr >1){
		var pTr = document.getElementById("addTrId_"+(--countTr));
		pTbody.removeChild(pTr);
	 }
}
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////////////////////////////////
//
function checkNull(input,msg) {
    if(input.value == null || input.value == ""){
		alert(msg);
		input.focus();
		return false;
    }
	else{ return true; }
}

function checkOnlyNumber(input,msg){
	reg = /^[0-9]*$/;
	if(!reg.test(input.value)){
		alert(msg);
		input.focus();
		return false;
	}
	else { return true; }
}

function checkCompanyId(input,msg){
	reg = /^[a-zA-Z0-9]{2,20}$/;
	if(!reg.test(input.value)){
		alert(msg);
		input.focus();
		return false;
	}
	else { return true; }
}

function checkKey(input,msg){
	reg = /^[a-zA-Z0-9]{10}$/;
	if(!reg.test(input.value)){
		alert(msg);
		input.focus();
		return false;
	}
	else { return true; }
}

function checkMemberId(input,msg){
	reg = /^[a-zA-Z0-9]{6,20}$/;
	if(!reg.test(input.value)){
		alert(msg);
		input.focus();
		return false;
	}
	else { return true; }
}

function checkMemberPassword(input,msg){
	reg = /^[^ ]{8,16}$/;		// space is not allowed
	if(!reg.test(input.value)){
		alert(msg);
		input.focus();
		return false;
	}
	else { return true; }
}

function checkDate(input,msg){
	reg = /^\d{2}\/\d{2}\/\d{4}$/;
	if(!reg.test(input.value)){
		alert(msg);
		input.focus();
		return false;
	}
	else { return true; }
}

function checkDateK(input,msg){
	reg = /^\d{4}\-\d{2}\-\d{2}$/;
	if(!reg.test(input.value)){
		alert(msg);
		input.focus();
		return false;
	}
	else { return true; }
}

function checkYearofGraduate(input,msg){
	reg = /^\d{4}$/;
	if(!reg.test(input.value)){
		alert(msg);
		input.focus();
		return false;
	}
	else { return true; }
}

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

