var vcpa1 = 0;
var vcpa2 = 0;
var vcpa3  = 0;
var vcpan1 = 0;
var vcpan2 = 0;
var vcpan3  = 0;
var vfer = 0;
var vcrate  = 0;
var weektot = 0;
var montot = 0;
var vwinc = 0;
var vwrent = 0;
var vincome=0;
var vnokids = 0;
var vincrate=0;
var vfam=0;
function calc(boxes){
<!-- CALCULATING TOTAL)-->
vcpa1 = eval (document.boxes.cpa1.value)
vcpan1 = eval (document.boxes.ncpa1.value)
vcpa2 = eval (document.boxes.cpa2.value)
vcpan2 = eval (document.boxes.ncpa2.value)
vcpa3 = eval (document.boxes.cpa3.value)
vcpan3 = eval (document.boxes.ncpa3.value)
vfer = eval (document.boxes.fixed1.value)
vwinc = eval (document.boxes.weekinc.value)
vwrent = eval (document.boxes.weekrent.value)
vcrate=0
if (eval(document.boxes.cpanc3.value) > 0){
   vcrate=eval(document.boxes.cpafa3.value)
  }
if (eval(document.boxes.cpanc2.value) > 0){
   vcrate=eval(document.boxes.cpafa2.value)
  }
if (eval(document.boxes.cpanc1.value) > 0){
   vcrate=eval(document.boxes.cpafa1.value)
  }
   
vnokids = vcpan1 + vcpan2 + vcpan3
vincrate=0.20
vfam=eval(document.boxes.cbr1.value)+((vnokids-1)*eval(document.boxes.cbr2.value))
vnokids = vcpan1 + vcpan2 + vcpan3
if (vnokids<2){
   vincrate=0.15
  }
weektot = (vcpa1*vcpan1)+(vcpa2*vcpan2)+(vcpa3*vcpan3)+vfer+vcrate-vfam
vincome =vwinc - vwrent   - (2*weektot)
vincome = vincome*vincrate
weektot = weektot + vincome
monthtot=(weektot*52)/12
weektot=Math.round(weektot)
document.boxes.weekbox.value=weektot
monthtot=Math.round(monthtot)
document.boxes.monthbox.value=monthtot

}

<!--
  //
  // These functions are document wide references to image movement
  //
  var loadfile =  location.search.substring(1, location.search.length);
  var lfile = "about.htm"

  if(location.search.length>4){
   lfile = loadfile
	}
	
  var doAll = (document.all!=null)

  function getCSSPElement(id) {    
    // Return the positioned element with
    // the specified ID 
	
    if (doAll)       
      return document.all[id]    
    else
      return document.layers[id]  
     }

    function checkIFrame(destID) {
      var iframe = document.frames[destID+"target"]
      if (iframe==null) {
        document.body.insertAdjacentHTML("beforeEnd","<IFRAME STYLE='width: 0pt; height: 0pt' NAME='"+destID+"target' SRC='' ></IFRAME>")
        iframe = document.frames[destID+"target"]
      }
      return iframe
    }

    function pollIFrame(destID) {
      var destFrame = checkIFrame(destID)
      if (destFrame.document.readyState=='complete') {
        var el = getCSSPElement(destID)
        el.innerHTML = destFrame.document.body.innerHTML
      } else
        setTimeout("pollIFrame('"+destID+"')",200)        
    }

    function updateContents(destID, src) {
	

	  var el = getCSSPElement(destID)
		
      if (doAll) {
        destFrame = checkIFrame(destID)
        destFrame.location.href = src        
        setTimeout("pollIFrame('"+destID+"')",200)
      }
      else
        el.src = src 
						     
    }

    function update(destID, src) {
      if (src=="none") {
        var el = getCSSPElement(destID)
        if (doAll)
          el.innerHTML = ""
        else {
          el.document.open()
          el.document.write("")
          el.document.close()
        }
      }
      else
        updateContents(destID, src)
    }

    function showElement(id) {        
      var pEl = getCSSPElement(id)
      if (pEl != null)          
        if (doAll)
            pEl.style.visibility = "visible"          
        else
            pEl.visibility = "show"      
     }      
  
     function hideElement(id) {
        var pEl = getCSSPElement(id)        
        if (pEl != null)          
        if (doAll)
            pEl.style.visibility = "hidden"          
        else
            pEl.visibility = "hide"      
     }
	 

     function hideShow(destID) {
       if (destID.visibility = "hide")
         showElement(destID)
       else
         hideElement(destID)
     }
    // -->

// Load a predefined list into the list area of the screen

function getGlasses(FrameList) {
      updateContents("thelist",FrameList)
     }


function printpage() { 
window.print();
 }
