/**include
//_javascript/load-wrapper.js;
*/

/**
 * Modal window control
 *
 */
var orderSum = newObject({
	total	: null,
	array	: [],
	
	init : function () {
	},
	
	onready : function () {
        this.array = this.$$("#table td#td_*");
        if (this.array) {
        	for(i = 0; i < this.array.length; i++) {
	           this.array[i].addListener(this, "onkeyup").n = i;
	        }
	        this.total = this.$("#table #total").getChildren()[0];	
        }
	},
	
	onkeyup : function(evtWr, dt)
    {
        evtWr.eventDrop();
        evtWr.stopBubbling();
        evtWr.elmWr.elm.blur();
        
        sum = 0;
        for(i = 0; i < this.array.length; i++) {
			price = this.array[i].elm.id.substr(3);
			count = this.array[i].getChildren()[0].elm.value;
			sum += price*count;
        }
    	this.total.elm.value = sum;
    },
});
