function JsTextDisp(text_id) {
	if(document.getElementById(text_id).style.display == 'block'){
		document.getElementById(text_id).style.display = 'none';
	}else{
		document.getElementById(text_id).style.display = 'block';
	}
}

function JsSelectToday_S(bool,ipt_name_s1,ipt_name_s2,ipt_name_s3){
	//alert(bool);
	if(bool){
		d = new Date();
		year	= d.getFullYear();
		month	= d.getMonth()+1;
		day		= d.getDate();
	}else{
		year	= 0;
		month	= 0;
		day		= 0;
	}
	//alert("a" + year+month+day);
	//document.forms["formMain"].elements[ipt_name1].disabled=bool;
	if(ipt_name_s1!=""){
		document.getElementById(ipt_name_s1).value = year;
	}
	if(ipt_name_s2!=""){
		document.getElementById(ipt_name_s2).value = month;
	}
	if(ipt_name_s3!=""){
		document.getElementById(ipt_name_s3).value = day;
	}

}


function JsSelectToday(bool,ipt_name1,ipt_name2,ipt_name3,ipt_name4,ipt_name5,ipt_name6){
	//alert(bool);
	if(bool){
		d = new Date();
		year	= d.getFullYear();
		month	= d.getMonth()+1;
		day		= d.getDate();
	}else{
		year	= 0;
		month	= 0;
		day		= 0;
	}
	//alert("a" + year+month+day);
	//document.forms["formMain"].elements[ipt_name1].disabled=bool;
	if(ipt_name1!=""){
		document.getElementById(ipt_name1).value = year;
	}
	if(ipt_name2!=""){
		document.getElementById(ipt_name2).value = month;
	}
	if(ipt_name3!=""){
		document.getElementById(ipt_name3).value = day;
	}

	if(ipt_name4!=""){
		document.getElementById(ipt_name4).value = year;
	}
	if(ipt_name5!=""){
		document.getElementById(ipt_name5).value = month;
	}
	if(ipt_name6!=""){
		document.getElementById(ipt_name6).value = day;
	}
}



function JsSetTodayName(ipt_name1,ipt_name2,ipt_name3,ipt_name4,str_user_name){
	JsInputSet(ipt_name4,str_user_name);
	JsSelectToday(true,ipt_name1,ipt_name2,ipt_name3);
}


function JsSetAdminMemo(ipt_name,str_user_name){
	str_admin_memo = document.getElementById(ipt_name).value;

	d = new Date();
	year	= d.getFullYear();
	month	= d.getMonth()+1;
	day		= d.getDate();
	document.getElementById(ipt_name).value = year + "/" + month + "/" + day + "　　(" + str_user_name + ")\n\n" + str_admin_memo;
//	alert(document.getElementById(ipt_name).value);
}


function JsSelectNow(bool,ipt_name1,ipt_name2,ipt_name3,ipt_name4,ipt_name5,ipt_name6){
	//alert(bool);
	if(bool){
		d = new Date();
		year	= d.getFullYear();
		month	= d.getMonth()+1;
		day		= d.getDate();
		hour	= d.getHours();
		minute	= d.getMinutes();
		second	= d.getSeconds();
	}else{
		year	= 0;
		month	= 0;
		day		= 0;
		hour	= 0;
		minute	= 0;
		second	= 0;
	}
	document.getElementById(ipt_name1).value = year;
	document.getElementById(ipt_name2).value = month;
	document.getElementById(ipt_name3).value = day;
	document.getElementById(ipt_name4).value = hour;
	document.getElementById(ipt_name5).value = minute;
	document.getElementById(ipt_name6).value = second;
}



function JsSellPriceSet(int_sell_max_price,int_rank,str_input_name){
	//alert(int_sell_max_price);
	//alert(int_rank);
	if(int_rank < 0){
		alert("査定ランクを選択してください。");
	}else{
		//alert(int_sell_max_price * (int_rank / 100));
		document.getElementById(str_input_name).value = int_sell_max_price * (int_rank / 100);
	}
}



