function item_add( cd ){
	num = document.forms["itemform"].elements["item_num" + cd].value;
	send = document.forms["itemform"].elements["send" + cd].value;
	window.location = "cart.php?mod=add&item=" + cd + "&num=" + num + "&send=" + send;
}
function item_set( midx, iidx, cd, num, cart ){
	window.location = "cart.php?mod=upd&midx=" + midx + "&iidx=" + iidx + "&item=" + cd + "&num=" + num + "&cart=" + cart;
}
function item_del( midx, iidx, cd, cart ){
	window.location = "cart.php?mod=del&midx=" + midx + "&iidx=" + iidx + "&item=" + cd + "&cart=" + cart;
}
function noshi_cd( midx, iidx, cd, nc, cart ){
	window.location = "cart.php?mod=updnoshi&midx=" + midx + "&iidx=" + iidx + "&item=" + cd + "&noshicd=" + nc + "&cart=" + cart;
}
function noshi_str( midx, iidx, cd, ns, cart ){
	ns = encodeURI( ns );
	window.location = "cart.php?mod=updnoshi&midx=" + midx + "&iidx=" + iidx + "&item=" + cd + "&noshistr=" + ns + "&cart=" + cart;
}
function setitem_chk(){
	itemcnt = 0;
	yen = 0;
	yflg = 0;
	numcnt = document.forms["itemform"].elements["numcnt"].value;
	btname = document.forms["itemform"].elements["btname"].value;
	for( i=1; i<=document.forms["itemform"].elements["maxcnt"].value; i++ ){
		itemcnt += eval( document.forms["itemform"].elements["num"+i].value );
		yen     += eval( document.forms["itemform"].elements["num"+i].value ) * eval( document.forms["itemform"].elements["yen"+i].value );
	}
	document.getElementById("setyen").innerHTML = "<big>" + number_format(yen) + "</big>円";
	document.getElementById("setsum").innerHTML = "<big>" + itemcnt + "</big>" + document.forms["itemform"].elements["unit"].value;
	document.forms["itemform"].elements["itemsum"].value = itemcnt;
	for( i=1; i<=numcnt; i++ ){
		if( document.forms["itemform"].elements["enum"+i].value == itemcnt ){
			yflg = 1;
		}
	}
	if( yflg == 1 ){
		document.getElementById("setbuy").innerHTML = "<button type=\"submit\" value=\"incart\" class=\"incart\">" + btname + "</button>";
	}else{
		document.getElementById("setbuy").innerHTML = "<button type=\"button\" value=\"incart\" class=\"cau\" onclick=\"alert('数量の合計を正しく選択してください。');\">" + btname + "</button>";
	}
}
function itemcd_chk( cd, i ){
	xmlhttp = createXMLHttpRequest();
	if( xmlhttp ){
		xmlhttp.onreadystatechange = function(){
			if(xmlhttp.readyState == 4 && xmlhttp.status == 200){
				if( xmlhttp.responseText == 0 ){
					window.document.getElementById("mes" + i).innerHTML = "";
				}else{
					window.document.getElementById("mes" + i).innerHTML = "商品番号がありません";
				}
			}
		}
		xmlhttp.open("post","shop_itemcd_chk.php?cd=" + cd,true);
		xmlhttp.send(null);
	}
}
function cartchg(){
	document.forms["cartlist"].submit();
}
function number_format(str){
	var ret = "";
	str = "" + str;
	i = 0;
	if( str.length >= 4 ){
		for( j=1; j<=str.length; j++){
			ret = str.charAt( str.length - j ) + ret;
			i++;
			if( i % 3 == 0 ){
				ret = "," + ret;
				i = 0;
			}
		}
	}else{
		ret = str;
	}
	return ret;
}
function movechg( num ){
	if( num == 0 ){
		mstr = "移動する";
	}else{
		mstr = "コピーする";
	}
	window.document.getElementById("movebutton").innerHTML = "<button type=\"submit\" name=\"reg\" value=\"reg\" class=\"incart\">" + mstr + "</button>";
mstr;
}
/* 期間限定ページ用 */
function showkome( ){
	window.open('season/shop_kome.php', '生産者紹介', 'width=400,height=300,scrollbars=yes' );
}