function setcombo(){
len = document.goodsForm.gd_cate_url.options.length;
document.goodsForm.gd_cate_url.options[len] = new Option('label','value');	
}
/*レイヤーをオーブン
 * param id cssID
 */
function openPanelSet(id){
	document.getElementById(id).style.display = "block";
	
}
/*レイヤーをクローズ
 * param id cssID
 */
function closePanelSet(id){
	document.getElementById(id).style.display = "none";
	
}
/*サイトトップへジャンプ*/
function jumpHome(){
	var protocol = 'http://';
	var hostPath = location.host;
	var url = protocol + hostPath + '/index.html';
	location.href = url;
}

/*ウインドウ閉じる（FireFox対策）*/
function clsWin(){
    window.opener = window;
    var win = window.open(location.href,"_self");
    win.close();
}

//サブウィンドウ画面中央に表示
function open_subcwindow(url, name, wHeight, wWidth) {
    sWidth = screen.availWidth;
    sHeight = screen.availHeight;
    x = (sWidth - wWidth) / 2;
    y = (sHeight - wHeight) / 2;
    newWin = window.open(url, name, "width="+wWidth+",height="+wHeight);
    newWin.moveTo(x,y);
}
/*期間のチェック*/
function checkTerm(fromDate,toDate) {
	var error = "期間が正しくありません。修正してください";
	var from_array = fromDate.split("/");
	var to_array = toDate.split("/");
	
	var fromDay = new Date(from_array[0],from_array[1] - 1,from_array[2]);
	var toDay   = new Date(to_array[0],to_array[1] - 1,to_array[2]);
	if(fromDay.getTime() > toDay.getTime()) {
		alert(error);
		return false;
	} else {
		return true;
	}
}
/*URLへジャンプ*/
function setParamURL(inForm) {
	n = inForm.selectedIndex;
	location.href = inForm.options[n].value;	
}
/*削除前確認*/
function checkDeleteAction(obj) {
	if(confirm("データーを削除します")) {
		return true;
	} else {
		return false;
	}
}
/*URLチェック*/
function checkURL(inForm) { 
	txt = inForm.value;
	
	if(txt.length != 0) {
		data = txt.match(/http:\/\/.+/);
		
		if (!data) {
			flag=alert("URLが正しくありません");
			if(!flag) {
				inForm.focus();
				return	false;
			}
		}
	}
}
/*ﾒｰﾙアドレスチェック*/
function checkMailAd(inForm) { 
	txt = inForm.value;
	if(txt == "未設定"){
		return;
	} else if(txt != ""){
		data = txt.match(/^\S+@\S+\.\S+$/);
		if (!data) {
			alert("メールアドレスが正しくありません"); 
			inForm.focus();
			return false;
		}
	}
}
/*文字列中のスペース削除*/
function delspace(inForm) {

  var ojvalue = inForm.value ;
  inForm.value    = ojvalue.split(' ').join('').split('　').join('');

}
/*指定された文字をチェック*/
okstr = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
function checkStr(inForm){
str = inForm.value;
err = 0;
for (i=0;i<str.length;i++){
  if (okstr.indexOf(str.charAt(i)) == -1) err++;
}
if (err!=0) alert('空白スペースを削除してください');
}
/*正規表現（数値）*/
function checkNum(inForm) { 
	txt = inForm.value;
	if(txt != "" || txt != null) {
		data = txt.match(/[^0-9\/]/g); 
		if (data) {
			flag=alert("数値以外が含まれてます");
			inForm.focus();
		}
	}
}

/*テキストフィールドに数値以外入力できないようにする*/
function restrictNum(inForm){
	c = String.fromCharCode(event.keyCode); 
	if ("0123456789".indexOf(c,0) < 0) {
		alert("数値以外入力できません");	
		inForm.value="0";
		inForm.focus;
	}
}

/*Dispatch*/
/*client*/
function actionCLDispatch(inForm) {
	//Win
	if (document.all) {
		clientEntryForm.action.value=inForm;
		clientEntryForm.submit();
		return true;
	}
	//FireFox
	if (!document.all && document.getElementById) {
		document.clientEntryForm.action.value=inForm;
		document.clientEntryForm.submit();
		return true;		
	}
}
/*Member*/
function actionMemberDispatch(name) {
	//Win
	if (document.all) {
		memberEntryForm.action.value=name;
		memberEntryForm.submit();
		return true;
	}
	//FireFox
	if (!document.all && document.getElementById) {
		document.memberEntryForm.action.value=name;
		document.memberEntryForm.submit();
		return true;		
	}
}

function doCansel(inForm) {
	if(confirm("作業を中断します")) {
			return true;
	} else {
			return false;
	}
}

function confirmAction(name) {
	if(confirm(name + "を設定します")) {
			return true;
	} else {
			return false;
	}	
}
/*1-100までの入力範囲チェック*/
function checkScale(inForm) { 
	txt = inForm.value;
	var data = txt.match(/[^0-9]/gi);
	if (data) {
		alert("1-100の数字を入力してください"); 
		inForm.focus();
		return false;
	} else{
		if(txt <= 0){
			alert("1-100の数字を入力してください"); 
			inForm.focus();
			return false;			
		} else if(txt > 100) {
			alert("1-100の数字を入力してください"); 
			inForm.focus();
			return false;			
		}		
	} 
}	
/* keywordsearch */
function goSearch(){
	var param = document.freewordSearchForm.strValue.value;
	var param = param.replace(" ", "");	//余分なスペース削除
	if(param == ""){
		alert('キーワードを入力してください');
	} else {
		document.freewordSearchForm.submit();
	}
}
/**
 * 	パスワード認証
 *  @password パスワード
 */
function admitPW(password){
	var str = prompt("パスワードを入力してください","");
	if(str != password) {
		alert('パスワードが一致しません。トップページに移動します');
		var hostPath = location.host;
		var url = protocol + '//' + hostPath;
		location.href=url; 
	}
}
