function submitSendVal(anc, url, idVal) {
  var oAnc = Object(anc);
  var oTmp = oAnc.parentNode;
  while(oTmp.nodeName != "FORM") {
    oTmp = oTmp.parentNode;
  }
  var oForm = oTmp;
  if(idVal.length !=0) {
    oForm.buttonId.value=idVal;
  } else {
  	oForm.buttonId.value="00";
  }
  if(url.length != 0){
    if(url.indexOf("index.jsp") == -1 && url.charAt(url.length - 1) != "/") {
      url += "/";
    }
    oForm.action = url;
  }
  oForm.submit();
}

function deleteBarItem(_select) {
  for(var i =0; i < _select.options.length; i++) {
    if(_select.option[i].value == "-"){
      _select.removeChild(_select.option[i]);
    }
  }
}

function addStockMarkStyleOfSpanElement() {
  var stockElms = document.getElementsByTagName("span");
  var stockStr;
  
  for(var i = 0; i < stockElms.length; i++) {
    if(stockElms[i].className == "stockMarkStyle") {
      stockStr = stockElms[i].innerHTML;
      if(stockStr.indexOf("◎") != -1){
        stockElms[i].className = "style2";
      } else if(stockStr.indexOf("○") != -1) {
        stockElms[i].className = "style2";
      } else if(stockStr.indexOf("△") != -1) {
        stockElms[i].className = "style3";
      } else if(stockStr.indexOf("×") != -1) {
        stockElms[i].className = "style4";
      }
    }
  }
}

function alreadyDisplayed() {
  var executed = "executed";
  if(document.preventRedisplay.alreadyDisplay.value == executed) {
    return true;
  }
  document.preventRedisplay.alreadyDisplay.value = executed;
  return false;
}

/**
 * 2度押し対応　送信処理
 * @param anc
 * @param url
 * @param idVal
 */
function submitSendValOnce(anc, url, idVal){
	clickCnt += 1;
	if(clickCnt == 1) {
		var oAnc = Object(anc);
		var oTmp = oAnc.parentNode;
		while(oTmp.nodeName != "FORM") {
			oTmp = oTmp.parentNode;
		}
		var oForm = oTmp;
		if(url != null && url.length != 0) {
			oForm.action = url;
		}
		if(idVal != null && idVal.length != 0) {
			oForm.buttonId.value = idVal;
		}
		
		if (url != null && url.length > 0 && url.search("cata_order_form") >= 0) {
			// カタログ注文
			sendCataSycata();
		} else if (url != null && url.length > 0 && url.search("flier_order_res") >= 0) {
			// チラシ注文
			sendFilSycata();
		}
		
		oForm.submit();
	}
}

function setParameter(param_name1, param1, param_name2, param2){
	if(param_name1.length != 0){
		window.document.getElementById(param_name1).value = param1;
	}
	if(param_name2.length != 0){
		window.document.getElementById(param_name2).value = param2;
	}
}

function alterImage(imgElm, imgUrl) {
	imgElm.onerror = null;
	imgElm.src = imgUrl;
}

/*IE9_画面内の改行処理*/
//alert(navigator.userAgent);
function enableSanitaisedHTMLForIE9(){
    if(navigator.userAgent.indexOf("MSIE 9",0)!=-1){
		var elems=document.getElementsByClassName("resanitize");
         for (i = 0; i < elems.length; i++) {
            elems[i].innerHTML = elems[i].innerHTML.replace(/&lt;br&gt;/g, "<br>");
            elems[i].innerHTML = elems[i].innerHTML.replace(/&amp;lt;br&amp;gt;/g, "<br>");
/*            elems[i].innerHTML = elems[i].innerHTML.replace(/&#60;br&#62;/g, "<br>");   */
        }
    }    
}

function enableSanitaisedHTML(elm, targetElmName, targetTagName){
  var browser = navigator.appName;
  if(browser == "Microsoft Internet Explorer"){
    if(navigator.userAgent.indexOf("MSIE 9",0)!=-1){
        enableSanitaisedHTMLForIE9();
    }else{
        enableSanitaisedHTMLForIE(elm, targetElmName, targetTagName);
    }
  } else {
    enableSanitaisedHTMLForFF(targetElmName, targetTagName);
  }
}

function enableSanitaisedHTMLForFF(targetElmName, targetTagName){
  if(targetTagName == "br") {
    var targets = document.getElementsByName(targetElmName);
    for(var i = 0; i < targets.length; i++) {
      targets[i].innerHTML = targets[i].innerHTML.replace(/&lt;br&gt;/g, "<br>");
      targets[i].innerHTML = targets[i].innerHTML.replace(/&amp;lt;br&amp;gt;/g, "<br>");
    }
  }
}

function enableSanitaisedHTMLForIE(elm, targetElmName, targetTagName) {
  if(elm.name!=null&&elm.name==targetElmName) {
    if(targetTagName=="br") {
      elm.innerHTML = elm.innerHTML.replace(/&lt;br&gt;/g, "<br>");
      elm.innerHTML = elm.innerHTML.replace(/&amp;lt;br&amp;gt;/g, "<br>");
    }
  }
  var childs = elm.childNodes;
  for(var i = 0; i < childs.length; i++){
    enableSanitaisedHTMLForIE(childs[i], targetElmName, targetTagName);
  }
}

// 最低価格リストの選択値によって最高価格リストを再生成
function setMaxprice(selectedIndex){
	//子リストをクリアする。
	var _max_price_select=document.getElementById("input_max_price");
	// 現在選択中の最高価格を退避する
	var tmpPrice = _max_price_select.options[_max_price_select.selectedIndex].value;
	for(var m =0; m <_max_price_select.options.length;) {
		_max_price_select.removeChild(_max_price_select.options[m]);
	}
	//親リストの選択値を取得
	var _min_price_select=document.getElementById("input_min_price");
	var selectedvalue = _min_price_select.options[selectedIndex].value;
	//子リストを再生成
	insertOption("input_max_price","","制限なし");
	for(var i = 0 ; i < maxPriceArray.length; i++){
	 	if(selectedvalue < maxPriceArray[i][0]){
			insertOption("input_max_price",maxPriceArray[i][0],maxPriceArray[i][1]);
		}
	}
	// 退避した値を元に、子リストにカーソルを当てる
	_max_price_select=document.getElementById("input_max_price");
	for(var i=0; i < _max_price_select.options.length; i++) {
		if(_max_price_select.options[i].value == tmpPrice){
			_max_price_select.options[i].selected = true;
		}
	}
}

// 最高価格リストの選択値によって最低価格リストを再生成
function setMinprice(selectedIndex){
	//子リストをクリアする。
	var _min_price_select=document.getElementById("input_min_price");
	// 現在選択中の最低価格を退避する
	var tmpPrice = _min_price_select.options[_min_price_select.selectedIndex].value;
	for(var m =0; m <_min_price_select.options.length;) {
		_min_price_select.removeChild(_min_price_select.options[m]);
	}
	//親リストの選択値を取得
	var _max_price_select=document.getElementById("input_max_price");
	var selectedvalue = _max_price_select.options[selectedIndex].value;
	if(selectedvalue.length==0) {
		selectedvalue = 999999;
	}
	//子リストを再生成
	for(var i = 0 ; i < minPriceArray.length; i++){
	 	if(selectedvalue > minPriceArray[i][0]){
			insertOption("input_min_price",minPriceArray[i][0],minPriceArray[i][1]);
		}
	}
	// 退避した値を元に、子リストにカーソルを当てる
	_min_price_select=document.getElementById("input_min_price");
	for(var i=0; i < _min_price_select.options.length; i++) {
		if(_min_price_select.options[i].value == tmpPrice){
			_min_price_select.options[i].selected = true;
		}
    }
}

