// MENUCLICK //////////////////////////////////////////////////////
function MenuClick(divID){ 
	var obj = document.getElementById (divID);
	if (obj.style.display == "block") {
		//obj.style.display = "none"; 
	} else {
		//document.getElementById('menu_list1').style.display = "none";
		document.getElementById('menu_list2').style.display = "none";
		//document.getElementById('menu_list3').style.display = "none";
		//document.getElementById('menu_list4').style.display = "none";
		obj.style.display = "block"; 
	} 
}



function TimeOut(divID) {
	clearTimeout (t);
	var t = setTimeout("document.getElementById('menu_list"+divID+"').style.display = 'none';",5000);
}

function CloseMenus () {
	//document.getElementById('menu_list1').style.display = "none";
	document.getElementById('menu_list2').style.display = "none";
	//document.getElementById('menu_list3').style.display = "none";
	//document.getElementById('menu_list4').style.display = "none";
}
















// MENUCLICK //////////////////////////////////////////////////////
function HideMenu(divID){ document.write("H");
	var obj = document.getElementById (divID);
	obj.display = "none"; 
}




/*  SWAPMAP  */////////////////////////////////////////////////
function swapMap (id) {
var obj = document.getElementById('maps');
if (id == "1") { obj.innerHTML = '<a href="http://maps.google.co.uk/maps?q=LE10+1DN" target="external" rel="nofollow" title="Hinckley Office - Click to view using Googlemaps"><img src="uploads/map1.gif" class="map" alt=" Office - Click to view using Googlemaps"/></a>';}
if (id == "2") { obj.innerHTML = '<a href="http://maps.google.co.uk/maps?q=LE9+7ND" target="external" rel="nofollow" title="Earl Shilton Office - Click to view using Googlemaps"><img src="uploads/map2.gif" class="map" alt="Earl Shilton Office - Click to view using Googlemaps"/></a>';}
if (id == "3") { obj.innerHTML = '<a href="http://maps.google.co.uk/maps?q=CV13+0LF" target="external" rel="nofollow" title="Market Bosworth Office - Click to view using Googlemaps"><img src="uploads/map3.gif" class="map" alt="Market Bosworth Office - Click to view using Googlemaps"/></a>';}
}




/* WORTH */
function calculateWorth() {

// prepare variables
var running_total = "0";
var total = document.getElementById('total_worth');

// check inputs are numeric and add to or subtract from total
var a = document.fWorth.a.value; if (a == parseFloat(a)) { running_total = parseFloat(running_total) + parseFloat(a);}
var b = document.fWorth.b.value; if (b == parseFloat(b)) { running_total = parseFloat(running_total) + parseFloat(b);}
var c = document.fWorth.c.value; if (c == parseFloat(c)) { running_total = parseFloat(running_total) + parseFloat(c);}
var d = document.fWorth.d.value; if (d == parseFloat(d)) { running_total = parseFloat(running_total) + parseFloat(d);}
var e = document.fWorth.e.value; if (e == parseFloat(e)) { running_total = parseFloat(running_total) + parseFloat(e);}
var f = document.fWorth.f.value; if (f == parseFloat(f)) { running_total = parseFloat(running_total) + parseFloat(f);}
var g = document.fWorth.g.value; if (g == parseFloat(g)) { running_total = parseFloat(running_total) + parseFloat(g);}
var h = document.fWorth.h.value; if (h == parseFloat(h)) { running_total = parseFloat(running_total) + parseFloat(h);}
var i = document.fWorth.i.value; if (i == parseFloat(i)) { running_total = parseFloat(running_total) + parseFloat(i);}
var j = document.fWorth.j.value; if (j == parseFloat(j)) { running_total = parseFloat(running_total) + parseFloat(j);}
var k = document.fWorth.k.value; if (k == parseFloat(k)) { running_total = parseFloat(running_total) + parseFloat(k);}
var l = document.fWorth.l.value; if (l == parseFloat(l)) { running_total = parseFloat(running_total) + parseFloat(l);}

var m = document.fWorth.m.value; if (m == parseFloat(m)) { running_total = parseFloat(running_total) - parseFloat(m);}
var n = document.fWorth.n.value; if (n == parseFloat(n)) { running_total = parseFloat(running_total) - parseFloat(n);}
var o = document.fWorth.o.value; if (o == parseFloat(o)) { running_total = parseFloat(running_total) - parseFloat(o);}
var p = document.fWorth.p.value; if (p == parseFloat(p)) { running_total = parseFloat(running_total) - parseFloat(p);}
var q = document.fWorth.q.value; if (q == parseFloat(q)) { running_total = parseFloat(running_total) - parseFloat(q);}

// round to 2 decimal places
running_total = parseFloat ((parseInt((parseFloat(running_total)*100))) / 100);

// convert to string and added extra 0s if needed
running_total = running_total.toString();
if (running_total.indexOf(".") == "-1") {running_total = running_total + ".00";}
if (running_total.indexOf(".") == running_total.length - 2) {running_total = running_total + "0";}

// output to page
total.innerHTML = '<p><b>£ ' + running_total + '</b></p>';  return false;

}	