function sosWriteHeader(HeaderText)
{
document.write("<td align=Center class=menu valign=center width=125>");
sossmalladdisplay(12);
document.write('</td><td align="Center" class="menu"  valign="center" width="2">&nbsp;</td>');
document.write("<td align=Center class=menu valign=center>");
document.write("<a href=http://www.songofthesalesman.co.uk/ ><img src=http://www.songofthesalesman.co.uk/images/soshead.gif border=0 alt='");
document.write(HeaderText);
document.write("'></a></td>");
document.write('<td align="Right" class="menu"  valign="center">');
sossmalladdisplay(5);
document.write('</td>');
}
 
function sosaddisplay ()
{
var how_many_ads = 3;
var now = new Date();
var sec = now.getSeconds();
var ad = sec % how_many_ads;
ad +=1;

txt='iframe src="http://impgb.tradedoubler.com/imp/pool/iframe/1325/49477" width="120" height="600" frameborder="0" border="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>';

if (ad==1) {
txt='<iframe width=120 height=600 scrolling="no" frameborder=0 src="http://rcm.amazon.com/e/cm?t=songofthesa06-20`&p=11&o=1&l=ez&f=ifr"><MAP NAME="boxmap"><AREA SHAPE="RECT" COORDS="13, 588, 102, 600" HREF="http://rcm.amazon.com/e/cm/privacy-policy.html?o=1" ><AREA COORDS="0,0,10000,10000" HREF="http://www.amazon.com/exec/obidos/redirect-home/songofthesa06-20`" ></MAP><img src="http://rcm-images.amazon.com/images/G/01/rcm/120x600.gif" width="120" height="600" border="0" usemap="#boxmap" alt="Shop at Amazon.com"></iframe>';
}
if (ad==3) {
txt='<A HREF="http://www.amazon.co.uk/exec/obidos/redirect-home?tag=songofthesale-21&site=music" Target="Amma"><IMG SRC="https://ssl-images.amazon.com/images/G/02/associmg/multi_button1.gif" alt="In Association with Amazon.co.uk" BORDER="0" ></A>';
}


document.write(txt);


}

function sossmalladdisplay (addif)
{
var how_many_ads = 5;
var now = new Date();
var sec = now.getSeconds();
sec = sec + addif;
var ad = sec % how_many_ads;
ad +=1;

txt='<iframe src="http://impgb.tradedoubler.com/imp/pool/iframe/1316/49477" width="120" height="60" frameborder="0" border="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>';

if (ad==1) {
txt='<A HREF="http://www.amazon.co.uk/exec/obidos/redirect-home?tag=songofthesale-21&site=music" Target="Amma"><IMG SRC="https://ssl-images.amazon.com/images/G/02/associmg/multi_button1.gif" alt="In Association with Amazon.co.uk" BORDER="0" ></A>';
}




document.write(txt);

}     

function soshoraddisplay ()
{
var how_many_ads = 7;
var now = new Date();
var sec = now.getSeconds();
var ad = sec % how_many_ads;
ad +=1;

txt='<iframe src="http://impgb.tradedoubler.com/imp/pool/iframe/1322/49477" width="468" height="60" frameborder="0" border="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>';

if (ad==1) {
txt='<a href="http://www.Equitalk.co.uk/default.asp?refid=LPT978 " TARGET="Equitalk"><IMG height=60 alt="Save a Fortune on Phone Calls" src ="../images/equitalk.gif" width=468 border=0  nosave></a>';
}

if (ad==3) {
txt='<iframe width=468 height=60 scrolling="no" frameborder=0 src="http://rcm.amazon.com/e/cm?t=songofthesa06-20`&p=13&o=1&l=ez&f=ifr"><MAP NAME="boxmap"><AREA SHAPE="RECT" COORDS="379, 50, 460, 57" HREF="http://rcm.amazon.com/e/cm/privacy-policy.html?o=1" ><AREA COORDS="0,0,10000,10000" HREF="http://www.amazon.com/exec/obidos/redirect-home/songofthesa06-20`" ></MAP><img src="http://rcm-images.amazon.com/images/G/01/rcm/468x60.gif" width="468" height="60" border="0" usemap="#boxmap" alt="Shop at Amazon.com"></iframe>';
}
if (ad==4) {
txt='<!-- GEMM code starts here --><a href="http://MIKEYDRED.gemm.com" TARGET="GEMM"><font size="4"><b><img src="https://www.gemm.com/banner_exchange/affiliate_banner_anim_468x60.gif" width="468" height="60" align="BOTTOM" alt="GEMM is your best source for impossible-to-find !" border="0"></b></font></a><!-- GEMM code ends here -->';
}


document.write(txt);


}

function sosmax()
{
window.moveTo(0,0);
window.resizeTo(screen.availWidth,screen.availHeight);
}
 