//ダンボールのサイズ変更
function radioChange(){
	radio = document.getElementsByName('iptSendType')
	document.getElementById('sub_box').style.display = "none";
	if(radio[0].checked) {
	}else if(radio[1].checked) {
	}else if(radio[2].checked) {
		document.getElementById('sub_box').style.display = "";
	}
}
//window.onload = radioChange;






function JsGoodsDisabled(bln_disabled, ipt_name1,ipt_name2,ipt_name3,ipt_name4){

	if(bln_disabled){
		//alert(ipt_name2);
		document.getElementById(ipt_name1).disabled = true;
		document.getElementById(ipt_name2).disabled = true;
		document.getElementById(ipt_name3).disabled = true;
		document.getElementById(ipt_name4).disabled = true;
	}else{
		document.getElementById(ipt_name1).disabled = false;
		document.getElementById(ipt_name2).disabled = false;
		document.getElementById(ipt_name3).disabled = false;
		document.getElementById(ipt_name4).disabled = false;
	}
}

function JsInputAdd(){

	eval("document.getElementById('input_goods_add').style").display = 'inline';

	eval("document.getElementById('id_btn_input_add')").innerHTML ="";

}


function JsOpenTable(int_num) {

	eval("document.getElementById('tbl_goods_" + int_num + "').style").display = 'inline';

	eval("document.getElementById('btn_add_"+int_num+"')").innerHTML ="";

	eval("document.getElementById('btn_del_"+int_num+"')").innerHTML ="<img src='./img/icon/delete.gif' onclick='JsCloseTable(" + int_num +");' alt='入力欄を削除'>";

}
function JsCloseTable(int_num) {

	eval("document.getElementById('tbl_goods_" + int_num + "').style").display = 'none';

	eval("document.getElementById('btn_add_"+int_num+"')").innerHTML ="<img src='./img/icon/add.gif' onclick='JsOpenTable(" + int_num +");' alt='入力欄を追加'>";
	eval("document.getElementById('btn_del_"+int_num+"')").innerHTML ="";



	eval("document.getElementById('id_iptGoodsMaker"+int_num+"')").value = "";
	eval("document.getElementById('id_iptGoodsPortNum"+int_num+"')").value = "";
	eval("document.getElementById('id_iptGoodsCount"+int_num+"')").value = "1";

}

function JsAucfanSearchWindowOpen(str_url_1,str_url_2,str_url_3,str_url_4) {

	window.open(str_url_1,"1");
	window.open(str_url_2,"2");
	window.open(str_url_3,"3");
	window.open(str_url_4,"4");
}




function JsInputSet(str_input_name, str_value){
	//alert(str_input_name);
	document.getElementById(str_input_name).value = str_value;
}



function JsIdCardPresence(str_select_name1,str_select_name2){
	var n = document.getElementById(str_select_name1).selectedIndex
	//alert(n);
	if(n > 0){
		document.getElementById(str_select_name2).options[1].selected = true;
	}

	//var n = document.Form1.Select1.selectedIndex;
	//document.Form1.Select2.options[n].selected=true;
}


function JsValueCopy(str_input_a, str_input_b, int_type){
	var str_b = document.getElementById(str_input_b).value;
	if(int_type == 1){
		str_b = str_b.replace("<br>", "");
		str_b = str_b.replace("<br />", "");
		str_b = str_b.replace("<BR>", "");
		str_b = str_b.replace("<BR />", "");
	}

	//alert(document.getElementById(str_input_b).value);
	document.getElementById(str_input_a).value = str_b;
}

function JsCharSizeCheck(str_input_a){

	var str = document.getElementById(str_input_a).value;

	var str_len = 0 ;

	for (var i = 0; i < str.length ; i++ ) {
		//文字数が１の場合はASCII文字のため、2バイトとカウント
		if (escape(str.charAt(i)).length == 1 ){

			str_len++ ;

		//文字数が２以上の場合はShift_JIS文字のため、2バイトとカウント
		}else if (escape(str.charAt(i)).length > 2 ) {

			str_len = str_len + 2 ;

		}
	}

	//文字の長さを表示
	alert("現状、" + str.length + "文字、" + str_len + "バイトです。");
	//alert(str_len + "バイトです。" + str.length + "文字です。");
	//return str_len ;

}



