    
  function changeCurrency(){
			$('#existingcurrencyBalance').hide();
		   $.post('customerPaymentBalance.php', {
		   currencyId:form.counterCurrency.value
		   },
			function(output){
			  $('#existingcurrencyBalance').html(output).fadeIn(10);
		})
	
	}
	//===============================================================
 
	function dollarsRate(){
	//========================================
	    transactType=document.getElementById('transactType').value;
	   if(transactType=='1'){
			$('#rateOfdollar').hide();
			   $.post('customerDollarRate.php', {
			   rateOfDollar:form.counterCurrency.value,
			   dateFind:form.newdate.value
			   },
				function(output){
					$('#rateOfdollar').html(output).fadeIn(10);
			})
	
	    }//end ofif(transactType=='1')
        //-----------		
		if(transactType=='2'){
			$('#rateOfdollar').hide();
			   $.post('customerDollarRate.php', {
			   rateOfDollar:form.counterCurrency.value,
			   dateFind:form.newdate.value
			   },
				function(output){
					$('#rateOfdollar').html(output).fadeIn(10);
			})
	
	    }//end ofif(transactType=='2') 
	
	
	}
 
	//=======================================================================
	function existingCustomerBalance(){
	    $('#customerBalance').hide();
		$.post('customerBalance.php', {
		   currencyId:form.counterCurrency.value,
		   customerNumber:form.customerId.value 
		    
		   },
			function(output){
				$('#customerBalance').html(output).fadeIn(10);
		})
	
	}
	
	//=========================================================
	function hekmat(){

       interval = setInterval("calculate()",1);

      }  
	function calculate(){
	   //=====================================================================
										//Dollar
	   //=====================================================================
	   //customerOfBalanceDollar=document.getElementById('customerdollarAmount').value;
	   
	   /* var decimalCharacter = ".",
       regex = new RegExp("[\\d" + decimalCharacter + "]+", "g"),
       num_Dollarprice=customerOfBalanceDollarP;  
       var customerOfBalanceDollar=+num_Dollarprice.match(regex).join(""); */
	   
	   
	 /*   customerOfPaymentDollarP=document.getElementById('sumDollar').value;
	   var decimalCharacter = ".",
       regex = new RegExp("[\\d" + decimalCharacter + "]+", "g"),
       num_Dollarpayment=customerOfPaymentDollarP;  
       var customerOfPaymentDollar=+num_Dollarpayment.match(regex).join(""); */
	  //====================================================================== 
	   
	   customerOfBalance=document.getElementById('customerAmount').value;
	    
	   currencyAmountP=document.getElementById('currencyAmount').value;
	   var decimalCharacter = ".",
       regex = new RegExp("[\\d" + decimalCharacter + "]+", "g"),
       num_price=currencyAmountP;  
       var currencyAmount=+num_price.match(regex).join("");
	   
	   transactType=document.getElementById('transactType').value;
	   
	    
	   
	   if(transactType=='1'){
	    
		  //newAmountDollar=(customerOfBalanceDollar*1)+(customerOfPaymentDollar*1);
		  newAmount=(customerOfBalance*1)+(currencyAmount*1);
		  //محاسبه موجودی مشتری به حساب پول مورد نظر خودش
	      customerRemain=document.getElementById('customerRemain').value=FormatNumberBy3(newAmount*1);
		  //==================================
		  newamountDollarResult=newAmountDollar.toFixed(5);
	      customerRemaindollar=document.getElementById('customerRemaindollar').value=(newamountDollarResult*1);
	   } 
	   if(transactType=='2'){
	      //newAmountDollar=(customerOfBalanceDollar*1)-(customerOfPaymentDollar*1);
	      newAmount      =(customerOfBalance*1)-(currencyAmount*1);
		  
		  //محاسبه موجودی مشتری به حساب پول مورد نظر خودش
	      customerRemain=document.getElementById('customerRemain').value=FormatNumberBy3(newAmount*1);
		  
		  newamountDollarResult=newAmountDollar.toFixed(5);
		  customerRemaindollar=document.getElementById('customerRemaindollar').value=(newamountDollarResult*1);
	   
	   }  
	    
	}
	//==========================================================
	function calculatDollar(){

       interval = setInterval("dollar()",1);

      }  
	function dollar(){
	
	   
	    currencyAmountP=document.getElementById('currencyAmount').value;
	   var decimalCharacter = ".",
       regex = new RegExp("[\\d" + decimalCharacter + "]+", "g"),
       num_price=currencyAmountP;  
       var currencyAmount=+num_price.match(regex).join("");  
	    
	   //dollarRate=document.getElementById('dollarRate').value;
	    // نرخ قدیم
		  mixData=document.getElementById('dollarmixData').value; 
		  takeData=mixData.split('/');
		  mainrate=takeData[0];
		  unit=takeData[1];
		  
		  var exactresult=currencyAmount/unit;
		    
		  
		   /*  //نرخ جدید
		   changeMixData  =document.getElementById('new_dollarRate').value;
		   changetakeData=changeMixData.split('/');
		   changemainrate=changetakeData[0];
		   changeunit   =changetakeData[1];
		  
		   var changeexactresult=currencyAmount/changeunit;
	      */
	   
	   
	    
	    //new_dollarRate=document.getElementById('new_dollarRate').value;  
	  
	     
	    /*   if(new_dollarRate!=0){
	       row=(changeexactresult*1)*(changemainrate*1);
		   pourCalculat=row.toFixed(2);
	       document.getElementById('sumDollar').value= (pourCalculat*1);
	   }  */
	     //if(new_dollarRate==""){
	       row=(exactresult*1)*(mainrate*1);
		   pourCalculat=row.toFixed(2)
	       document.getElementById('sumDollar').value=(pourCalculat*1)  ;
	
	  // }     
	   
	} 
	//======================================
	 /* function newrate(){
	   profe=document.getElementById('take').value;
	   finalResult=document.getElementById('dollarRate').value=(profe*1);
	 }
	 */
	