function verifyRequired() {
  var emailaddr=document.getElementById("fields_email");
  if (emailaddr.value == "" ||emailaddr.value== "your e-mail address") {
    alert("Your Email address is required.");
    return false;
  }
return true;
}

function ToDec(hex) {
	//needed by convertHex2Dec()
   hex=hex.toUpperCase();
   if(hex == "A")
      dec = 10;
   else if(hex == "B")
      dec = 11;
   else if(hex == "C")
      dec = 12;
   else if(hex == "D")
      dec = 13;
   else if(hex == "E")
      dec = 14;
   else if(hex == "F")
      dec = 15;
   else
      dec = eval(hex);

   return dec;
}

function convertHex2Dec(hex) {
	//needed for CSS conversions below because firefox uses RGB rather than hex for some stupid reason
   a = ToDec(hex.substring(0, 1));
   b = ToDec(hex.substring(1, 2));
   c = ToDec(hex.substring(2, 3));
   d = ToDec(hex.substring(3, 4));
   e = ToDec(hex.substring(4, 5));
   f = ToDec(hex.substring(5, 6));

   x = (a * 16) + b;
   y = (c * 16) + d;
   z = (e * 16) + f;

   return("rgb(" + x + ", " + y + ", " + z + ")");
}

function shownav(section,selector,selectorcolour,arrow,headercolour,arrow2,selectorcolour2,headercolour2) {
	//left navigation show/hide, inspirtion from www.faqts.com
	for (var s = 0; s < document.styleSheets.length; s++) {
		if(document.styleSheets[s].rules) {
			for (var r = 0; r < document.styleSheets[s].rules.length; r++) {
				if (document.styleSheets[s].rules[r].selectorText == '.' + section) {
					if(document.styleSheets[s].rules[r].style.display=='none') {
						document.styleSheets[s].rules[r].style.display='block';
					}else{
						document.styleSheets[s].rules[r].style.display='none';
					}
				}
			}
		} else if(document.styleSheets[s].cssRules) {
			for (var r = 0; r < document.styleSheets[s].cssRules.length; r++) {
				if (document.styleSheets[s].cssRules[r].selectorText == '.' + section) {
					if (document.styleSheets[s].cssRules[r].style.display=='none') {
						document.styleSheets[s].cssRules[r].style.display='block';
					}else{
						document.styleSheets[s].cssRules[r].style.display='none';
					}
				}
			}
		}
	}
	//now do selector
	for (var s = 0; s < document.styleSheets.length; s++) {
		if(document.styleSheets[s].rules) {
			for (var r = 0; r < document.styleSheets[s].rules.length; r++) {
				if (document.styleSheets[s].rules[r].selectorText == '#leftnav #' + selector) {
					if (document.styleSheets[s].rules[r].style.background=='url(../images/headerimages/' + arrow2 + ') #'+ selectorcolour2 + ' no-repeat left center') {
						document.styleSheets[s].rules[r].style.background='url(../images/headerimages/' + arrow + ') #' + selectorcolour + ' no-repeat left center';
					} else {
						document.styleSheets[s].rules[r].style.background='url(../images/headerimages/' + arrow2 + ') #' + selectorcolour2 + ' no-repeat left center';
					}
				}
			}
		} else if(document.styleSheets[s].cssRules) {
			for (var r = 0; r < document.styleSheets[s].cssRules.length; r++) {
				if (document.styleSheets[s].cssRules[r].selectorText == '#leftnav #' + selector) {
					if (document.styleSheets[s].cssRules[r].style.background==convertHex2Dec(selectorcolour2) + ' url(../images/headerimages/' + arrow2 + ') no-repeat scroll left center') {
						document.styleSheets[s].cssRules[r].style.background='#' + selectorcolour + ' url(../images/headerimages/' + arrow + ') no-repeat left center';
					} else {
						document.styleSheets[s].cssRules[r].style.background='#' + selectorcolour2 + ' url(../images/headerimages/' + arrow2 + ') no-repeat left center';
					}
				}
			}
		}
	}
    //and then for the text on the item they clicked
	for (var s = 0; s < document.styleSheets.length; s++) {
		if(document.styleSheets[s].rules) {
			for (var r = 0; r < document.styleSheets[s].rules.length; r++) {
				if (document.styleSheets[s].rules[r].selectorText == '#leftnav #' + selector) {
					if (document.styleSheets[s].rules[r].style.color!==headercolour) {
						document.styleSheets[s].rules[r].style.color=headercolour;
					} else {
						document.styleSheets[s].rules[r].style.color=headercolour2;
					}
				}
				if (document.styleSheets[s].rules[r].selectorText == '#leftnav #' + selector+ ":hover") {
					document.styleSheets[s].rules[r].style.color=headercolour;
				}
			}
		} else if(document.styleSheets[s].cssRules) {
			for (var r = 0; r < document.styleSheets[s].cssRules.length; r++) {
				if (document.styleSheets[s].cssRules[r].selectorText == '#leftnav #' + selector) {
					if (document.styleSheets[s].cssRules[r].style.color!==convertHex2Dec(headercolour.substring(1,7))) {
						document.styleSheets[s].cssRules[r].style.color=headercolour;
					} else {
						document.styleSheets[s].cssRules[r].style.color=headercolour2;
					}
				}
				//this is a hack to get the hover working as it appears to vanish when the above is set although not directly connected!
				if (document.styleSheets[s].cssRules[r].selectorText == '#leftnav #' + selector+ ":hover") {
					document.styleSheets[s].cssRules[r].style.color=headercolour;
				}

			}
		}
	}
}

