var cart;
function toCart(formName) {
	var num;
	var color;
	var size;
	var itemId1;
	var itemId2;
	var itemId;
	var URLStem;
	var URL;

	if (formName == 'cart') {
		URL = "/p/pretocart1.asp?genre_id=DEFAULT_SITE"
		cart = window.open(URL, "cart", "width=500,height=600,scrollbars=1,resizable=0,location=0,menubar=0,toolbar=0,status=0");
		cart.focus();
		return;
	}

	if (document.all) {
		itemId1 = document.all(formName).item_id1.value;
		itemId2 = document.all(formName).item_id2.value;
		num = document.all(formName).num.value;
		if (document.all(formName).color) {
			color = document.all(formName).color.value;
		} else {
			color = "99";
		}
		if (document.all(formName).size) {
			size = document.all(formName).size.value;
		} else {
			size = "999";
		}
	} else if (document.forms) {
		itemId1 = document.forms[formName].item_id1.value;
		itemId2 = document.forms[formName].item_id2.value;
		num = document.forms[formName].num.value;
		if (document.forms[formName].color) {
			color = document.forms[formName].color.value;
		} else {
			color = "99";
		}
		if (document.forms[formName].size) {
			size = document.forms[formName].size.value;
		} else {
			size = "999";
		}
	} else {
		itemId1 = document.getElementById(formName).item_id1.value;
		itemId2 = document.getElementById(formName).item_id2.value;
		num = document.getElementById(formName).num.value;
		if (document.getElementById(formName).color) {
			color = document.getElementById(formName).color.value;
		} else {
			color = "99";
		}
		if (document.getElementById(formName).size) {
			size = document.getElementById(formName).size.value;
		} else {
			size = "999";
		}
	}
	if (size == "") {
		alert('サイズを選択して下さい。')
		return;
	}
	if (color == "") {
		alert('カラーを選択して下さい。')
		return;
	}
	itemId =  itemId1 + color + size + "-" + itemId2;

	URL = "/p/pretocart1.asp?item_id=" + itemId + "&num=" + num;
	cart = window.open(URL, "cart", "width=500,height=600,scrollbars=1,resizable=0,location=0,menubar=0,toolbar=0,status=0");
	cart.focus();
	return;
}
