function PriceSum()
{
	var sum = 0;

	/*
	if( document.getElementById('price1').checked == true ){ sum = sum + 5250; }
	if( document.getElementById('price2').checked == true ){ sum = sum + 10500; }
	*/
//基本撮影料は固定
	sum = 5250;

	if( document.getElementById('ProductPrice1Num1').value != '' )
		sum = sum + 2625 * parseInt( document.getElementById('ProductPrice1Num1').value );
	if( document.getElementById('ProductPrice1Num2').value != '' )
		sum = sum + 3675 * parseInt( document.getElementById('ProductPrice1Num2').value );
	if( document.getElementById('ProductPrice1Num3').value != '' )
		sum = sum + 4725 * parseInt( document.getElementById('ProductPrice1Num3').value );
	if( document.getElementById('ProductPrice1Num4').value != '' )
		sum = sum + 5775 * parseInt( document.getElementById('ProductPrice1Num4').value );
	if( document.getElementById('ProductPrice1Num5').value != '' )
		sum = sum + 8400 * parseInt( document.getElementById('ProductPrice1Num5').value );
	if( document.getElementById('ProductPrice1Num6').value != '' )
		sum = sum + 19950 * parseInt( document.getElementById('ProductPrice1Num6').value );
	if( document.getElementById('ProductPrice1Num7').value != '' )
		sum = sum + 30450 * parseInt( document.getElementById('ProductPrice1Num7').value );

	if( document.getElementById('ProductPrice2Num1').value != '' )
		sum = sum + 4200 * parseInt( document.getElementById('ProductPrice2Num1').value );
	if( document.getElementById('ProductPrice2Num2').value != '' )
		sum = sum + 5250 * parseInt( document.getElementById('ProductPrice2Num2').value );
	if( document.getElementById('ProductPrice2Num3').value != '' )
		sum = sum + 6300 * parseInt( document.getElementById('ProductPrice2Num3').value );

	if( document.getElementById('ProductPrice3Num1').value != '' )
		sum = sum + 21000 * parseInt( document.getElementById('ProductPrice3Num1').value );


//オリジナル制作料は、1回でも選択されたら自動で入る。
//2件目以降は、セット代のみがかかるようにする。
	if( document.getElementById('ProductPrice4Num1').value != '' )
	{
		var num = parseInt( document.getElementById('ProductPrice4Num1').value );

		if( num != 0 )
		{
			sum = sum + 15750 + 21000 * parseInt( document.getElementById('ProductPrice4Num1').value );
		}
	}
	if( document.getElementById('ProductPrice4Num2').value != '' )
	{
		var num = parseInt( document.getElementById('ProductPrice4Num2').value );

		if( num != 0 )
		{
			sum = sum + 15750 + 31500 * parseInt( document.getElementById('ProductPrice4Num2').value );
		}
	}	


	if( document.getElementById('OptionPrice1Num').value != '' )
		sum = sum + 10500 * parseInt( document.getElementById('OptionPrice1Num').value );
	if( document.getElementById('OptionPrice2Num').value != '' )
		sum = sum + 3150 * parseInt( document.getElementById('OptionPrice2Num').value );
	if( document.getElementById('OptionPrice3Num').value != '' )
		sum = sum + 945 * parseInt( document.getElementById('OptionPrice3Num').value );

	if( document.getElementById('OtherPrice0Num1').value != '' )
		sum = sum + 5250 * parseInt( document.getElementById('OtherPrice0Num1').value );
	if( document.getElementById('OtherPrice1Num1').value != '' )
		sum = sum + 5250 * parseInt( document.getElementById('OtherPrice1Num1').value );
	if( document.getElementById('OtherPrice1Num2').value != '' )
		sum = sum + 8400 * parseInt( document.getElementById('OtherPrice1Num2').value );
	if( document.getElementById('OtherPrice1Num3').value != '' )
		sum = sum + 5250 * parseInt( document.getElementById('OtherPrice1Num3').value );
	if( document.getElementById('OtherPrice1Num4').value != '' )
		sum = sum + 12600 * parseInt( document.getElementById('OtherPrice1Num4').value );
	if( document.getElementById('OtherPrice1Num5').value != '' )
		sum = sum + 14700 * parseInt( document.getElementById('OtherPrice1Num5').value );
	if( document.getElementById('OtherPrice1Num6').value != '' )
		sum = sum + 9450 * parseInt( document.getElementById('OtherPrice1Num6').value );

	if( document.getElementById('OtherPrice2Num1').value != '' )
		sum = sum + 0 * parseInt( document.getElementById('OtherPrice2Num1').value );
	if( document.getElementById('OtherPrice2Num2').value != '' )
		sum = sum + 0 * parseInt( document.getElementById('OtherPrice2Num2').value );
	if( document.getElementById('OtherPrice2Num3').value != '' )
		sum = sum + 10500 * parseInt( document.getElementById('OtherPrice2Num3').value );
	if( document.getElementById('OtherPrice2Num4').value != '' )
		sum = sum + 0 * parseInt( document.getElementById('OtherPrice2Num4').value );

	if( document.getElementById('OtherPrice3Num1').value != '' )
		sum = sum + 3150 * parseInt( document.getElementById('OtherPrice3Num1').value );
	if( document.getElementById('OtherPrice3Num2').value != '' )
		sum = sum + 10500 * parseInt( document.getElementById('OtherPrice3Num2').value );
	if( document.getElementById('OtherPrice3Num3').value != '' )
		sum = sum + 31500 * parseInt( document.getElementById('OtherPrice3Num3').value );
	if( document.getElementById('OtherPrice3Num4').value != '' )
		sum = sum + 31500 * parseInt( document.getElementById('OtherPrice3Num4').value );


	document.getElementById('Sum').value = addFigure( sum );


					//衣装は実際の金額は可変なので、
					//[レンタル衣装（撮影時のみ）]
					//成人 OtherPrice2Num3
					//
					//[レンタル衣装（お出かけ一泊二日）]
					//七五三 OtherPrice3Num2
					//成人 OtherPrice3Num3
					//ウェディング OtherPrice3Num4
					//
					//を選んだ時のみ、合計金額のキャプションで
					//『選んだ衣装により実際のお値段は変わります。』
	if( (document.getElementById('OtherPrice2Num3').value > 0 )||
		(document.getElementById('OtherPrice3Num2').value > 0 )||
		(document.getElementById('OtherPrice3Num3').value > 0 )||
		(document.getElementById('OtherPrice3Num4').value > 0 ))
	{
		document.getElementById('totalCaption').innerHTML = '選んだ衣装により実際のお値段は変わります。';
	}
	else
	{
		document.getElementById('totalCaption').innerHTML = '';
	}

		
}


//金額をカンマ区切りにする
function addFigure(str) {
	var num = new String(str).replace(/,/g, "");
	while(num != (num = num.replace(/^(-?\d+)(\d{3})/, "$1,$2")));
	return num;
}


//ボタンで数値を増減させる
function plus(chk){
	var value = document.getElementById( chk ).value;
	if( value == '' ){ value = 0; }
	value++;

	document.getElementById( chk ).value = value;

	PriceSum();
}
function minus(chk){
	var value = document.getElementById( chk ).value;
	if( value == '' ){ value = 1; }
	value--;
	if (value<0) { value=0; }

	document.getElementById( chk ).value = value;

	PriceSum();
}


