
/* This script is created by Paul Strickberger
and may not be copied or used without the permission of the
author. The author may be reached at paul@primeimpression.com.*/


function CalculateFee(x)
 		
    {
      var fee="";
      var ResFee="";
      var GoodResult = true;
             				
		if (x <= 20000) {
		fee = 40;
		ResFee = 95;
		GoodResult = true;
		}
		   {
      			if (x >= 20000 && x < 30000) {
          			fee = 50;
          			ResFee = 150;
				//based on 2.5 hours=$100
    			}

    			if (x >= 30000 && x < 40000) {
          			fee = 60;
          			ResFee = 180;
				//based on 3.0 hours=$180
    			}

      			if (x >= 40000 && x < 50000) {
          			fee = 65;
          			ResFee = 210;
				//based on 3.0 hours=$190
    			}
    	
    			if (x >= 50000 && x < 60000) {
    				fee = 70;
          			ResFee = 230;
				//based on 3.0 hours=$210
          			}
    	
    			if (x >= 60000 && x < 70000) {
				fee = 75;
          			//fee = Math.round(x * .0012);
				ResFee = 270;
				//based on 3.5 hours=$262
          			//ResFee = fee * 4 - 40;
    				}
    	
    			if (x >= 70000 && x < 80000) {
          			fee = 80;
          			ResFee = 290;
				//based on 3.6 hours=$288
    				}

   			if (x >= 80000 && x < 90000) {
          			fee = 85;
          			ResFee = 320;
				//based on 4.0 hours=$340
    				} 
   	
    			if (x >= 90000 && x < 120000) {
         			fee = 90;
          			ResFee = 350;
				//based on 4.0 hours=$360
          			}
          
          		if (x >= 120000) {
          			fee = 100;
          			ResFee = 390;
				//based on 4.0 hours=$400
          			}
          
         ResFee = ("$" + ResFee + ".00");
         fee = ("$" + fee + ".00");
				 zappa.Fee.value = fee;
         zappa.Resume.value = ResFee;
        }
                             
      }
      	//see integer test function below
     		/*function isInteger(value) {
  				return (parseInt(value) == value);
					}*/
          
         function clean (w){
         	spacing="";//add spacing or $ sign if desired
            	max_length=12;
			
		    if(w.value < 0 ){
        	    	alert("Please enter your salary as a positive number.");         
        	    	return(0);
		    }
        			//Tests to see if w.value is integer but does not ignore commas
    				/*if (!isInteger(w.value)){
    				alert("Please enter your salary as a number.");
    				return(0);
    				}*/ 
				
			
        	y="0"+w.value;          	//0 to prevent NaN
        	yl=y.length;			//y1 is now equal to the length of y
        	for(z=0;z<yl;z++){		//loops through length (y1)	
        		if(y.charAt(z)<"." || y.substring(z,z+1)>"9" || y.substring(z,z+1)=="/"){
        			y=(y.substring(0,z) + y.substring(z+1));
        			z--;
        			yl--;
        		}
        	}
        	y=parseFloat(y);
         	x=Math.floor(y);
        	xx=y-x;
        	xx=xx+"00.00"                 //xx=the cents only (with zeroes).
        	a=xx.indexOf(".");
        	q=x+xx.substring(a,a+3);
        
        	ql= (q.length < max_length)?(max_length-q.length):0;
        	w.value=(y)?spacing.substring(0,ql)+q:"";
        	r=parseFloat(q);                            //should be dddd.dd
        	w2=w;
          //alert("w=" + w.value); test to see what w is
          //return r;
          CalculateFee(r); 
                   
        }

