// javascript Document

/* for root directory files <script type="text/javascript" language="javascript" src="java.js"></script>*/
/* for the next level down  <script type="text/javascript" language="javascript" src="../java.js"></script>*/
/* <li><a href="../status.htm" [FROM HERE]onmouseover="showtext('REQUIRED TEXT')" onmouseout="hidetext()"[TO HERE]>Tax topics</a> </li>*/

/* from here transferred in 17.7.10 */
body:var baseopacity=0

body:function showtext(thetext){
if (!document.getElementById)
return
textcontainerobj=document.getElementById("tabledescription")
browserdetect=textcontainerobj.filters? "ie" : typeof textcontainerobj.style.MozOpacity=="string"? "mozilla" : ""
instantset(baseopacity)
document.getElementById("tabledescription").innerHTML=thetext
highlighting=setInterval("gradualfade(textcontainerobj)",50)
}

body:function hidetext(){
cleartimer()
instantset(baseopacity)
}

body:function instantset(degree){
if (browserdetect=="mozilla")
textcontainerobj.style.MozOpacity=degree/100
else if (browserdetect=="ie")
textcontainerobj.filters.alpha.opacity=degree
else if (document.getElementById && baseopacity==0)
document.getElementById("tabledescription").innerHTML=""
}

body:function cleartimer(){
if (window.highlighting) clearInterval(highlighting)
}

body:function gradualfade(cur2){
if (browserdetect=="mozilla" && cur2.style.MozOpacity<1)
cur2.style.MozOpacity=Math.min(parseFloat(cur2.style.MozOpacity)+0.2, 0.99)
else if (browserdetect=="ie" && cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=20
else if (window.highlighting)
clearInterval(highlighting)
}

/* to here transferred in 17.7.10 */

/************** 18.2.11 appendixdescription *****************/
/* 
body:var baseopacity=0

body:function showtext(thetext){
if (!document.getElementById)
return
textcontainerobj=document.getElementById("appendixdescription")
browserdetect=textcontainerobj.filters? "ie" : typeof textcontainerobj.style.MozOpacity=="string"? "mozilla" : ""
instantset(baseopacity)
document.getElementById("appendixdescription").innerHTML=thetext
highlighting=setInterval("gradualfade(textcontainerobj)",50)
}

body:function hidetext(){
cleartimer()
instantset(baseopacity)
}

body:function instantset(degree){
if (browserdetect=="mozilla")
textcontainerobj.style.MozOpacity=degree/100
else if (browserdetect=="ie")
textcontainerobj.filters.alpha.opacity=degree
else if (document.getElementById && baseopacity==0)
document.getElementById("appendixdescription").innerHTML=""
}

body:function cleartimer(){
if (window.highlighting) clearInterval(highlighting)
}

body:function gradualfade(cur2){
if (browserdetect=="mozilla" && cur2.style.MozOpacity<1)
cur2.style.MozOpacity=Math.min(parseFloat(cur2.style.MozOpacity)+0.2, 0.99)
else if (browserdetect=="ie" && cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=20
else if (window.highlighting)
clearInterval(highlighting)
}

*/
/* 18.2.11 end of appendixdescription*/

/* font size 10.9.10 */
var min=8;
var max=22;
function increaseFontSize() {

   var p = document.getElementsByTagName('p');
  
for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=max) {
         s += 1;
      }
      p[i].style.fontSize = s+"px"
   }
}



function decreaseFontSize() {
   var p = document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=min) {
         s -= 1;
      }
      p[i].style.fontSize = s+"px"
   }   
}

/* try a 10.9.10; this increases a tags but overrides the increase in p
10.2.11 also not effective with 'p','h2' or 'p'+'h2' or repeating the whole increase code with h2
one supercedes the other.   Same with 'li' effective but supercedes. According to the write up this seems to be the limitation of this code.

function increaseFontSize() {
   var a = document.getElementsByTagName('a');
   for(i=0;i<a.length;i++) {
      if(a[i].style.fontSize) {
         var s = parseInt(a[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=max) {
         s += 1;
      }
      a[i].style.fontSize = s+"px"
   }
}
*/
/* end of font size 10.9.10 */

/* 2.7.11 cis and vat invoice *****************************************************/

