
function changeTwoDecimal(x)  //该函数取四舍五入取小数点后两位
　　{
　　var f_x = parseFloat(x);
　　if (isNaN(f_x))
　　{
　　alert('function:changeTwoDecimal->parameter error');
　　return false;
　　}
　　var f_x = Math.round(x*100)/100;
　　return f_x;
　　}



function js(){                //该函数实现计算总价和单价功能
 var mail_number=document.getElementById("mail_number").value;
 var mail_month=document.getElementById("mail_month").value;
 
 var total_number=mail_number*(12/mail_month);
 var total_fee=11*total_number;
 
    if (total_fee<34) {
       total_fee=total_fee+5;
    
    }
 
    if (total_fee > 132) {
       total_fee=total_fee*0.99;
    
    }
    if (total_fee > 200) {
       total_fee=total_fee*0.98;
    
    }
     if (total_fee > 300) {
       total_fee=total_fee*0.97;
    
    }
     if (total_fee > 400) {
       total_fee=total_fee*0.95;
    
    }
     if (total_fee > 500) {
       total_fee=total_fee*0.94;
    
    }
	if (total_fee > 600) {
       total_fee=total_fee*0.93;
    
    }
	if (total_fee > 700) {
       total_fee=total_fee*0.92;
    
    }
	if (total_fee > 800) {
       total_fee=total_fee*0.9;
    
    }
    
 var average_fee=total_fee / total_number;
 
 document.getElementById("total_number").innerHTML=total_number;
 document.getElementById("total_fee2").innerHTML=Math.round(total_fee);
 document.getElementById("average_fee").innerHTML=changeTwoDecimal(average_fee);  //Math.round 函数四舍五入取整
 document.getElementById("total_fee").value=Math.round(total_fee);
 
}


function check_null(){
		if (document.chooseform.total_fee.value==""){
			alert("请先选择邮寄组合！");
			return false;
		}

}



//................以上为自选套装计算...........................