function sub_window_open(str_para){
	win=window.open("window.php?p=" + str_para,"new","width=478,height=730,resizable=yes,scrollbars=yes");
	//win.moveTo(100,100);
}


function JsMailTypeCheck(){
	//alert("a");
	document.form.submit();
}



//画像のサブウィンドウ
var new1,win1p;
function CenterOpen (img) {
	if (win1p=="on") {
		if (new1.closed) {
		} else {
			new1.close();
		}
	}

	win1p = "on";

	new1=window.open("", "newwin", "resizable=1,width=650,height=520,resizable=yes,scrollbars=yes");
	if(navigator.appVersion.charAt(0)>=3){
		new1.focus()
	};
	new1.document.clear();
	new1.document.write("<html><head><meta http-equiv=Content-Type content=\"text/html; charset=x-sjis\"><title>View Window</title></head><body bgcolor=#ffffff><table cellpadding=0 align=center valign=center>");
	new1.document.write("<tr><td align=center valign=center><img src="+img+"></td></tr></table>");
	new1.document.write("<center><br /><form><input type=button value='このウインドウを閉じる' onClick='window.close()'></form></center>");
	new1.document.write("</body></html>");
	new1.document.close();
}



function JsAddressCopy (ipt_name_member_zipcode,ipt_name_member_pref,ipt_name_member_address1,ipt_name_member_address2,ipt_name_member_tel,ipt_name_sell_cargo_zipcode,ipt_name_sell_cargo_pref,ipt_name_sell_cargo_address1,ipt_name_sell_cargo_address2,ipt_name_sell_cargo_tel) {

	var str1 = document.getElementById(ipt_name_member_zipcode).value;
	document.getElementById(ipt_name_sell_cargo_zipcode).value = str1;

	var str2 = document.getElementById(ipt_name_member_pref).value;
	document.getElementById(ipt_name_sell_cargo_pref).value = str2;

	var str3 = document.getElementById(ipt_name_member_address1).value;
	document.getElementById(ipt_name_sell_cargo_address1).value = str3;

	var str4 = document.getElementById(ipt_name_member_address2).value;
	document.getElementById(ipt_name_sell_cargo_address2).value = str4;

	var str5 = document.getElementById(ipt_name_member_tel).value;
	document.getElementById(ipt_name_sell_cargo_tel).value = str5;

}

function JsCargoFastDateSet(int_year, int_month, int_day){

//	alert("a:" + int_year);
//	alert("b:" + int_month);
//	alert("c:" + int_day);

	document.getElementById('iptSellCargoDateYear').value 	= int_year;
	document.getElementById('iptSellCargoDateMonth').value 	= int_month;
	document.getElementById('iptSellCargoDateDay').value 	= int_day;

}


/**
 * 全角であるかをチェックします。
 *
 * @param チェックする値
 * @return ture : 全角 / flase : 全角以外
 */
function checkIsZenkaku(value) {
	for (var i = 0; i < value.length; ++i) {
		var c = value.charCodeAt(i);
		//  半角カタカナは不許可
		if (c < 256 || (c >= 0xff61 && c <= 0xff9f)) {
			return false;
		}
	}
	return true;
}

/**
 * 文字列のバイト数を取得する。
 * 全角を2バイト、半角を1バイトとしてカウントします。
 *
 * @param バイトを取得する値
 * @return 取得したバイト数
 */
function getByteCount(value) {
	var count = 0;
	for ( var i = 0; i < value.length; ++i ) {
		var sub = value.substring(i, i + 1);
		//全角の場合２バイト追加。
		if( checkIsZenkaku(sub) ){
			count += 2;
		} else {
			count += 1;
		}
	}
	return count;
}

