function	atocurr( x ) {

   var num, decnum, decstr, retval;

   x = "" + eval( x );

   num = parseInt( x );

   if( isNaN( num ) ) num = 0;

   decnum = Math.abs( parseFloat( x ) - num );

   if( isNaN( decnum ) ) decnum = .0;

   decnum *= 100;

   decstr = "" + Math.abs( Math.round( decnum ) );

   while( decstr.length < 2 )	{

    decstr = "0" + decstr;

   }

   retval = "£" + num + "." + decstr ;


   return retval;

  }

  

  function	atof( x ) {

   if ( isNaN( parseFloat( x ) ) ) {

    return 0;

   } else	{

    return parseFloat( x );

   }

  }

  

  function recalcsal( ) {

   var i = .0;

   i += atof( document.myform["ap1sal"].value );

   i += atof( document.myform["ap2sal"].value );

   document.myform["totsal"].value = i;

  }

  

  function recalccredit( ) {

   var i =.0;

   i += atof( document.myform["ap1credit"].value );

   i += atof( document.myform["ap2credit"].value );

   i *= 12;

   document.myform["totcredit"].value = i;

  }

  

  function recalcnet( ) {

  	var i = .0;

   i += atof( document.myform["totsal"].value );

   i -= atof( document.myform["totcredit"].value );

   document.myform["totincome"].value = i;

  }

  

  function recalcalt1( ) {

  	var x = .0;

   x += atof( document.myform["mult1"].value );

   x *= ( atof( document.myform["ap1sal"].value ) -  (12 * atof( document.myform["ap1credit"].value )) ) ;

   var y = .0;

   y += atof( document.myform["mult2"].value );

   y *= ( atof( document.myform["ap2sal"].value ) -  (12 * atof( document.myform["ap2credit"].value )) ) ;

   document.myform["alt1"].value = x + y;

  }

  

  function recalcalt2( ) {

  	document.myform["alt2"].value = atof( document.myform["totincome"].value ) * atof( document.myform["mult3"].value );

  }

  

  function changesal( ) {

   recalcsal( );

   recalcnet( );

   recalcalt1( );

   recalcalt2( );

  }

  

  function changecredit( ) {

   recalccredit( );

   recalcnet( );

   recalcalt1( );

   recalcalt2( );

  }