function getNumericValue(val) {
	var ret = 0;
	if(val != null && val.length != 0 && !isNaN(val)) {
		ret = parseInt(val);
	}
	return ret;
}
 

//ログイン用クッキーを初期化する
function loginCookieReset(){
	//ログインタイム作成
	var dt = '20090329000000';
	//クッキー有効期限設定
	var setCookieStr = 'login_time=' + dt + ';max-age=Mon , 29-Mar-2009 23:59:59 GMT';
	//クッキーパス設定
	setCookieStr += ';path=/';
	//クッキー書き込み
	document.cookie = setCookieStr;

	//ログイン回数作成
	//クッキー有効期限設定
	setCookieStr = 'login_count=0;max-age=Mon , 29-Mar-2009 23:59:59 GMT';
	//クッキーパス設定
	setCookieStr += ';path=/';
	//クッキー書き込み
	document.cookie = setCookieStr;
}


// 20100309追記
// 外出し対応複数画面共通ＪＳ


// ポップアップから次画面遷移する制御関数
function ex_GoWin(WO){
	window.location.href = WO;
}

// 表示スタイルセット関数
function ex_setStyle(styleType) {
    //検索結果一覧画面の場合
    if(ex_scid == "search_res") {
      document.form2.show_style.value = styleType;
    } else if(ex_scid == "m_cate") {
    //中カテの場合
      document.form0.show_style.value = styleType;
    } else if(ex_scid == "s_cate") {
    //小カテの場合
      document.form1.show_style.value = styleType;
    }
}

// 表示件数セット関数
function ex_setDefaultQuantity(quantIx){
    _select = document.getElementById("input_default_display_quantity");
    var quant = _select.options[quantIx].value;
    //検索結果一覧画面の場合
	if(ex_scid == "search_res") {
	  document.form2.default_display_quantity.value = quant;
	} else if(ex_scid == "m_cate") {
    //中カテの場合
      document.form0.default_display_quantity.value = quant;
    } else if(ex_scid == "s_cate") {
    //小カテの場合
      document.form1.default_display_quantity.value = quant;
    }
}

// カテゴリリセット関数
function ex_resetCategory() {
    //検索結果一覧画面の場合
    if(ex_scid == "search_res") {
      document.form2.category_id.value = "";
    } else if(ex_scid == "m_cate") {
    //中カテの場合
      document.form0.category_id.value = "";
    } else if(ex_scid == "s_cate") {
    //大カテの場合
      document.form1.category_id.value = "";
  }
}

//queryCountFlagを送信
function ex_setQueryCountFlag(){
    //検索結果一覧画面の場合
    if(ex_scid == "search_res") {
      document.form1.queryCountFlag.value= 1;
    } else if(ex_scid == "m_cate") {
    //中カテの場合
      document.form0.queryCountFlag.value= 1;
    } else if(ex_scid == "s_cate") {
    //小カテの場合
      document.form1.queryCountFlag.value= 1;
  }
}

// クリックカウントのクリア
function ex_clearClickCnt(){
	clickCnt = 0;
}

//価格帯プルダウン用
var ex_minPriceArray = new Array();
    ex_minPriceArray.push([0,"0"]);
	ex_minPriceArray.push([1000,"1,000"]);
	ex_minPriceArray.push([2000,"2,000"]);
	ex_minPriceArray.push([3000,"3,000"]);
	ex_minPriceArray.push([4000,"4,000"]);
	ex_minPriceArray.push([5000,"5,000"]);
	ex_minPriceArray.push([8000,"8,000"]);
	ex_minPriceArray.push([10000,"10,000"]);
	ex_minPriceArray.push([15000,"15,000"]);
	ex_minPriceArray.push([20000,"20,000"]);
	ex_minPriceArray.push([25000,"25,000"]);
	ex_minPriceArray.push([30000,"30,000"]);
	ex_minPriceArray.push([40000,"40,000"]);
	ex_minPriceArray.push([50000,"50,000"]);

	var ex_selectedMinPrice;
	
	var ex_maxPriceArray = new Array();
	ex_maxPriceArray.push([1000,"1,000"]);
	ex_maxPriceArray.push([2000,"2,000"]);
	ex_maxPriceArray.push([3000,"3,000"]);
	ex_maxPriceArray.push([4000,"4,000"]);
	ex_maxPriceArray.push([5000,"5,000"]);
	ex_maxPriceArray.push([8000,"8,000"]);
	ex_maxPriceArray.push([10000,"10,000"]);
	ex_maxPriceArray.push([15000,"15,000"]);
	ex_maxPriceArray.push([20000,"20,000"]);
	ex_maxPriceArray.push([25000,"25,000"]);
	ex_maxPriceArray.push([30000,"30,000"]);
	ex_maxPriceArray.push([40000,"40,000"]);
	ex_maxPriceArray.push([50000,"50,000"]);

	var ex_selectedMaxPrice;


//リストにオプションを挿入
function ex_insertOption(elementname,v,t) {
 var _option=document.createElement('option');
 _option.text=t;
 _option.value=v;
 
 var _select=document.getElementById(elementname);
 try {
  _select.add(_option,null); // standards compliant
 } catch(ex) {
  _select.add(_option); // IE only
 }
}


// 最低価格リストの選択値によって最高価格リストを再生成
function ex_setMaxprice(selectedIndex){
	//子リストをクリアする。
	var _max_price_select=document.getElementById("input_max_price");
	// 現在選択中の最高価格を退避する
	var tmpPrice = _max_price_select.options[_max_price_select.selectedIndex].value;
	for(var m =0; m <_max_price_select.options.length;) {
		_max_price_select.removeChild(_max_price_select.options[m]);
	}
	//親リストの選択値を取得
	var _min_price_select=document.getElementById("input_min_price");
	var selectedvalue = _min_price_select.options[selectedIndex].value;
	//子リストを再生成
	ex_insertOption("input_max_price","","制限なし");
	for(var i = 0 ; i < ex_maxPriceArray.length; i++){
	 	if(selectedvalue < ex_maxPriceArray[i][0]){
			ex_insertOption("input_max_price",ex_maxPriceArray[i][0],ex_maxPriceArray[i][1]);
		}
	}
	// 退避した値を元に、子リストにカーソルを当てる
	_max_price_select=document.getElementById("input_max_price");
	for(var i=0; i < _max_price_select.options.length; i++) {
		if(_max_price_select.options[i].value == tmpPrice){
			_max_price_select.options[i].selected = true;
		}
	}
}

// 最高価格リストの選択値によって最低価格リストを再生成
function ex_setMinprice(selectedIndex){
	//子リストをクリアする。
	var _min_price_select=document.getElementById("input_min_price");
	// 現在選択中の最低価格を退避する
	var tmpPrice = _min_price_select.options[_min_price_select.selectedIndex].value;
	for(var m =0; m <_min_price_select.options.length;) {
		_min_price_select.removeChild(_min_price_select.options[m]);
	}
	//親リストの選択値を取得
	var _max_price_select=document.getElementById("input_max_price");
	var selectedvalue = _max_price_select.options[selectedIndex].value;
	if(selectedvalue.length==0) {
		selectedvalue = 999999;
	}
	//子リストを再生成
	for(var i = 0 ; i < ex_minPriceArray.length; i++){
	 	if(selectedvalue > ex_minPriceArray[i][0]){
			ex_insertOption("input_min_price",ex_minPriceArray[i][0],ex_minPriceArray[i][1]);
		}
	}
	// 退避した値を元に、子リストにカーソルを当てる
	_min_price_select=document.getElementById("input_min_price");
	for(var i=0; i < _min_price_select.options.length; i++) {
		if(_min_price_select.options[i].value == tmpPrice){
			_min_price_select.options[i].selected = true;
		}
    }
}


