function editAmmount(){
		$(".editbleField").click(function(){
		var id=$(this).attr("name")
		 $(this).replaceWith('<select name="'+id+'" id="a_'+id+'" ></select>'   );
		 option='';
			 for(j=1;j<32;j++){
				option+='<option ';
				if (j==Number($(this).text())) option+=' selected="selected" ';
				option+=' value="'+j+'" >'+j+'</option>'; 
			 }
			 $("#a_"+id).html(option).change(function(){
			 $(this).replaceWith('<span class="editbleField" name="'+ $(this).attr("name")+'">'+ $(this).val()+'</span>'   );	
			$.get('/redrental/editAmmount.asp?r='+rnd(),{'id':$(this).attr("name"),'days':$(this).val()},function(data){				  
				 setMoney(data,id);
				  editAmmount();
			 });	
		});
	  });	
}
function zebra(){
$(".cartRow").removeClass("dark");	
$(".cartRow:odd").addClass("dark");	

}
function setMoney(data,id){
					var up=data.split(",");
				 $("#"+id ).html(formatCurrency(up[0]));
				 $("#totalA").html(formatCurrency(up[1]));
}
$(function(){
			zebra();
			editAmmount();
});
function rnd(){return (Math.random()*parseInt(666)).toFixed(9);}
function formatCurrency(strValue)
{
	strValue = strValue.toString().replace(/\$|\,/g,'');
	dblValue = parseFloat(strValue);
	blnSign = (dblValue == (dblValue = Math.abs(dblValue)));
	dblValue = Math.floor(dblValue*100+0.50000000001);
	intCents = dblValue%100;
	strCents = intCents.toString();
	dblValue = Math.floor(dblValue/100).toString();
	if(intCents<10)
		strCents = "0" + strCents;
	for (var i = 0; i < Math.floor((dblValue.length-(1+i))/3); i++)
		dblValue = dblValue.substring(0,dblValue.length-(4*i+3))+','+
		dblValue.substring(dblValue.length-(4*i+3));
	return (((blnSign)?'':'-') + '$' + dblValue + '.' + strCents);
}
function calcTotal(l){
		var totalAmmountV=formatCurrency($('#totalAmmount').attr("value")*l);													 
		 $('#totalPrice').html(totalAmmountV);
		 $('#totalDays').html(l);
		 $('#totalPD').show();
		 $('#daysValue').attr("value",i);
		 $('#totalValue').attr("value",totalAmmountV);
	};
