﻿
var directorsVal  = "";
var turnoverVal   = "";
var directorFinal = 0;
var turnoverFinal = 0;


function getValue(varname)
{
  var url    = "";
  var qparts = "";
  var query  = "";
  var vars   = "";
  var value  = "";

  // First, we load the URL into a variable
  url = window.location.href;

  if(url.indexOf('?') == -1)
  {
    return "END";
  }

  // Next, split the url by the ?
  qparts = url.split("?");
 
  // Check that there is a querystring, return "" if not
  if (qparts[1] == "")
  {
    return "END";
  }
  else
  {
    // Then find the querystring, everything after the ?
    query = qparts[1];

    // Split the query string into variables (separates by &s)
    vars = query.split("&");

    // Initialize the value with "" as default

    // Iterate through vars, checking each one for varname
    for (i=0;i<vars.length;i++)
    {
      // Split the variable by =, which splits name and value
      var parts = vars[i].split("=");

      // Check if the correct variable
      if (parts[0] == varname)
      {
        // Load value into variable
        value = parts[1];

        // End the loop
        break;
      }
    }

    // Convert escape code
    value = unescape(value);

    // Convert "+"s to " "s
    value.replace(/\+/g," ");

    // Return the value
    return value;
  }
  return "END";
}

function getPSterling(value)
{
  return ("£"+value);
}

function getMonthly(value)
{
  var temp = ((value*1.175)/12);
  return temp.toFixed(2);
}

directorsVal = getValue("directors");
turnoverVal = getValue("turnover");



if((directorsVal != "END") && (turnoverVal != "END"))
{

  if(directorsVal == "1")
  {
    directorFinal = 0;
    document.forms[0].directors.selectedIndex = 0;
  }
  else if(directorsVal == "2")
  {
    directorFinal = 0;
    document.forms[0].directors.selectedIndex = 1;
  }
  else if(directorsVal == "3")
  {
    directorFinal = 0;
    document.forms[0].directors.selectedIndex = 2;
  }
  else if(directorsVal == "4")
  {
    directorFinal = 0;
    document.forms[0].directors.selectedIndex = 3;
  }
  else if(directorsVal == "5")
  {
    directorFinal = 0;
    document.forms[0].directors.selectedIndex = 4;
  }

  if(turnoverVal == "1")
  {
    turnoverFinal = 600;
    document.forms[0].turnover.selectedIndex = 0;
  }
  else if(turnoverVal == "2")
  {
    turnoverFinal = 750;
    document.forms[0].turnover.selectedIndex = 1;
  }
  else if(turnoverVal == "3")
  {
    turnoverFinal = 900;
    document.forms[0].turnover.selectedIndex = 2;
  }
  else if(turnoverVal == "4")
  {
    turnoverFinal = 1200;
    document.forms[0].turnover.selectedIndex = 3;
  }
  else if(turnoverVal == "5")
  {
    turnoverFinal = 1500;
    document.forms[0].turnover.selectedIndex = 4;
  }
  else if(turnoverVal == "6")
  {
    turnoverFinal = 2000;
    document.forms[0].turnover.selectedIndex = 5;
  }
  else if(turnoverVal == "7")
  {
    turnoverFinal = 3000;
    document.forms[0].turnover.selectedIndex = 5;
  }
  var totalPrice = (directorFinal+turnoverFinal);

  document.write("");
    
  document.write("<p class=\"ordinaryText\"><span class=\"ordinaryTextHeader\">The price for one year would be <em>" + 
    getPSterling(totalPrice) + "</em> + VAT</span><br />This would be payable in monthly installments of <em>" +                  getPSterling(getMonthly(totalPrice)) + "</em></p>");

  document.write("<div class=\"ordinaryText\"> <span class=\"ordinaryTextHeader\"> How does it work? </span> <br /> We have analysed our current clients and those who we wish to attract and broken them into blocks based on number of principals (partners or directors) and the turnover of the business and that is it. We assign a fee to that block and that is what everyone in that block pays. <br /> <br /> The services included are: <ul> <li>Preparation of annual accounts in whichever format, i.e. Sole Trader, Partnership or Limited Company </li> <li>Corporation Tax or Partnership Tax Return</li> <li>Personal Tax Returns for all principals</li> <li>Any general advice, correspondence and queries that the client has</li> <li>All dealings with the Inland Revenue short of a full enquiry.</li> </ul> All fees are fixed for a period of 2 years and must be paid by monthly standing order commencing the 1st of the month after joining us. Anyone not wishing to pay by standing order may add 10\% to the quote for it to still be valid. <br /> <br /> Further services such as Management accounting, VAT return preparation and payroll can all be added and will be quoted for on a case by case basis. </div>");
}