// 配列のインデックス取得関数
function ex_getArrayIx(array, element) {
 var parentIx = 0;
 for(var i = 0; i < ex_minPriceArray.length; i++) {
 if(ex_minPriceArray[i][0] == element) {
  parentIx = i;
  break;
  }
 }
 return parentIx;
}

// 価格帯プルダウン生成
function ex_initPriceArray() {
  if(ex_scid == "m_cate") {
    selectedMinPrice = document.form0.min_price.value;
  } else if(ex_scid == "s_cate") {
    selectedMinPrice = document.form1.min_price.value;
  }
  if(selectedMinPrice.length = 0) {
    selectedMinPrice = 0;
  }
  
  if(ex_scid == "m_cate") {
    ex_selectedMaxPrice = document.form0.max_price.value;
  } else if(ex_scid == "s_cate") {
    ex_selectedMaxPrice = document.form1.max_price.value;
  }
  
  if(ex_selectedMaxPrice.length = 0) {
  ex_selectedMaxPrice = 0;
  }
  
  for(var i = 0 ; i < ex_minPriceArray.length ; i++){
  ex_insertOption("input_min_price",ex_minPriceArray[i][0],ex_minPriceArray[i][1]);
  }
  ex_insertOption("input_max_price", "", "制限なし");
  for(var i = 0 ; i < ex_maxPriceArray.length ; i++){
   if(selectedMinPrice < ex_maxPriceArray[i][0]){
    ex_insertOption("input_max_price",ex_maxPriceArray[i][0],ex_maxPriceArray[i][1]);
   }
  }
}


// 初期表示時に選択済みであったoptionにカーソルを当てる
function ex_initPriceSelected(){
 ex_setMaxprice(ex_getArrayIx(ex_minPriceArray, selectedMinPrice));
 var _selectParent=document.getElementById("input_min_price");
 for(var i = 0; i < _selectParent.length; i++){
  if(_selectParent.options[i].value == selectedMinPrice) {
   _selectParent.options[i].selected = true;
  }
 }
 var _selectChild=document.getElementById("input_max_price");
 for(var i = 0; i < _selectChild.length; i++) {
  if(_selectChild.options[i].value == ex_selectedMaxPrice) {
   _selectChild.options[i].selected = true;
  }
 }
}

// ページング実行関数
function ex_setPagenum(act) {
  var pageNum;
  if(ex_scid == "m_cate") {
    var curPageNum = document.form0.page_number.value;
  } else if(ex_scid == "s_cate") {
    var curPageNum = document.form1.page_number.value;
  }
  if(curPageNum == null){
    curPageNum = 1;
  } else if (curPageNum.length == 0) {
    curPageNum = 1;
  }
  if(act == "previous") {
    pageNum = curPageNum-1;
  } else if(act == "behind") {
    pageNum = curPageNum+1;
  } else {
    if(!isNaN(parseInt(act))) {
      pageNum = act;
   } else {
    pageNum = 1;
   }
  }
  if(ex_scid == "m_cate") {
    document.form0.page_number.value = pageNum;
    document.BottomPage.page_number.value = pageNum;
  } else if(ex_scid == "s_cate") {
    document.form1.page_number.value = pageNum;
  }
}


// 表示スタイルの初期化
function ex_initStyle(){
  if(ex_scid == "m_cate") {
    var styleType = document.form0.show_style.value;
  } else if(ex_scid == "s_cate") {
    var styleType = document.form1.show_style.value;
  }
  
 // 簡易表示
 if(styleType == null || styleType.length == 0 || styleType == "0") {
  document.getElementById("simple").style.display = "";
 // 詳細表示
 } else {
  document.getElementById("detail").style.display = "";
 }
}

// 絞込実行関数
function ex_setPrice() {
  if(ex_scid == "m_cate") {
    document.form0.min_price.value = document.form0.input_min_price.value;
    document.form0.max_price.value = document.form0.input_max_price.value;
    document.form0.price_search_flag.value = "1";
  } else if(ex_scid == "s_cate") {
    document.form1.min_price.value = document.form1.input_min_price.value;
    document.form1.max_price.value = document.form1.input_max_price.value;
    document.form1.price_search_flag.value = "1";
  }
    ex_setPageReset();
}


// ページングのリセット
function ex_setPageReset() {
  if(ex_scid == "m_cate") {
    document.form0.reset_flag.value = 1;
  } else if(ex_scid == "s_cate") {
    document.form1.reset_flag.value = 1;
  }
}

// 表示件数初期処理
function ex_setDispQuantSelected(){
  if(ex_scid == "m_cate") {
    var disp_quant = document.form0.default_display_quantity.value;
  } else if(ex_scid == "s_cate") {
    var disp_quant = document.form1.default_display_quantity.value;
  }
  var oSelect = document.getElementsByName("input_default_display_quantity")[0];
  for(var i = 0; i < oSelect.options.length; i++){
   if(oSelect.options[i].value == disp_quant){
    oSelect.options[i].selected = true;
   }
  }
}

// ページ番号を空にする関数
function ex_setEmptyPageNumber(){
  if(ex_scid == "m_cate") {
    document.form0.page_number.value="";
  } else if(ex_scid == "s_cate") {
    document.form1.page_number.value="";
  }
}

// テキスト内のEnterキー押下でactionとbuttonIdをセット
function ex_textEnterSendVal(anc, url, idVal) {
  var oAnc = Object(anc);
  var oTmp = oAnc.parentNode;
  while(oTmp.nodeName != "FORM") {
    oTmp = oTmp.parentNode;
  }
  var oForm = oTmp;
  if(idVal.length !=0) {
    oForm.buttonId.value=idVal;
  } else {
   oForm.buttonId.value="00";
  }
  if(url.length != 0){
    oForm.action = url;
  }
  // submitは自動で実行されるので記述しない
}


// 20100309追記
// 外出し対応_キーワード検索結果画面用ＪＳ



// 最低価格リストの選択値によって最高価格リストを再生成
function ex_setMaxprice_Searchres(selectedIndex){
	//子リストをクリアする。
	var _max_price_select=document.getElementById("input_max_price");
	// 現在選択中の最高価格を退避する
	var tmpPrice = _max_price_select.options[_max_price_select.selectedIndex].value;
	for(var m =0; m <_max_price_select.options.length;) {
		_max_price_select.removeChild(_max_price_select.options[m]);
	}
	//親リストの選択値を取得
	var _min_price_select=document.getElementById("input_min_price");
	var selectedvalue = _min_price_select.options[selectedIndex].value;
	//子リストを再生成
	ex_insertOption("input_max_price","","制限なし");
	for(var i = 0 ; i < ex_maxPriceArray.length; i++){
	 	if(selectedvalue < ex_maxPriceArray[i][0]){
			ex_insertOption("input_max_price",ex_maxPriceArray[i][0],ex_maxPriceArray[i][1]);
		}
	}
	// 退避した値を元に、子リストにカーソルを当てる
	_max_price_select=document.getElementById("input_max_price");
	for(var i=0; i < _max_price_select.options.length; i++) {
		if(_max_price_select.options[i].value == tmpPrice){
			_max_price_select.options[i].selected = true;
		}
	}
}

