function doEvent(formName, eventId) {
	formInstance = eval("document." + formName);
	formInstance._eventId.disabled = false;
	formInstance._eventId.value = eventId;
	formInstance.submit();
}
function cancelDelete(){
	window.history.back();
}

function openSubWindow2(formName,name){
	if (name == "material") {
		var subWin = window.open('',name,'width=700,height=700,toolbar=no,scrollbars=yes,resizable=yes,status=no,menubar=no,location=no,directories=no');
		formInstance = eval("document." + formName);
		formInstance._eventId.value = "meterialSubmit" ;
		formInstance.submit();
	}
}

function openSubWindow(name){
	if (name == "material") {
		var subWin = window.open('',name,'width=700,height=700,toolbar=no,scrollbars=yes,resizable=yes,status=no,menubar=no,location=no,directories=no');
	}
	else if(name == "enqueteList"){
		var subWin = window.open('/c/enquete/list.html', name, '');
	}
	else if(name == "enqueteEdit"){
		var rid = Math.floor(Math.random() * 10000);
		var subWin = window.open('/c/flow/enquete?rid=' + rid, name, '');
	}
	else if(name == "seminarListSample"){
		var subWin = window.open('', name, 'width=540,height=466,toolbar=no,scrollbars=yes,resizable=yes,status=no,menubar=no,location=no,directories=no');
	}
	subWin.focus();
}

function setValue(formName, propertyName, value) {
	var form = eval("document." + formName);
	for (i = 0; i < form.elements.length; i++) {
		if (form.elements[i].name == propertyName) {
			form.elements[i].value = value;
			break;
		}
	}
}

function openCompanyWindow(targetName){
	var style = 'width=950,height=768,toolbar=no,scrollbars=yes,resizable=yes,status=no,menubar=no,location=no,directories=no'
	var subWin = window.open('about:blank', targetName, style);
	subWin.focus();
}

function openCompanyWindowByUrl(url, targetName){
	var style = 'width=620,height=768,toolbar=no,scrollbars=yes,resizable=yes,status=no,menubar=no,location=no,directories=no'
	var subWin = window.open(url, targetName, style);
	subWin.focus();
}

function openBookmarkWindow(targetName){
	var style = 'width=400,height=400,toolbar=no,scrollbars=no,resizable=no,status=no,menubar=no,location=no,directories=no'
	var subWin = window.open('about:blank', targetName, style);
	subWin.focus();
}
function openBookmarkWindowByUrl(url, targetName){
	var style = 'width=400,height=400,toolbar=no,scrollbars=no,resizable=no,status=no,menubar=no,location=no,directories=no'
	var subWin = window.open(url, targetName, style);
	subWin.focus();
}
function checkAll(val, field) {
	list = field;
	if (list) {
		if (list.length) { 
			for (i=0;i<list.length;i++) {
				list[i].checked=val;
			}
		} else if (list!=null) {
			list.checked=val;
		}
	}
}

function checkAllToOne(allfield, field) {
	judge = true;
	list = field;
	if (list.length) {
		for (i=0;i<list.length;i++) {
			if (! list[i].checked) {
				judge = '';
			}
		}
	} else if (list!=null) {
		judge = list.checked;
	}
	allfield.checked=judge;
}


function VS_clear(start,end){
    VS_init('help', start, end);
}

function VS_init(nm, cnt_s, cnt_f) {
	for(i=cnt_s; i<=cnt_f; i++) {
		if(!document.getElementById(nm + i)) {
			continue;
		} else {
			VS_hHelp(nm + i);
		}
	}
}

function VS_sHelp(Lyr){
	document.getElementById(Lyr).style.visibility='visible';
}

function VS_hHelp(Lyr){
	document.getElementById(Lyr).style.visibility='hidden';
}

//	文字数カウンター 2008/07/29 add H.Matsumoto
function CalcBody(formName ,el1,el2,hz){
	formInstance = eval("document." + formName);
	var str = window.formInstance.elements[el1].value;

	count = 0;
	for (i = 0; i < str.length; i++) {
		n = str.charAt(i);
		ne = escape(str.charAt(i));
		if (ne.length < 4) {count++;}
		else {count+=2;}
//		if (str.indexOf("\n", i) == i) {count++;}
	}

	if(hz == "半角"){

		window.formInstance.elements[el2].value = count;
	}
	else{
		window.formInstance.elements[el2].value = count / 2;
	}
	return;
}