//画面右クリック有効設定
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 switchIndexCal() {	
	var currentDate = new Date();
    var year1, year2, month1, month2, day;
    var file1, file2;
    year1 = currentDate.getFullYear();    
    month1 = currentDate.getMonth() + 1;    
    day = currentDate.getDate();
    
    if (day < 15) {
    	year2 = year1;
    	month2 = month1;
    	month1--;
    	if (month1 == 0) {
    		month1 = 12;
    		year1--;
    	}    	
    } else {
    	year2 = year1;
    	month2 = month1 + 1;
    	if (month2 == 13) {
    		month2 = 1;
    		year2++;
    	}
    }
    
    if (month1 < 10) {
    	month1 = "0" + month1;
    }
    if (month2 < 10) {
    	month2 = "0" + month2;
    }
    year1 += '';
    year2 += '';
    file1 = year1.substring(2, 4) + month1;
    file2 = year2.substring(2, 4) + month2;
    //document.getElementById('calendar01').src = document.getElementById('calendar01').src.replace("0907", file1);    //document.getElementById('calendar02').src = document.getElementById('calendar02').src.replace("0908", file2);    document.getElementById('calendar01').src = "../img/common/top/ca_"+ file1 + ".gif";    document.getElementById('calendar02').src = "../img/common/top/ca_"+ file2 + ".gif";}

/**
 * ブラウザー種類を取得する.
 * 
 * @return ブラウザー種類 * 		0:不明
 * 		1:IE
 * 		2:Firefox
 * 		3:Google Chrome
 * 		4:Opera
 * 		5:Safari
 */
function browserType() {
	var  ua = navigator.userAgent.toLowerCase();
    if (window.ActiveXObject) {
        return 1;
    } else if (document.getBoxObjectFor) {
        return 2;
    } else if (window.MessageEvent && !document.getBoxObjectFor) {
        return 3;
    } else if (window.opera) {
        return 4; 
    } else if (window.openDatabase) {
        return 5;
    } else {
    	return 0;
    }
}

/**
 * お気に入り * @return 無し */
function addToFavorite() {
	var browser = browserType();
	if (broser == 1) {
		window.external.AddFavorite(parent.window.location.href, parent.window.document.title);
	} else if (broser == 2) {
		window.sidebar.addPanel(parent.window.document.title, parent.window.location.href, '')
	} else if (broser == 2) {
		window.sidebar.addPanel(parent.window.document.title, parent.window.location.href, '')
	}

}