// 最高価格リストの選択値によって最低価格リストを再生成
function ex_setMinprice_Searchres(selectedIndex){
	//子リストをクリアする。
	var _min_price_select=document.getElementById("input_min_price");
	// 現在選択中の最低価格を退避する
	var tmpPrice = _min_price_select.options[_min_price_select.selectedIndex].value;
	for(var m =0; m <_min_price_select.options.length;) {
		_min_price_select.removeChild(_min_price_select.options[m]);
	}
	//親リストの選択値を取得
	var _max_price_select=document.getElementById("input_max_price");
	var selectedvalue = _max_price_select.options[selectedIndex].value;
	if(selectedvalue.length==0) {
		selectedvalue = 999999;
	}
	//子リストを再生成
	for(var i = 0 ; i < ex_minPriceArray.length; i++){
	 	if(selectedvalue > ex_minPriceArray[i][0]){
			ex_insertOption("input_min_price",ex_minPriceArray[i][0],ex_minPriceArray[i][1]);
		}
	}
	// 退避した値を元に、子リストにカーソルを当てる
	_min_price_select=document.getElementById("input_min_price");
	for(var i=0; i < _min_price_select.options.length; i++) {
		if(_min_price_select.options[i].value == tmpPrice){
			_min_price_select.options[i].selected = true;
		}
	}
}



// 価格帯プルダウン生成
function ex_initPriceArray_Searchres(){
		ex_selectedMinPrice_Searchres = document.form2.min_price.value;
	if(ex_selectedMinPrice_Searchres == null || ex_selectedMinPrice_Searchres.length == 0) {
		ex_selectedMinPrice_Searchres = 0;
	}
	ex_selectedMaxPrice = document.form2.max_price.value;
	if(ex_selectedMaxPrice == null || ex_selectedMaxPrice.length == 0) {
		ex_selectedMaxPrice = 0;
	}
	for(var i = 0 ; i < ex_minPriceArray.length ; i++){
		ex_insertOption("input_min_price",ex_minPriceArray[i][0],ex_minPriceArray[i][1]);
		}
		ex_insertOption("input_max_price", "", "制限なし");
		for(var i = 0 ; i < ex_maxPriceArray.length ; i++){
			if(ex_selectedMinPrice_Searchres < ex_maxPriceArray[i][0]){
				ex_insertOption("input_max_price",ex_maxPriceArray[i][0],ex_maxPriceArray[i][1]);
			}
		}
}

// 初期表示時に選択済みであったoptionにカーソルを当てる
function ex_initPriceSelected_Searchres(){
	ex_setMaxprice_Searchres(ex_getArrayIx(ex_minPriceArray, ex_selectedMinPrice_Searchres));
	var _selectParent=document.getElementById("input_min_price");
	for(var i = 0; i < _selectParent.length; i++){
		if(_selectParent.options[i].value == ex_selectedMinPrice_Searchres) {
			_selectParent.options[i].selected = true;
		}
	}
	var _selectChild=document.getElementById("input_max_price");
	for(var i = 0; i < _selectChild.length; i++) {
		if(_selectChild.options[i].value == ex_selectedMaxPrice) {
			_selectChild.options[i].selected = true;
		}
	}
}

// 初期表示件数初期値セット関数
function ex_initDispQuantity_Searchres() {
	var quant = document.form2.default_display_quantity.value;
	if(quant != null && quant.length != 0) {
		var _quantSelect = document.getElementById("input_default_display_quantity");
		for(var i = 0; i < _quantSelect.options.length; i++){
			if(_quantSelect.options[i].value == quant){
				_quantSelect.options[i].selected = true;
			}
		}
	}
}
// ページセット関数
function ex_setPagenum_Searchres(pageNum){
	document.form2.page_number.value = pageNum;
}

// 絞込実行関数
function ex_setPrice_Searchres() {
	document.form2.min_price.value = document.form2.input_min_price.value;
	document.form2.max_price.value = document.form2.input_max_price.value;
}


// カテゴリーセット関数
function ex_setCategory(catId) {
	document.form2.category_id.value = catId;
}

// ページ番号リセット関数
function ex_resetPage(){
	document.form2.page_number.value = "";
}

// 価格帯絞込リセット関数
function ex_resetPrice(){
	document.form2.min_price.value = "";
	document.form2.max_price.value = "";
}

// サイズリセット関数
function ex_resetSize() {
	document.form2.size.value = "";
}


// 価格、カテゴリ、サイズ、ページ番号の全てをリセット
function ex_resetAll(){
	ex_resetPrice();
	ex_resetCategory();
	ex_resetSize();
	ex_resetPage();
}

// 初期処理
function ex_dispInit_Searchres() {
	ex_initPriceArray_Searchres();
	ex_initPriceSelected_Searchres();
	ex_initDispQuantity_Searchres();
	//showPopup();
}

// カテゴリのセットとサブミット実行
function ex_submitSendCategory(url, category, button_id) {
	if(url != null && url.length != 0) {
		document.form2.action = url;
	}
	if(category != null && category.length != null) {
		ex_setCategory(category);
	}
	if(button_id != null && button_id.length != 0) {
		document.form2.buttonId.value = button_id;
	}
	document.form2.submit();
}

// ソートフラグをセット
function ex_setSortFlag(sortFlag) {
	document.form2.sort_flag.value=sortFlag;
}

// 初期処理
function ex_dispInit_Mcate() {
 ex_setDispQuantSelected();
 ex_initStyle();
 ex_initPriceArray();
 ex_initPriceSelected();
 //showPopup();
}


// 20100308追記
// 外出し対応_各種小カテゴリ一覧画面用ＪＳ

// 初期処理
function ex_dispInit_Scate() {
 ex_setDispQuantSelected();
 ex_initStyle();
 ex_initPriceArray();
 ex_initPriceSelected();
 //showPopup();
}



// 20100324追記
// 外出し対応複数画面共通ＪＳ

// プルダウンアイテム配列中の選択されているインデックスを返します
function ex_findSelectedIndex(arr){
	var retVal = "";
	if(arr!=null && arr.length > 0) {
		for(var i = 0; i < arr.length; i++) {
			if(arr[i].length == 3){
				if(arr[i][2] != null && arr[i][2] == "1"){
						retVal = i;
				}
			} else if(arr[i].length == 4) {
				if(arr[i][3] != null && arr[i][3] == "1"){
						retVal = i;
				}
			}
		}
	}
	return retVal;
}

// プルダウンアイテム配列中の選択されているvalueを返します
function ex_findSelectedValue(arr){
	var retVal = "";
	if(arr!=null && arr.length > 0) {
		for(var i = 0; i < arr.length; i++) {
			if(arr[i].length == 3){
				if(arr[i][2] != null && arr[i][2] == "1"){
						retVal = arr[i][0];
				}
			} else if(arr[i].length == 4) {
				if(arr[i][3] != null && arr[i][3] == "1"){
						retVal = i;
				}
			}
		}
	}
	return retVal;
}

// 全セレクトボックスをセット
function ex_initAllSelect(){
	ex_initDeferredInfo();		// 後払い請求情報
	ex_initRegCreditInfo();	 // 登録済みカード情報
	ex_initCreditInfo();			// カード選択情報
}

