function field(i) { 
	this.id = ""; 
	this.name = "";
	this.price = 0;
	this.total = 0;
	return; 
}

var fields = new Array();
var counter2=0;

function start() {
	getitems(); 

	inf=document.getElementById("totalitems"); 
	inf.innerHTML=totalitems(); 
	inf1=document.getElementById("totalcharge"); 
	inf1.innerHTML=totalcharge();
}

function getitems() { 
	if(itemlist == -1) 
		return 0;
	end=-1;
	while(end<itemlist.length) {
		lastend=end+1;
		end = itemlist.indexOf(":",lastend); 
		if (end == -1) return 0;
		value = itemlist.substring(lastend, end); 
		middle= value.indexOf("C"); 
		id=value.substring(0,middle); 
		middle1= value.indexOf("-"); 
		price=value.substring(middle+1,middle1); 
		quantity=value.substring(middle1+1, value.length); 

		counter2++;
		fields[counter2] = new field(counter2); 
		fields[counter2].id=id; 
		fields[counter2].quantity=quantity; 
		fields[counter2].price=price; 
		fields[counter2].total=price*quantity; 
	} 
	return; 
} 

function totalitems() { 
	var totalquantity=0;
	for (i=1; i<=counter2; i++) {
		if(fields[i].quantity>0)
			totalquantity += fields[i].quantity*1;
	}
	return(totalquantity);
} 

function totalcharge() { 
	var total=0;
	for (i=1; i<=counter2; i++) 
		total += fields[i].total*1.00;
	total=roundvalue(total);
	return(total);
}
