//画面右クリック有効設定
var g_RightClickEnable = true;
//Form Sumbit
function formAct(formName, actionTxt) {
	eval("document." + formName + ".actionTxt.value = '" + actionTxt + "'");
	eval("document." + formName + ".submit()");
}

function sendTabKey() {
	if(event.keyCode == 13) {
		event.keyCode = 9;
	}	
}

function formEnterKey() {
	if (event.keyCode == 13) {
		return false;
	}
}

function pasteDisable() {
	event.returnValue = false;
}

function dropDisable() {
	event.returnValue = false;
}

function radioRelation(radioId) {
	document.getElementById(radioId).checked = true;
}

function subWindow(specialId) {
	window.open('sub_window.asp?id=' + specialId, '', 'status=yes,scrollbars=yes,resizable=yes,width=720,height=600');
}

function trim(strValue) {
	if (strValue == null || typeof(strValue) == "undefined") {
		return "";
	}
	while (strValue.length > 0 && strValue.charAt(0) == ' ') {
		strValue = strValue.substring(1, strValue.length);
	}
	while (strValue.length > 0 && strValue.charAt(strValue.length-1) == ' ') {
		strValue = strValue.substring(0, strValue.length-1);
	}
	return strValue;
}

function isEmpty(strValue) {
	if(strValue == null || trim(strValue) == "" || typeof(strValue) == "undefined") {
		return true;
	}
	return false;
}

function isNumber(strValue, strType) {
	if (isEmpty(strValue)) {
		return true;
	}

	if (strType == 1) {
		var strExpression = /^(-[0-9]+|[0-9]+)(\.[0-9]+)?$/;
		if (strExpression.test(strValue)) {
			return true;
		} else {
			return false;
		}
	} else if(strType == 2) {
		var strExpression = /^([0-9]+)?$/;
		if (strExpression.test(strValue)) {
			return true;
		} else {
			return false;
		}
	} else if(strType == 3) {
		var strExpression = /^([0-9]+)(\.[0-9]+)?$/;
		if (strExpression.test(strValue)) {
			return true;
		} else {
			return false;
		}
	} else if(strType == 4) {
		var strExpression = /^(-[0-9]+)?$/;
		if (strExpression.test(strValue)) {
			return true;
		} else {
			return false;
		}
	} else {
		return false;
	}
}

function addComma(strValue, defaultValue) {
	strValue = ""+strValue;
	if (isEmpty(strValue)) {
		return defaultValue;
	}
	if (!isNumber(strValue, 1)) {
		return "";
	}
	strValue = strValue + "";
	var strNum = strValue.split(".");
	var strInt = "";
	if (strNum.length == 0) {
		return "";
	} else if (strNum.length > 2) {
		return "";
	} else {
		var i = strNum[0].length;
		while (i > 3) {
			i = i - 3;
			strInt = "," + strNum[0].substr(i,3) + strInt;
		}
		if (i != 0) {
			strInt = strNum[0].substring(0,i) + strInt;
		}
		if (strNum.length == 2) {
			strInt += "." + strNum[1];
		}
		return strInt;
	}
}

function delComma(strValue, defaultValue) {
	if (isEmpty(strValue)) {
		return defaultValue;
	}
	var strTemp = strValue.replace(/,/g,"");
	if (isNumber(strTemp, 1)) {
		return strTemp * 1;
	} else {
		return 0;
	}
}