//初期表示
function ex_initDisplay_AddPayspec(){
	ex_initAllSelectAddPayspec();
	ex_initRegCheck();
	ex_windowScroll_Payspec();
}
//全セレクトボックスをセット
function ex_initAllSelectAddPayspec(){
	ex_initDeferredInfoAddPayspec();	// 後払い請求情報
	ex_initRegCreditInfo();	 // 登録済みカード情報
	ex_initCreditInfo();			// カード選択情報
}
function ex_initDeferredInfoAddPayspec(){
	// 後払い支払い回数
	if(deferred_charge_address_size == 1 || deferred_charge_address_size == 2){
		ex_setOptions("deferred_installment_months", deferred_installment_months_array, selected_deferred_installment_months_value, "--");
	}
}

/**
 * ご請求先情報 、時間指定、日時指定情報セレクトボックス、代金引換ラジオボタンをセット
 * */ 
function ex_initOzAddPaySpecSelect(){
	var destTypeValue = findSelectedRadioValue(document.getElementsByName("delivery_dest_type"));
	ex_setDeferredChargeAddOz(destTypeValue);						// ご請求先セレクトボックス(オージオ)
	var dTimezoneFlg = ex_initDeliveryTime(destTypeValue);		// お届け希望指定時間セレクトボックス(オージオ)
	ex_initPaymentRadio(destTypeValue, dTimezoneFlg);			// 代金引換ラジオボタン
}

/**
 * ご請求先情報 、時間指定、日時指定情報セレクトボックス、代金引換ラジオボタンをセット
 * */ 
function ex_initAddPaySpecSelect(genre){
	var destTypeValue = findSelectedRadioValue(document.getElementsByName("delivery_dest_type"));
	var dTimezoneFlg='1';
	// 現状オージオとベルーナのみ画面機能実装
	if(genre == "011101" || genre == "011201" ){
		ex_setDeferredChargeAddOz(destTypeValue);					// ご請求先セレクトボックス(オージオ)
		dTimezoneFlg = ex_initDeliveryTime(destTypeValue);		// お届け希望指定時間セレクトボックス(オージオ)
	} else{
		ex_setDeferredChargeAdd(destTypeValue);						// ご請求先
		dTimezoneFlg = ex_initAddSpecInfo(destTypeValue);		// 時間指定、日時指定セレクトボックス
	}
	ex_initPaymentRadio(destTypeValue, dTimezoneFlg);			// 代金引換ラジオボタン
}

/**
 * 選択されているラジオボタンのvalueを返却
 * */
function findSelectedRadioValue(ary) {
	for(var i = 0; i < ary.length; i++){
		if(ary[i].checked){
			return ary[i].value;
		}
	}
}

/**
 * 代金引換ラジオボタンを設定
 * */
function ex_initPaymentRadio(destTypeValue, dTimezoneFlg){
	var obj = document.getElementById("06");
	if( obj ){
		var disableFlg = false;
		if(dTimezoneFlg != "0"){
			disableFlg = true;
		}
		if(destTypeValue != "A" && destTypeValue != "B"){
			disableFlg = true;
		}
		
		if(disableFlg){
			obj.disabled = true;
			obj.checked = false;
		} else {
			obj.disabled = false;
		}
	}

}

/**
 * ご請求先情報プルダウンを設定。(オージオ)
 * */
function ex_setDeferredChargeAddOz(destType){

	if(deferred_charge_address_size == 1 || deferred_charge_address_size == 2){

		var _span = document.getElementById("deferred_charge_address_type_span");
		var childs = _span.childNodes;
		for( var i=childs.length-1; i >= 0; i--){
			_span.removeChild(_span.childNodes.item(i));
		}
		if(destType == "B"){
			var optionAry = new Array();
			optionAry.push(["1","自宅",""]);
			optionAry.push(["2","勤務先",""]);

			selectedIdx = 1
			if( selected_deferred_charge_address_type == "0"){
				selectedIdx = 0;
			}
			ex_setDeferredOptions("deferred_charge_address_type_span", "deferred_charge_address_type", optionAry, selectedIdx,"");
		}else{
			ex_setDeferredLabelValue("deferred_charge_address_type_span", "1", "自宅");
		}
	}
}

/**
 * 勤務先に選択変更された場合にご請求先情報で勤務先を選択(オージオ)
 * */
function ozSelectedIdx(){

	if(deferred_charge_address_size == 1 || deferred_charge_address_size == 2){
		ex_addSelectedOption("deferred_charge_address_type", 1);
	}
}


/**
 * ご請求先情報を設定。
 * */
function ex_setDeferredChargeAdd(destType){
	if(deferred_charge_address_size == 1 || deferred_charge_address_size == 2){
		var _span = document.getElementById("deferred_charge_address_type_span");
		var childs = _span.childNodes;
		for( var i=childs.length-1; i >= 0; i--){
			_span.removeChild(_span.childNodes.item(i));
		}
		if(destType == "B"){
			ex_setDeferredLabelValue("deferred_charge_address_type_span", "2", "勤務先");
		}else{
			ex_setDeferredLabelValue("deferred_charge_address_type_span", "1", "自宅");
		}
	}
}


/**
 * お届け時間指定プルダウンを設定。
 * */
function ex_initAddSpecInfo(destType) {
	var nameKey = "";
	if(destType == "A"){
		nameKey = "home_d_timezone_flag";
	}else if(destType == "B"){
		nameKey = "office_d_timezone_flag";
	}else{
		nameKey = "d_timezone_flag_" + destType;
	}
	//お届け時間帯指定不可区分 0:可、1:不可
	var dTimezoneFlg = document.getElementsByName(nameKey)[0].value;
	
	//プルダウンオブジェクト
	var delivery_price = document.getElementsByName("delivery_price")[0];
	var delivery_expect_day = document.getElementsByName("delivery_expect_day")[0];
	var delivery_expect_time = document.getElementsByName("delivery_expect_time")[0];

	// 時間帯指定（無料）
	if(delivery_price){
		if(dTimezoneFlg == "0"){
			delivery_price.disabled = false;
		}else{
			delivery_price.disabled = true;
			//選択値を初期化
			delivery_price.options[0].selected = true;
		}
	}
	// 日時指定（有料）
	if(delivery_expect_day){
		if(dTimezoneFlg == "0"){
			delivery_expect_day.disabled = false;
			delivery_expect_time.disabled = false;
		}else{
			delivery_expect_day.disabled = true;
			delivery_expect_time.disabled = true;
			//選択値を初期化
			delivery_expect_day.options[0].selected = true;
			delivery_expect_time.options[0].selected = true;
		}
	}
	
	return dTimezoneFlg;
}
/**
 * お届け希望指定時間プルダウンを設定。（オージオ）
 * */
function ex_initDeliveryTime(destType) {
	var nameKey = "";
	if(destType == "A"){
		nameKey = "home_d_timezone_flag";
	}else if(destType == "B"){
		nameKey = "office_d_timezone_flag";
	}else{
		nameKey = "d_timezone_flag_" + destType;
	}
	//お届け時間帯指定不可区分 0:可、1:不可
	var dTimezoneFlg = document.getElementsByName(nameKey)[0].value;
	
	//プルダウンオブジェクト
	var delivery_price = document.getElementsByName("delivery_price")[0];
	//ラジオボタン
	var delivery_time_type = document.getElementsByName("delivery_time_type");
	
	if(dTimezoneFlg == "0"){
		delivery_price.disabled = false;
		delivery_time_type[1].disabled = false;
	}else{
		delivery_price.disabled = true;
		//選択値を初期化
		delivery_price.options[0].selected = true;
		delivery_time_type[0].checked = true;
		delivery_time_type[1].disabled = true;
	}

	return dTimezoneFlg;
}

