function updateTotal(){
	var products = document.getElementsByName("ids[]");
	var grandTotal = 0;
	for(x=0;x<products.length;x++){
		var id = products[x].value;
		var qty = CheckInt(eval('document.getElementById("qty_'+id+'").value'));
		var price = CheckFloat(eval('document.getElementById("price_'+id+'").value'));
		var total = qty*price;
		grandTotal += total;
		if(total != 0){
			document.getElementById('total_'+id).value = total.toFixed(2);
		}
	}
	document.getElementById('grandTotal').value = '$'+grandTotal.toFixed(2);
}
function CheckFloat(value){	
	var vld_Float =/^((\d+(\.\d*)?)|((\d*\.)?\d+))$/;
	if(eval(vld_Float).test(value)==false){
		return 0;
	}	
	return value;
}
function CheckInt(value){	
	var vld_INT = /^\d+$/ ;
	if(eval(vld_INT).test(value)==false){
		return 0;
	}	
	return value;
}
