function caltex(){
	var p1 = document.all.gongzi.value;
	var p2 = document.all.sijin.value;
	var p3 = document.all.laowu.value;
	var p4 = document.all.texuquan.value;
	var p5 = document.all.lixi.value;
	var p6 = document.all.gaochou.value;
	var p7 = document.all.place.value;
	
	var flag1,flag2,flag3,flag4,flag5,flag6,flag7;
	flag1=false;
	flag2=false;
	flag3=false;
	flag4=false;
	flag5=false;
	flag6=false;
	flag7=false;
	
	if(p1.length==0 || p1==0){
		flag1=true;	
		document.all.gongzi.value=0;
	}
	if(p2.length==0 || p2==0){
		flag2=true;	
		document.all.sijin.value=0;
	}
	if(p3.length==0 || p3==0){
		flag3=true;	
		document.all.laowu.value=0;
	}
	if(p4.length==0 || p4==0){
		flag4=true;	
		document.all.texuquan.value=0;
	}
	if(p5.length==0 || p5==0){
		flag5=true;	
		document.all.lixi.value=0;
	}
	if(p6.length==0 || p6==0){
		flag6=true;	
		document.all.gaochou.value=0;
	}
	if(p7==0){
		flag7=true;	
	}
	
	if(flag1 && flag3 && flag4 && flag5 && flag6){
		alert("请至少输入一个值！");
		return ;
	}
	if(flag7){
		alert("请选择工作所在地！");
		document.all.place.focus();
		return ;
	}
	
	document.all.suodeshui.value=calSuoDeShui(p1,p2,p3,p4,p5,p6,p7);
}
function calSuoDeShui( income1,income2,income3,income4,income5,income6,city ){
	
	var gzrate = new Array(	
				new Array(0,5,0),
				new Array(500,10,25),
				new Array(2000,15,125),
				new Array(5000,20,375),
				new Array(20000,25,1375),
				new Array(40000,30,3375),
				new Array(60000,35,6375),
				new Array(80000,40,10375),
				new Array(100000,45,15375)
			);

	var base = new Array(0,1000,1000,1600,800);
	
	var tex,tex1,tex2,tex3,tex4,tex5;
	tex=0;
	tex1=0;
	tex2=0;
	tex3=0;
	tex4=0;
	tex5=0;
	
	var tmp;
	var i;

	// tex1:
	tmp = income1-income2-base[city];
	if(tmp>0){
		for(i=0; i<gzrate.length; i++){
			if(tmp<=gzrate[i][0]) break;
		}
		i--;
		tex1 = tmp * gzrate[i][1] / 100 - gzrate[i][2];
	}
	// tex2:
	if(income3<=0){
		tex2 = 0;
	}else if(income3<=4000){
		tex2 = (income3-800)*20/100;
	}else if(income3<=25000){
		tex2 = income3*80/100*20/100;
	}else if(income3<=62500){
		tex2 = income3*80/100*30/100 - 2000;
	}else{
		tex2 = income3*80/100*40/100-7000;
	}
	
	
	//tex3:
	if(income4<=0){
		tex3 = 0;
	}else if(income4<=4000){
		tex3 = (income4-800)*20/100;
	}else{
		tex3 = income4*80/100*20/100;
	}
	
	
	//tex4:
	tex4 = income5 * 20 /100;
	
	
	//tex5:
	if(income6<=0){
		tex5 = 0;
	}else if(income6<=4000){
		tex5 = (income6-800) * 20 /100 * 70 /100;
	}else{
		tex5 = income6 * 80 /100 * 20 / 100 * 70 / 100 ;
	}
	
	
	//alert(income1 + " " + income2 + " " + income3 + " " + income4 + " " + income5 + " " + income6 + " " + city );
	if(tex1>0){ tex = tex + tex1; }
	if(tex2>0){ tex = tex + tex2; }
	if(tex3>0){ tex = tex + tex3; }
	if(tex4>0){ tex = tex + tex4; }
	if(tex5>0){ tex = tex + tex5; }
	
	return tex ;
}







