// JavaScript Document
// コンストラクタ
fw.model = function() {
    
}

// インスタンスメソッド
fw.model.prototype = {
    
	getProducts: function(script,mode,product_code,quantity,id){
		var quantities = new Array();
		/*
		$(quantity).each(function(index){
			quantities[index] = $(this).val();
		});
		*/
		var arr = new Array();
		var count = 0;
		arr[count] = "'mode':'" + mode + "'";
		count++;
		requestCount = 0;
		$(product_code).each(function(index){
			productCode = $(this).val();
			if(productCode!=""){
				arr[count] = "'product_code[" + requestCount + "]':'" + productCode + "'";
				//arr[count] +=",'quantity[" + requestCount + "]':'" + quantities[index] + "'";
				count++
				requestCount++;
			}
			else
			{
				//arr[count] = "'product_code[" + index + "]':'null'";
				//arr[count] +=",'quantity[" + index + "]':'null'";
			}
		});

		var param = eval("({" + arr.join(",") + "})");
		jQuery.getJSON(script, param, function(json){
			if(json.url != "")
			{
				window.location.href = json.url;
			}
			fw.view.dispProducts(json,id);
		});
	}
}