<!-- labour do these later-->
<!-- materials do these later -->
<!-- total invoiced before VAT-- form.donation.value>
<!-- add VAT --><!-- VAT rate %-- calcrate from form.basictax.value>
<!-- Total including VAT -->
<!-- less CIS --><!-- CIS rate %-->
<!-- Net after CIS deduction -->
<!-- If you need a version which takes account of retentions, prepaid deposits and deduction of previous amounts invoiced go to ??? -->
<!-- money is the running figure through the calculations -->
<!--  -->
function computeForm(form) {

labour=form.labour.value * 1;  //input amount
labour=Math.round(100*labour)/100;
form.labour.value = labour.toFixed(2);

materials=form.materials.value * 1;  //input amount
materials=Math.round(100*materials)/100;
form.materials.value = materials.toFixed(2);

labourandmaterials=labour+materials;
form.labourandmaterials.value=labourandmaterials
form.labourandmaterials.value = labourandmaterials.toFixed(2);

//form.invincvat.value = invincvat.toFixed(2);

vatpercentage=form.vatpercentage.value; //input amount
//form.vatpercentage.value = vatpercentage.toFixed(2);

vat=labourandmaterials * vatpercentage / 100;
 vat=Math.round(100*vat)/100;
form.vat.value=vat;
form.vat.value = vat.toFixed(2);
//
  

// 
// 
// form.cisrate.value = cisrate.toFixed(2);
// form.cisdeducted.value = cisdeducted.toFixed(2);





invincvat=labourandmaterials+vat;
form.invincvat.value=invincvat;
form.invincvat.value = invincvat.toFixed(2);

cisrate=form.cisrate.value

cisdeducted=labour*cisrate / 100;
cisdeducted=Math.round(100*cisdeducted)/100;
form.cisdeducted.value=cisdeducted
form.cisdeducted.value = cisdeducted.toFixed(2);

invincvatlesscis=invincvat - cisdeducted;
form.invincvatlesscis.value=invincvatlesscis;
form.invincvatlesscis.value = invincvatlesscis.toFixed(2);


/* 11.7.11 Construction Industry Scheme Statement of payment and deduction *****************************************************/

//grosspaid
//lessmaterials
//amountfordeduction
//deductedrate
//amountdeducted
//amountpayable

/* 11.7.11 end of Construction Industry Scheme Statement of payment and deduction *****************************************************/



<!-- ************************************************************************************************** -->
calcrate = (form.basictax.value / (100 - form.basictax.value))+1;
<!--  example 20/100-20 +1 = 1.25 VAT rate %    Retained b/f example -->

money= 100 * form.donation.value * calcrate;
<!--  example 1.00 x £100 x 1.25 = £125  labour  Used b/f example -->

highrate = 40
<!--  example given higher rate, not a variable    Retained b/f example-->

claimback = 100* money * ((highrate - form.basictax.value)/100);
<!--  example 1.00 x £125 x (40% - 20%)/1.00 = £25    Retained b/f example-->

claimback= (Math.round(claimback))/100;
<!--  example already a round amount but, if not, rounded to pounds and pence1.00-->
<!-- claimback is a figure which is not shown on the form    Retained b/f example-->
form.highrec.value=claimback
<!----------------------------------   Retained b/f example-->

<!--  VAT calculation ------------------------------------------------------->
xprevat= form.donation.value;//<! change from donation to labour----------------------------------   Retained b/f example-->
xvatrate= (form.basictax.value / 100)
form.xvat.value = xprevat * xvatrate;

//vatmoney= (form.donation.value * vatrate + 100);<!--   -->
xvatmoney= xprevat * xvatrate;

<!-- vatmoney= Math.round(vatmoney)/100;  -->
<!--  End of VAT calculation ------------------------------------------------->

<!-- invoice including VAT ---------------------------------------------------->
form.xinvincvat.value= xprevat + xvatmoney; 

<!--  CIS deduction calculation ----------------------------------------------->
xcismoney=form.donation.value;
xcis= form.xcisrate.value;
form.xcisded.value = (xcismoney * xcis / 100);

<!--  End of CIS deduction calculation ---------------------------------------->


<!--  assumed Used b/f examples ------------------------------------------->
money= (Math.round(money))/100;
<!--  example already a round amount but, if not, rounded to pounds and pence 1.00-->

form.amount.value = money.toFixed(2); 
<!--  example same as money fixed on calculation £125 ready for further calculations-->

<!--  end of assumed Used b/f examples -------------------------------------->

<!--  example same as claimback = £25 -->
<!-- name="highrec"> is the final box-->
}



/* 2.7.11 end of cis and vat invoice *****************************************************/