// 後払い請求情報初期関数
function ex_initDeferredInfo() {
	if(deferred_charge_address_size == 1) {
		// 後払い支払い回数
		ex_setOptions("deferred_installment_months", deferred_installment_months_array, selected_deferred_installment_months_value, "--");
		ex_setDeferredLabelValue("deferred_charge_address_type_span", deferred_charge_address_type_array[0][0], deferred_charge_address_type_array[0][1]);
	} else if (deferred_charge_address_size == 2) {
		// 後払い支払い回数
		ex_setOptions("deferred_installment_months", deferred_installment_months_array, selected_deferred_installment_months_value, "--");
		// 請求先
		ex_setDeferredOptions("deferred_charge_address_type_span", "deferred_charge_address_type", deferred_charge_address_type_array, selected_deferred_charge_address_type,"");
	}
}

// 登録済みカード情報初期関数
function ex_initRegCreditInfo() {
	if(payment_method_flag2 == 1) {
		// 登録済みカード
		ex_setOptions("reg_partial_credit_card_number", reg_partial_credit_card_number_array, selected_reg_partial_credit_card_number, "登録済みカードを選択してください");
		ex_addSelectedOption("reg_partial_credit_card_number", selected_reg_partial_credit_card_number);
		// 登録済みカード支払い回数
		ex_setChild_Payspec("reg_installment_months", reg_installment_months_array, ex_findSelectedValue(reg_partial_credit_card_number_array), "--");
		ex_addSelectedOption("reg_installment_months", ex_howNumberPartArray(reg_installment_months_array,selected_reg_installment_months));
		// 登録済みカード支払い回数(月)
		ex_setOptions("reg_credit_card_valid1", reg_credit_card_valid1_array, selected_reg_credit_card_valid1, "--");
		ex_addSelectedOption("reg_credit_card_valid1", selected_reg_credit_card_valid1);
		// 登録済みカード支払い回数(年)
		ex_setOptions("reg_credit_card_valid2", reg_credit_card_valid2_array, selected_reg_credit_card_valid2, "----");
		ex_addSelectedOption("reg_credit_card_valid2", selected_reg_credit_card_valid2);
	}
}

// カード選択情報初期関数
function ex_initCreditInfo() {
	if(payment_method_flag3 == 1) {
		// カード選択
		ex_setOptions("credit_office_name", credit_office_name_array, selected_credit_office_name, "クレジットカードを選択してください");
		// カード選択支払い回数
		ex_setChild_Payspec("installment_months", installment_months_array, ex_findSelectedValue(credit_office_name_array), "--");
		ex_addSelectedOption("installment_months", ex_howNumberPartArray(installment_months_array, selected_installment_months));
		// カード支払い回数(月)
		ex_setOptions("credit_card_valid1", credit_card_valid1_array, selected_credit_card_valid1, "--");
		// カード支払い回数(年)
		ex_setOptions("credit_card_valid2", credit_card_valid2_array, selected_credit_card_valid2, "----");
	}
}

// 請求先ラベルセット
function ex_setDeferredLabelValue(parentElmName, _value, _label) {
	var _span = document.getElementById(parentElmName);
	var _text = document.createTextNode(_label);
	var _hidden = document.createElement("input");
	_hidden.type = "hidden";
	_hidden.name = "deferred_charge_address_type";
	_hidden.value = _value;
	_span.appendChild(_text);
	_span.appendChild(_hidden);
}

// 請求先セレクトセット
function ex_setDeferredOptions(parentElmName, selfElmName, array, selfSelectedIx, prompt) {
	var _span = document.getElementById(parentElmName);
	var _select = document.createElement("select");
	_select.name = selfElmName;
	_select.id = selfElmName;
	_select.className = "center_line";
	_span.appendChild(_select);
	ex_setOptions(selfElmName, array, selfSelectedIx, prompt);
}

// 誘導文章を先頭に、指定したセレクトボックスのoptionをセットする関数
function ex_setOptions(selectName, array, selectedIx, promptItem) {
	if(promptItem.length != 0) {
		ex_insertOption_Payspec(selectName, "－", promptItem);
	}
	for(var i = 0; i < array.length; i++) {
		ex_insertOption_Payspec(selectName, array[i][0], array[i][1]);
	}
	ex_addSelectedOption(selectName, selectedIx);
}

// 指定したIDのセレクトボックスのオプション要素にselected属性を付加する
function ex_addSelectedOption(selectId, selectedIx){
	var _select = document.getElementById(selectId);
	// 初期表示時には selectedIx は空
	if(selectedIx == null){
		selectedIx = 0;
	} else if(selectedIx.length == 0) {
		selectedIx = 0;
	} else if(isNaN(selectedIx)) {
		selectedIx = 0;
	} else if(_select.options.length > 0 && _select.options[0].value == "－" && _select.options[1] != null) {
		selectedIx = parseInt(selectedIx) + 1;
	}
	if(selectedIx != null && selectedIx.length != 0) {
		_select.options[selectedIx].selected = true;
	}
}

// カード登録チェックボックスの初期化
function ex_initRegCheck(){
	if(reg_partial_credit_card_size >= 10) {
		document.form1.reg_credit_card.disabled = true;
	}else if(selected_reg_credit_card != null && selected_reg_credit_card.length != 0 && selected_reg_credit_card == "1") {
		document.form1.reg_credit_card.checked = true;
	}
}

// クレジットカード配列と、その配列のインデックスを指定する。
// 両者により決定される要素配列が持つカードid（カード配列の子配列第1要素）に
// 属する部分配列中で、その要素配列が何番目かを返却する。
function ex_howNumberPartArray(longarr, longarrIx){
	var retnum = 0;
	if(longarr != null && longarrIx != null && longarrIx.length != 0) {
		var targetCardId = longarr[longarrIx][0];
		var targetVal = longarr[longarrIx][1];
		
		// 取得したカードIDに属する要素配列のvalueを要素とする部分配列を作成する
		// （処理は遅くなるが分かりやすさ重視）
		var partArr = new Array();
		for(var i = 0; i < longarr.length; i++) {
			if(longarr[i][0] == targetCardId) {
				partArr.push(longarr[i][1]);
			}
		}
		
		// 部分配列中のインデックスを取得
		for(var i = 0; i < partArr.length; i++){
			if(partArr[i]  == targetVal){
				retnum = i;
				break;
			}
		}
	}
	return retnum;
}

// ポップアップ終了関数
function ex_closePopup()
{
	clearTimeout( objTimerID );
	document.getElementById( 'nonframe-msg-wnd' ).style.visibility = 'hidden';
	document.getElementById( 'nonframe-msg-wnd-btn' ).style.visibility = 'hidden';
	document.getElementById( 'guard-wnd' ).style.visibility = 'hidden';
	window.document.form1.is_chk_key.value = 0;
    if(ex_scid == "mem_reg") {	
	  document.form1.list_year.disabled = false;
	  document.form1.list_month.disabled = false;
	  document.form1.list_day.disabled = false;
	  if(document.form1.list_address != null) {
	  	document.form1.list_address.disabled = false;
	  }
	}
}

// 市町村字・丁目のIF文
function ex_setAddressInfo(){
	if( _address_list_size != null && _address_list_size.length != 0 && _address_list_size != "0" ) {
		var oAddress_info = document.getElementById("address_info");
		// 要素数が1の時にはラベル
		if( _address_list_size == "1" ){
			var addressTxt = address_array[0][1] + "<input type='hidden' name='list_address' value='" + address_array[0][0] + "' />";
			oAddress_info.innerHTML = addressTxt;
		}
	    if(ex_scid == "mem_reg" || ex_scid == "employ_reg") {	
		  document.form1.ken_name.value=address_array[0][3];
		}
	}
}