function hidenav(arrow,bgcolour,textcolour,section1,section2,section3) {
	for (var s = 0; s < document.styleSheets.length; s++) {
		if(document.styleSheets[s].rules) {
			for (var r = 0; r < document.styleSheets[s].rules.length; r++) {
				if (document.styleSheets[s].rules[r].selectorText == '.hidden1' || document.styleSheets[s].rules[r].selectorText == '.hidden2' ||document.styleSheets[s].rules[r].selectorText == '.hidden3') {
					document.styleSheets[s].rules[r].style.display='none';
				}
			}
		} else if(document.styleSheets[s].cssRules) {
			for (var r = 0; r < document.styleSheets[s].cssRules.length; r++) {
				if (document.styleSheets[s].cssRules[r].selectorText == '.hidden1' ||document.styleSheets[s].cssRules[r].selectorText == '.hidden2' ||document.styleSheets[s].cssRules[r].selectorText == '.hidden3' ) {
					document.styleSheets[s].cssRules[r].style.display='none';
				}
			}
		}
	}
	//now do selector
	for (var s = 0; s < document.styleSheets.length; s++) {
		if(document.styleSheets[s].rules) {
			for (var r = 0; r < document.styleSheets[s].rules.length; r++) {
				if (document.styleSheets[s].rules[r].selectorText == '#leftnav #' + section1 || document.styleSheets[s].rules[r].selectorText == '#leftnav #' + section2 || document.styleSheets[s].rules[r].selectorText == '#leftnav #' + section3) {
					document.styleSheets[s].rules[r].style.background='url(../images/headerimages/' + arrow+ ') ' + bgcolour + ' no-repeat left center';
					document.styleSheets[s].rules[r].style.color=textcolour;
				}
			}
		} else if(document.styleSheets[s].cssRules) {
			for (var r = 0; r < document.styleSheets[s].cssRules.length; r++) {
				if (document.styleSheets[s].cssRules[r].selectorText == '#leftnav #' + section1 || document.styleSheets[s].cssRules[r].selectorText == '#leftnav #' + section2 || document.styleSheets[s].cssRules[r].selectorText == '#leftnav #' + section3) {
					document.styleSheets[s].cssRules[r].style.background='' + bgcolour+ ' url(../images/headerimages/' + arrow + ') no-repeat left center';
					document.styleSheets[s].cssRules[r].style.color=textcolour;

				}
			}
		}
	}
}
//get-around for lack of noscript support in XHTML standard
document.write ("<style type='text/css'>\n.hidden1 {\ndisplay:none;\n}\n.hidden2 {\ndisplay:none;\n}\n.hidden3 {\ndisplay:none;\n}</style>");