// JavaScript Document
//ボタンのロールオーバー
function smartRollover() {
    if(document.getElementsByTagName) {
        var images = document.getElementsByTagName("img");
        for(var i=0; i < images.length; i++) {
            if(images[i].getAttribute("src").match("_off."))
            {
                images[i].onmouseover = function() {
                    this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on."));
                }
                images[i].onmouseout = function() {
                    this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off."));
                }
            }
        }
		var inputs = document.getElementsByTagName("input");
        for(var j=0; j < inputs.length; j++) {
            if(inputs[j].getAttribute("type").match("image"))
            {
                inputs[j].onmouseover = function() {
                    this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on."));
                }
                inputs[j].onmouseout = function() {
                    this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off."));
                }
            }
        }
    }
}
if(window.addEventListener) {
    window.addEventListener("load", smartRollover, false);
}
else if(window.attachEvent) {
    window.attachEvent("onload", smartRollover);
}

//商品サイト無料オンライン査定用ドロップダウン選択内容設定
function changeMaker(n)
{

	len = document.sateiForm.maker.options.length;
	for (i=len-1; i>=0; i--)
	{
		document.sateiForm.maker.options[i] = null;
	}
	for (i=0; i<makerVariety[n].length; i++)
	{

		document.sateiForm.maker.options[i] = new Option(makerVariety[n][i],makerVariety[n][i]);
	}

}

<!--Overture K.K ユニバーサルタグstart-->

	var ysm_accountid  = "1D74B4SSKCEILK9M47AMDCQE0DC";
	document.write("<scr" + "ipt language='javascript' type='text/javascript' "
	+ "src=//" + "srv2.wa.marketingsolutions.yahoo.com" + "/script/ScriptServlet" + "?aid=" + ysm_accountid
	+ "></scr" + "ipt>");

<!--Overture K.K ユニバーサルタグend-->


//在庫ナビ編集画面初期化
function initStockEdit(){
	adminMemo();
	initCateBox();
	tblDisplay("");
	textareaSize("",0);
}


//管理者メモへの初期テキスト配置
function adminMemo(){
	txt_elm = document.getElementById('iptStockAdminMemo');
	if (txt_elm.value == ""){
		txt_elm.value = "\n\n\n\n" +
						"*以下必須入力\n" +
						"▼商品ランク\n" +
						"【】\n" +
						"*-*-*-*-*-*-*-*-*\n" +
						"Ａ：新品\n" +
						"Ｂ：ほぼ新品\n" +
						"Ｃ：非常に良い\n" +
						"Ｄ：良い\n" +
						"Ｅ：可\n" +
						"Ｆ：動作未確認（ジャンク品）\n" +
						"Ｇ：通電確認のみ（ジャンク品）\n" +
						"*-*-*-*-*-*-*-*-*\n" +
						"\n" +
						"▼商品状態（上記ランク根拠を明確に記入してください。PCの場合は、スペックを明記して下さい。）\n" +
						"\n" +
						"\n" +
						"▼発送可能方法\n" +
						"【】\n" +
						"*-*-*-*-*-*-*-*-*\n" +
						"ａ：宅配便のみ\n" +
						"ｂ：定形外可\n" +
						"ｃ：メール便可\n" +
						"*-*-*-*-*-*-*-*-*\n" +
						"\n" +
						"▼セット内容（商品付属品、同梱物）\n" +
						"\n" +
						"\n" +
						"" ;
	}
}

//ボタン無効化
function btDis(id){
	bt_elm = document.getElementById(id);
	bt_elm.disabled = true;
}

//ボタン有効化
function btDisOff(id){
	bt_elm = document.getElementById(id);
	bt_elm.disabled = false;
}

//JANコード検索
function JanCode(){
	var serial = document.formMain.iptStockPortNum.value;
	document.rakutenJan.searchKeyword.value = serial;
	document.charset='EUC-JP';
	document.rakutenJan.submit();
	document.charset='UTF-8';
}

//ディレクトリID検索窓
function DirectoryID(){
	window.open("/admin/directory_id_search.php","directory_id","");
}

//店舗内カテゴリ検索窓
function getCategory(){
	window.open("/admin/category_set.php","category","");
}