// リストの初期値をセット
function ex_setInitSelected(_selectId, arr) {
	var _select = document.getElementById(_selectId);
	var selectedIx = "0";
	for(var i = 0; i < arr.length; i++) {
		if(arr[i][2] != null && arr[i][2].length != 0 && arr[i][2] == "1" ) {
			selectedIx = i;
		}
	}
	_select.options[selectedIx].selected = true;
}


// 番地入力フォームが空欄のとき、「番地なし」と記入する
function ex_checkSt_Add1(){
	var val = str_add1;
	if(st_add1_err != null && st_add1_err.length != 0){
		if (val == null) {
		document.form1.street_address1.value = "番地なし";
		} else if(val != null && val.length == 0) {
		document.form1.street_address1.value = "番地なし";
		} else {
		}
	}
}

//パスワード変更フラグ
function ex_checkPasswordReminder(index){
	if (index == 1) {
		if (document.form1.dummypassword.length != 0 && document.form1.dummypassword.value != null) {
			document.form1.password_update_flag.value = "1";
			if (document.form1.password_update_flag.value == "1") {
				document.form1.password.value = document.form1.dummypassword.value;
				document.form1.re_password.value = document.form1.dummyre_password.value;
			}
		}
	} else if (index == 2) {
		if (document.form1.dummyre_password.length != 0 && document.form1.dummyre_password.value != null) {
			document.form1.password_update_flag.value = "1";
			if (document.form1.password_update_flag.value == "1") {
				document.form1.password.value = document.form1.dummypassword.value;
				document.form1.re_password.value = document.form1.dummyre_password.value;
			}
		}
	} else if(document.form1.password_update_flag.value == "1") {
		document.form1.password.value = document.form1.dummypassword.value;
		document.form1.re_password.value = document.form1.dummyre_password.value;
	} else {
		document.form1.password.value = "dummy";
		document.form1.re_password.value = "dummy";
	}
}

// 20100324追記
// 外出し対応_支払い方法指定

// 親リストの選択値によって子リストを再生成
function ex_setChild_Payspec(childSelectName, childArray, parentSelectedValue, promptItem){
	// 子リストをクリアする。
	var _child_select=document.getElementById(childSelectName);
	for(var m =0; m <_child_select.options.length;) {
		_child_select.removeChild(_child_select.options[m]);
	}
	
	// 初期表示時のインデクス
    if(parentSelectedValue.length == 0) {
	parentSelectedValue = "0:0";
    }

	// 親リストの選択値を取得(親リストのvalue形式は "id:label")
	var parentVal = parentSelectedValue.split(":")[0];
	
	//子リストを再生成
	ex_insertOption_Payspec(childSelectName, "－", promptItem);
	for(var i = 0 ; i < childArray.length; i++){
		if(childArray[i][0] == parentVal){
			ex_insertOption_Payspec(childSelectName, childArray[i][1], childArray[i][2]);
		}
	}
}

//リストにオプションを挿入
function ex_insertOption_Payspec(elementname,v,t) {
	var _option=document.createElement('option');
	_option.text=t;
	_option.value=v;

	var _select=document.getElementById(elementname);
	try {
		_select.add(_option,null); // standards compliant
	} catch(ex) {
		_select.add(_option); // IE only
	}
}

// 指定した要素を格納した配列のインデックスを返却する
function ex_getArrayIx_Payspec(array, val) {
	var ix = 0;
	if(array.length == 3) {
		for(var i = 0; i < array.length; i++) {
			if(array[i][0] == val) {
				ix = i;
				break;
			}
		}
	} else if(array.length == 4) {
		for(var i = 0; i < array.length; i++) {
			if(array[i][0] == val) {
				ix = i;
				break;
			}
		}
	}
	return ix;
}

// 指定した位置までスクロール
function ex_windowScroll_Payspec(){
	if (selectLinkFlag == 1) {
		window.scrollTo(0,890);
	} else if (selectLinkFlag == 2) {
		window.scrollTo(0,1050);
	}
}

// 初期表示
function ex_initDisplay_Payspec() {
	ex_initAllSelect();
	ex_initRegCheck();
	ex_windowScroll_Payspec();
}


// 20100324追記
// 外出し対応_会員登録


// ポップアップ表示判定関数
function ex_checkDispPopup_Memreg()
{
	flg = window.document.form1.is_chk_key.value;
	if ( flg == 1 ) {
		ex_showPopup_Memreg();
		window.document.form1.is_chk_key.value = 0;
	} 
	else if ( flg == 2 ) {
		ex_showPopup_Memreg();
		window.document.form1.is_chk_key.value = 0;
	} else {
	}
}

// ポップアップ表示関数
function ex_showPopup_Memreg()
{

	document.getElementById( 'nonframe-msg-wnd' ).style.visibility = 'visible';
	document.getElementById( 'nonframe-msg-wnd-btn' ).style.visibility = 'visible';
	document.form1.list_year.disabled = true;
	document.form1.list_month.disabled = true;
	document.form1.list_day.disabled = true;
	if(document.form1.list_address != null) {
		document.form1.list_address.disabled = true;
	}

	if (document.body.clientWidth < document.body.scrollWidth ) {
		document.getElementById( 'guard-wnd' ).style.width = document.body.scrollWidth + 'px';
	} else {
		document.getElementById( 'guard-wnd' ).style.width = document.body.clientWidth + 'px';
	}
	if (document.documentElement.clientHeight < document.body.scrollHeight ) {
		document.getElementById( 'guard-wnd' ).style.height = document.body.scrollHeight + 'px';
	} else {
		document.getElementById( 'guard-wnd' ).style.height = document.body.clientHeight + 'px';
	}
	document.getElementById( 'guard-wnd' ).style.visibility = 'visible';

	objTimerID = setTimeout( "ex_closePopup();", 1000*10 );
}

// リストにオプションを挿入
function ex_insertOption_Memreg(elementname,v,t) {
	var _option=document.createElement("option");
	_option.text=t;
	_option.value=v;
	
	var _select=document.getElementById(elementname);
	try {
		_select.add(_option,null); // standards compliant
	} catch(ex) {
		_select.add(_option); // IE only
	}
}

// リストの初期値をセット
function ex_setInitSelected_Memreg(address_array, _selectId) {
 var _select = document.getElementById("list_address");
 if(_select != null && _select.length != 0){
  for(var i = 0; i < _select.length; i++) {
   if(_select.options[i].value == _selectId) {
    _select.options[i].selected = true;
   }
  }
 }
}

// 20100324
// 外出し対応_会員情報修正


// リストにオプションを挿入
function ex_insertOption_Memmod(elementname,v,t) {
	var _option=document.createElement("option");
	_option.text=t;
	_option.value=v;
	
	var _select=document.getElementById(elementname);
	try {
		_select.add(_option,null); // standards compliant
	} catch(ex) {
		_select.add(_option); // IE only
	}
}

