$(document).ready(function(){
	$(".ListAll").click(function(){
			var selectID=$(this).val();
			var cancelAmount=$("#or_"+selectID).text();
			var hidAdj=$("#HidAdjustableAmount").text();
			var hidNeedpay=$("#needToPay").text();
			var currencySymbolLeft=$("#currencySymbolLeft").val();
			var currencySymbolRight=$("#currencySymbolRight").val();
			var HidAdjustableAmount;
			var needToPayShow;
		if($(this).prop('checked')){
			$("#AdjustableAmount").text("");
			var netAdjAmount=parseFloat(hidAdj)+parseFloat(cancelAmount);
			netAdjFloatAmount=netAdjAmount.toFixed(2);
			var netAmountFloat =parseFloat(hidNeedpay)-parseFloat(cancelAmount);
			netAmount=netAmountFloat.toFixed(2);
			if(currencySymbolLeft!=''){
				HidAdjustableAmount=currencySymbolLeft+netAdjFloatAmount;
				needToPayShow=currencySymbolLeft+netAmount;
			}else{
				HidAdjustableAmount=currencySymbolRight+netAdjFloatAmount;
				needToPayShow=currencySymbolRight+netAmount;
			}
			$("#AdjustableAmount").text(HidAdjustableAmount);
			$("#HidAdjustableAmount").text(netAdjAmount);
			$("#needToPay").text("");
			$("#needToPay").text(netAmount);
			$("#needToPayShow").text(needToPayShow);
		}else{
			$("#AdjustableAmount").text("");
			var netAdjAmount=parseFloat(hidAdj)-parseFloat(cancelAmount);
			netAdjFloatAmount=netAdjAmount.toFixed(2);
			var netAmountFloat =parseFloat(hidNeedpay)+parseFloat(cancelAmount);
			var netAmount=netAmountFloat.toFixed(2);
			if(currencySymbolLeft!=''){
				HidAdjustableAmount=currencySymbolLeft+netAdjFloatAmount;
				needToPayShow=currencySymbolLeft+netAmount;
			}else{
				HidAdjustableAmount=currencySymbolRight+netAdjFloatAmount;
				needToPayShow=currencySymbolRight+netAmount;
			}
			$("#AdjustableAmount").text(HidAdjustableAmount);
			$("#HidAdjustableAmount").text(netAdjFloatAmount);
			$("#needToPay").text("");
			$("#needToPay").text(netAmount);
			$("#needToPayShow").text(needToPayShow);
		}
	 });
$("#submitTransaction").click(function(){
			var hidNeedpay=$("#needToPay").text();
	   if(parseFloat(hidNeedpay)<0){
		   jAlert(msgAdjustableamountRollback)	;
	   return false;
	   }
	  if($.trim($("#affiliateTransDescription").val())==''){
		jAlert(msgEnterTransactionNoteForAdmin)	;
		return false;
		}
		if($.trim($("#transactionDescrForAffiliate").val())==''){
		jAlert(msgEnterTransactionNoteForAffiliate)	;
		return false;
		}		
});

});
function ismaxlength(obj)
{
   var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
   if (obj.getAttribute && obj.value.length>mlength){
   obj.value=obj.value.substring(0,mlength)
    jAlert(lblMaxCharaLength);
	}
}