var sumTotal = (function() {
	var $bidTable = $(".salestable.first, .salestable.second"),
		$targetTable = null,
		$targetRow = null,
		$targetColumn = null,
		lastIndex = 0,
		total = null;

	$.each($bidTable, function() {
		$targetTable = $(this),
		$targetRow = $targetTable.find('tr:gt(2)').not('.salestotal'),
		lastIndex = $targetRow.length - 1,
		total = {};

		$.each($targetRow, function(r_idx) {
			$targetColumn = $(this).find('td:gt(0)');

			$.each($targetColumn, function(c_idx) {
				if (r_idx === 0) {
					total['data'+c_idx] = 0;
				}
				total['data'+c_idx] += Number($(this).text());

				if(r_idx === lastIndex) {
					$targetTable.find('.salestotal').find('td:eq(' + parseInt(c_idx + 1) + ')').text(total['data' + c_idx]);
				}
			});
		});
	});
})();