// ポップアップ表示判定関数
function ex_checkDispPopup_Memmod()
{
	flg = window.document.form1.is_chk_key.value;
		if ( flg == 1 ) {
		ex_showPopup_Memmod();
		} 
		else if ( flg == 2 ) {
		ex_showPopup_Memmod();
		} else {
		}
}
// ポップアップ表示関数
function ex_showPopup_Memmod()
{

	document.getElementById( 'nonframe-msg-wnd' ).style.visibility = 'visible';
	document.getElementById( 'nonframe-msg-wnd-btn' ).style.visibility = 'visible';

	if (document.body.clientWidth < document.body.scrollWidth ) {
		document.getElementById( 'guard-wnd' ).style.width = document.body.scrollWidth + 'px';
	} else {
		document.getElementById( 'guard-wnd' ).style.width = document.body.clientWidth + 'px';
	}
	if (document.documentElement.clientHeight < document.body.scrollHeight ) {
		document.getElementById( 'guard-wnd' ).style.height = document.body.scrollHeight + 'px';
	} else {
		document.getElementById( 'guard-wnd' ).style.height = document.body.clientHeight + 'px';
	}
	document.getElementById( 'guard-wnd' ).style.visibility = 'visible';

	objTimerID = setTimeout( "ex_closePopup();", 1000*10 );
}

// 指定した位置までスクロール
function ex_windowScroll_Memmod(){
	if (selectLinkFlag == 1) {
		window.scrollTo(0,1005);
	} else if (selectLinkFlag == 2) {
		window.scrollTo(0,1005);
	} else if (selectLinkFlag == 3) {
		window.scrollTo(0,1005);
	}
}


// 20100324追記
// 外出し対応_お勤め先登録・変更

// リストの初期値をセット
function ex_setInitSelected_Employreg(address_array, _selectId) {
	var _select = document.getElementById("list_address");
	for(var i = 0; i < _select.length; i++) {
		if(_select.options[i].value == _selectId) {
			_select.options[i].selected = true;
		}
	}
}

// リストにオプションを挿入
function ex_insertOption_Employreg(elementname,v,t) {
	var _option=document.createElement("option");
	_option.text=t;
	_option.value=v;
	
	var _select=document.getElementById(elementname);
	try {
		_select.add(_option,null); // standards compliant
	} catch(ex) {
		_select.add(_option); // IE only
	}
}


// 20100324
// 外出し対応_お届け先登録・変更

// リストにオプションを挿入
function ex_insertOption_Addreg(elementname,v,t) {
	var _option=document.createElement("option");
	_option.text=t;
	_option.value=v;
	
	var _select=document.getElementById(elementname);
	try {
		_select.add(_option,null); // standards compliant
	} catch(ex) {
		_select.add(_option); // IE only
	}
}

/**
 * カタログ注文フォーム　サイカタ
 */
function sendCataSycata() {
	var param = "";
	for (var i = 0; i < 15; i++) {
		var countName = "list_order[" + i + "].quantity";
		var count = document.getElementById(countName).value;
		if (count == null || count.length < 1 || isNaN(count) || parseInt(count) < 1) {
			continue;
		}
		var cataCdName = "list_order[" + i + "].catalog_code";
		var prdctCdName = "list_order[" + i + "].product_code";
		var requestCdName = "list_order[" + i + "].request_code";
		
		var cataElement = document.getElementById(cataCdName);
		var proElement = document.getElementById(prdctCdName);
		var reqElement = document.getElementById(requestCdName);
		
		if (reqElement != null) {
			// OZIO / なちゅ対象
//			var reqCd = reqElement.value;
//			if (param != null && param.length > 0) {
//				param += ",";
//			}
//			param += ";" + reqCd;
		} else if (cataElement != null && proElement != null ) {
			// belluna系
			var catalogCd = cataElement.value;
			var productCd = proElement.value;
			if (param != null && param.length > 0) {
				param += ",";
			}
			param += ";" + catalogCd + "/" + productCd;
		}
		
	}
	if (param != null && param.length > 0) {
		s.linkTrackVars="events,products";
		s.linkTrackEvents="scAdd";
		_omni.events="scAdd";
		_omni.products = param;
		s.tl(this,"o");
	}
}

/**
 * チラシ注文フォーム　サイカタ
 */
function sendFilSycata() {
	var param = "";
	for(var i = 0; ; i++) {
		// 各Name
		var cataCdName = "list_result[" + i + "].catalog_code";
		var prdctCdName = "list_result[" + i + "].product_code";
		var countName = "list_result[" + i + "].quantity";
		// アイテム情報
		var catalogCds = document.getElementsByName(cataCdName);
		var productCds = document.getElementsByName(prdctCdName);
		var counts = document.getElementsByName(countName);
		if (counts == null || counts.length < 1 
				|| catalogCds == null || catalogCds.length < 1
				|| productCds == null || productCds.length < 1) {
			// アイテム情報が取得できない場合ループ終了
			break;
		}
		
		var count = counts[0].value;
		if (count == null || count.length < 1 || isNaN(count) ) {
			// 数値のLENGTHが1以下 または 数字ではない場合ループ終了
			break;
		}
		var catalogCd = catalogCds[0].value;
		var productCd = productCds[0].value;
		if (count && count.length > 0 && parseInt(count) > 0) {
			if (param != null && param.length > 0) {
				param += ",";
			}
			// 数量が０以外の場合文字列連結（カタログ/商品)
			param += ";" + catalogCd + "/" + productCd;
		}
	}

	if (param != null && param.length > 0) {
		// 送信対象が存在する場合
		s.linkTrackVars="events,products";
		s.linkTrackEvents="scAdd";
		_omni.events="scAdd";
		_omni.products = param;
		s.tl(this,"o");
	}
}

/**
 * 金券チェックボックス：ON処理
 */
function checkedDiscountTicket() {
    var countCk = 0;
    var isList = false;
    for (var i = 0; ; i++) {
        var itemNm = "available_tickets["+i+"].value";
        var item =  document.getElementsByName(itemNm).item(0);
        if (!item) {
            break;
        }
        if (!isList) {
            isList = true;
        }
        if (item.checked) {
            countCk++;
        }
    }
    if (isList && countCk < 1) {
        var name = "available_tickets[0].value";
        var obj = document.getElementsByName(name).item(0);
        obj.checked = true;
    }
}

/***
* 単体項目値取得処理
*/
function getItemValue(name) {
    if (document.getElementsByName(name).item(0) == null) {
        return "";
    }
    return document.getElementsByName(name).item(0).value;
}

/***
* メッセージ項目値取得処理
*/
function getMsgValue(val, col, size) {
    if ((val == null || val == "") && col != "－" && size != "－") {
        return "売り切れ";
    }
    return val;
}

/***
 * 在庫情報表示処理
 * @param colorNm 色プルダウンID
 * @param sizeNm サイズプルダウンID
 * @param quantityNm 数量プルダウンID
 * @param cartBtnNm カートボタンName(リンクは同じ名前をIDに設定)
 * @param hCartBtnNm カート非投入ボタン
 */
 function dispStockInfo(colorNm, sizeNm, quantityNm, cartBtnNm, hCartBtnNm) {
    var color = getItemValue(colorNm);
    var size = getItemValue(sizeNm);
    var target = color + "-" + size;
    var msg = getMsgValue(getItemValue("MS_" + target), color, size);
    if (msg != null && msg != "") {
         document.getElementById("stockMsgArea").innerHTML = msg;
    } else {
         document.getElementById("stockMsgArea").innerHTML = "";
    }
    var flg = getItemValue(target);
    if (flg != "" && flg == "0") {
        document.getElementsByName(cartBtnNm).item(0).style.visibility = "visible";
        document.getElementById(cartBtnNm).style.visibility = "visible";
        document.getElementsByName(hCartBtnNm).item(0).style.visibility = "hidden";
    } else {
        document.getElementById(cartBtnNm).style.visibility = "hidden";
        document.getElementsByName(cartBtnNm).item(0).style.visibility = "hidden";
        document.getElementsByName(hCartBtnNm).item(0).style.visibility = "visible";
    }
    
 }