//店舗内カテゴリ初期化
function initCateBox(){
	if (document.formMain.iptStockExplanationRakutenCategory1.value == "") document.getElementById('cateBox1').style.display = "none";
	if (document.formMain.iptStockExplanationRakutenCategory2.value == "") document.getElementById('cateBox2').style.display = "none";
	if (document.formMain.iptStockExplanationRakutenCategory3.value == "") document.getElementById('cateBox3').style.display = "none";
	if (document.formMain.iptStockExplanationRakutenCategory4.value == "") document.getElementById('cateBox4').style.display = "none";
	if (document.formMain.iptStockExplanationRakutenCategory5.value == "") document.getElementById('cateBox5').style.display = "none";
}

function resetCategory(n){
	switch (n){
		case 1:
			document.getElementById('iptStockExplanationRakutenCategory1').value = "";
			document.getElementById('cateBox1').style.display = "none";
			break;
		case 2:
			document.getElementById('iptStockExplanationRakutenCategory2').value = "";
			document.getElementById('cateBox2').style.display = "none";
			break;
		case 3:
			document.getElementById('iptStockExplanationRakutenCategory3').value = "";
			document.getElementById('cateBox3').style.display = "none";
			break;
		case 4:
			document.getElementById('iptStockExplanationRakutenCategory4').value = "";
			document.getElementById('cateBox4').style.display = "none";
			break;
		case 5:
			document.getElementById('iptStockExplanationRakutenCategory5').value = "";
			document.getElementById('cateBox5').style.display = "none";
			break;
		default:
	}
}

//メルマガ本文文字数カウント
function bodyStrCount(){
	var numElm = document.getElementById('bodyStrNum');
	var bodyElm = document.getElementById('iptMailMagaBody');
	numElm.innerHTML = bodyElm.value.length + "文字";
}

//在庫ナビ編集画面テーブル表示/非表示
function tblDisplay(val){
	if (val == ""){
		//初期化
		document.getElementById('bt_stock_tbl_1c').style.display = "none";
		document.getElementById('stock_tbl_1').style.display = "none";
		document.getElementById('bt_stock_tbl_2o').style.display = "none";
		document.getElementById('bt_stock_tbl_3c').style.display = "none";
		document.getElementById('stock_tbl_3').style.display = "none";
		document.getElementById('bt_stock_tbl_4o').style.display = "none";
		document.getElementById('bt_yahoo_tblc').style.display = "none";
		document.getElementById('yahoo_tbl').style.display = "none";
		document.getElementById('bt_moba_tblc').style.display = "none";
		document.getElementById('moba_tbl').style.display = "none";
		document.getElementById('bt_ec_tblc').style.display = "none";
		document.getElementById('ec_tbl').style.display = "none";
		document.getElementById('bt_stock_tbl_5c').style.display = "none";
		document.getElementById('stock_tbl_5').style.display = "none";
	}else{
		var bto = document.getElementById('bt_' + val + 'o');
		var btc = document.getElementById('bt_' + val + 'c');
		var tbl_elm = document.getElementById(val);
		if (tbl_elm.style.display == "none"){
			bto.style.display = "none";
			btc.style.display = "inline";
			tbl_elm.style.display = "block";
		}else{
			bto.style.display = "inline";
			btc.style.display = "none";
			tbl_elm.style.display = "none";
		}
	}
}

//テキストエリアサイズ変更
function textareaSize(val,m){
	if (m > 0){
		var txtarea = document.getElementById(val);
		n = Number(txtarea.style.height.replace("px",""));
		switch (m){
			case 1:
				n += 200;
				break;
			case 2:
				n += 100;
				break;
			case 3:
				n -= 100;
				break;
			case 4:
				n -= 200;
				break;
			default:
		}
		if (n < 0) n = 1;
		txtarea.style.height = n + "px";
	}else{
		//初期化
		document.getElementById('iptStockAdminMemo').style.height = "100px";
		document.getElementById('iptStockExplanationBodyRakutenMb').style.height = "100px";
		document.getElementById('iptStockExplanationBodyRakutenPc').style.height = "100px";
		document.getElementById('iptStockExplanationBodyYahoo').style.height = "100px";
		document.getElementById('iptStockExplanationBodyMbok').style.height = "100px";
		document.getElementById('iptStockExplanationBodyStarFactory').style.height = "100px";
		document.getElementById('iptStockBidMemo').style.height = "100px";
	}
}