function calcRates() {
<!--OPEN THIS FILE'S PROPERTIES AND CHANGE TO POUND SIGN ON SPECIFIC TAB-->
  var poundages = new Array();
  var propertyType = document.calcform.proptype;
<!--Domestic 2010/2011-->
  if (propertyType[0].checked) {
  	  poundages = [0.007335, 0.006419, 0.007673, 0.007372, 0.007119, 0.007222, 0.006714, 0.007426, 
	  0.005715, 0.006756, 0.006456, 0.007469, 0.007702, 0.007054, 0.006240, 0.006175, 0.007249, 
	  0.007703, 0.006191, 0.006288, 0.007447, 0.006895, 0.006984, 0.006454, 0.007407, 0.007143];

  }
<!--Non-domestic 2010/2011-->
  else
  {
	  poundages = [0.587311, 0.539220, 0.609602, 0.580586, 0.581175, 0.579709, 0.577995, 0.587172, 
	  0.482348, 0.546418, 0.532388, 0.557449, 0.591561, 0.568129, 0.522751, 0.494043, 0.555330, 
	  0.588833, 0.504832, 0.519799, 0.618467, 0.548473, 0.571229, 0.518588, 0.542789, 0.549006];
  }


    var valuation = document.calcform.valuation.value;
    var councilIndex = document.calcform.council.options[document.calcform.council.selectedIndex].value;


    if (valuation == '' || isNaN(valuation)) {
      alert('The Property Valuation must be a number');
      document.calcform.valuation.focus();
    }
    else {
        if ((propertyType[0].checked) && (valuation > 500000))  //domestic
        {
           valuation = 500000;
        } 
    	document.calcform.rates.value = Math.round (valuation * poundages[councilIndex] * 100) /100;
    }
    return;
  }


function showLink(propertyType) {
    if (propertyType == 'domestic') {
        document.getElementById('valuelink').innerHTML="Capital valuation of your domestic property"
        document.getElementById('valuelink').href="http://pip.vla.nics.gov.uk/search.asp?submit=form"
    }
    else {
        document.getElementById('valuelink').innerHTML="NAV-based valuation of your non-domestic property"
        //document.getElementById('valuelink').href="http://cmslist5.vla.nics.gov.uk/search.asp?submit=form"
		document.getElementById('valuelink').href="http://lpsni.gov.uk/vListNDN/search.asp?submit=form"  
    }
}        


function showCalc() {
        document.writeln('<div class="extra" id="calculator">');
        document.writeln('<h2 class="nav">Rates Calculator</h2><!--calculator-->');
        document.writeln('<form name="calcform">');
        document.writeln('<fieldset><legend>Property Type</legend>');
        document.writeln('<input class="radio" type="radio" checked="checked" value="domestic" name="proptype" id="domestic" onClick="showLink(this.value)"/>');
        document.writeln('<label for="domestic">Domestic</label><br />');
        document.writeln('<input class="radio" id="business" type="radio" value="commercial" name="proptype" id="commercial" onClick="showLink(this.value)"/> ');
        document.writeln('<label for="business">Business</label></p></fieldset>');
        document.writeln('<p><a id="valuelink" href="http://pip.vla.nics.gov.uk/search.asp?submit=form" target="_blank">Capital valuation of your domestic property</a>:<br />');
        document.writeln('<input class="calcform" onfocus="select()" size="7" name="valuation" /></p>');
        document.writeln('<p><label for="council">Council Area:</label><br />');
        document.writeln('<select class="calcform" name="council" id="council" >');
        document.writeln('<option value="0" selected="selected">Antrim</option>');
        document.writeln('<option value="1">Ards</option> ');
        document.writeln('<option value="2">Armagh</option>');
        document.writeln('<option value="3">Ballymena</option>');
        document.writeln('<option value="4">Ballymoney</option>');
        document.writeln('<option value="5">Banbridge</option> ');
        document.writeln('<option value="6">Belfast</option>');
        document.writeln('<option value="7">Carrickfergus</option>');
        document.writeln('<option value="8">Castlereagh</option>');
        document.writeln('<option value="9">Coleraine</option>');
        document.writeln('<option value="10">Cookstown</option>');
        document.writeln('<option value="11">Craigavon</option>');
        document.writeln('<option value="12">Derry</option>');
        document.writeln('<option value="13">Down</option>');
        document.writeln('<option value="14">Dungannon</option>');
        document.writeln('<option value="15">Fermanagh</option>');
        document.writeln('<option value="16">Larne</option>');
        document.writeln('<option value="17">Limavady</option>');
        document.writeln('<option value="18">Lisburn</option>');
        document.writeln('<option value="19">Magherafelt</option> ');
        document.writeln('<option value="20">Moyle</option>');
        document.writeln('<option value="21">Newry/Mourne</option> ');
        document.writeln('<option value="22">Newtownabbey</option>');
        document.writeln('<option value="23">North Down</option>');
        document.writeln('<option value="24">Omagh</option>');
        document.writeln('<option value="25">Strabane</option>');
        document.writeln('</select></p>');
        document.writeln('<input type="button" value="calculate" onclick="calcRates()" />');
        document.writeln('<p><label for="rates">Annual Rates (in pounds):</label>');
        document.writeln('<br /><input class="calcform" onfocus="this.blur()"  size="7" name="rates" id="rates" /></p>');
        document.writeln('<p><small><a href="rates_calculation.html">Please use this rates calculator as a guide only. The Annual Rates amount above does not include any exemptions, allowances or reliefs you may be entitled to.</a></small></p>');
        document.writeln('</form>');
        document.writeln('</div>');
}
