<!--// JavaScript Document
///////////////////////////////////////////BASIC UTILITY CODE///////////////////////////////////////////
var lastLinkID = "home";  var lastMenuID = "menuHome";//Global variables needed for togSub2 & togMenu.

function changePic(theImg, theSrc)//Changes images onmouseover.
{
 var picName = theImg;
 document.images[picName].src = theSrc;
}

function submitForm(theAction, theID)//Submits navigation form to pages to ensure log in is maintained.
{if (document.firstRecipe) {document.firstRecipe.action = theAction;  document.firstRecipe.theID.value = theID;  document.firstRecipe.submit();} else {return false;}}

function togSection(theSection, results)//Shows or hides the relevant hidden section div onclick of visible control.
{
 var theDivs = theSection.options;  var divName = theSection.value;  var theDiv = document.getElementById(divName);
 if (results == 'yes') 
    {var resultsDiv = document.getElementById('results');  resultsDiv.style.visibility = 'hidden';  resultsDiv.style.display = 'none';}
     for (i = 0; i < theDivs.length; i++)
     {
	  var x = document.getElementById(theDivs[i].value);
	  if (x.style.visibility == 'visible') {x.style.visibility = 'hidden';  x.style.display = 'none';}
	 }
 theDiv.style.visibility  = 'visible';  theDiv.style.display = 'block';
}

function togSub1(theID)//Shows or hides the requested hidden element onclick of visible control.
{
 var theSub = document.getElementById(theID);
 if (theSub.style.visibility == 'visible') {theSub.style.visibility = 'hidden';  theSub.style.display = 'none';}
 else {theSub.style.visibility = 'visible';  theSub.style.display = 'block';}
}

function togSub2(theName, theID, theTag)//Shows current and hides only the requested element onclick of visible control.
{
 var theGroup = document.getElementsByName(theName);
 for (i = 0; i < theGroup.length; i++) {var theSub = document.getElementById(theGroup[i].id+theTag);  theSub.style.visibility = 'hidden';  theSub.style.display = 'none';} 
 if (theID != '') {var theSub = document.getElementById(theID+theTag); theSub.style.visibility = 'visible';  theSub.style.display = 'block';}
}

function togTab1(theName, theID)//Hides last tab and shows requested tab onclick of visible element (tab bg != line colour).
{
 var theGroup = document.getElementsByName(theName);
 for (i = 0; i < theGroup.length; i++) {theGroup[i].childNodes[1].style.visibility = 'hidden';} 
 if (theID != '') {var theLineHider = document.getElementById(theID).childNodes[1];  theLineHider.style.visibility = 'visible';  theLineHider.style.display = 'block';}
 togSub2(theName, theID, 'Div');
}
function togMenu(linkID, menuID)//Shows or hides the last clicked sub menu div onclick of visible control.
{
 var theLink = document.getElementById(linkID);  var theMenu = document.getElementById(menuID); 
 var lastLink = document.getElementById(lastLinkID);  var lastMenu = document.getElementById(lastMenuID); 
 if (lastLink.className == 'topMenu1on') {lastLink.className = 'topMenu1off';}
 theLink.className = 'topMenu1on';
 if (lastMenu.style.visibility == 'visible') {lastMenu.style.visibility = 'hidden';  lastMenu.style.display = 'none';}
 theMenu.style.visibility = 'visible';  theMenu.style.display = 'block';
 lastLinkID = linkID;  lastMenuID = menuID;
}

function togInfo(theTog, theName, maxInfo)//Displays the requested info - rotates round at end of ranges.
{
 var thisInfo = parseInt(document.getElementsByName(theName)[0].id);  var theInfo;
 if (theTog == '+') {theInfo = thisInfo + 1; if (theInfo > maxInfo) {theInfo = 1;}}
 else if (theTog == '-') {theInfo = thisInfo - 1; if (theInfo < 1) {theInfo = maxInfo;}}
 getContents('',theName+'/'+theName+theInfo+'.asp',theName+'Div');
}


function clearIt(theElmnt, theValue)//Clears the value of a form element if it has a certain value.
{if (theElmnt.value == theValue) {theElmnt.value = "";}}

function openPop(theUrl, w, h)//Opens a new pop-up window for out-of-site links.
{
 var newPop;
 if (!newPop)
    {newPop = window.open(theUrl, 'newPop', 'width='+w+',height='+h+',top=100,left=100,location=0,menubar=0,resizable=1,scrollbars=1,statusbar=1,toolbar=0');}
 else {newPop.location = theUrl;}
 if (window.focus) {newPop.focus();}
}

function openWin(theUrl)//Opens a new full window for out-of-site links.
{
 var newWin;
 if (!newWin)
    {newWin = window.open(theUrl, 'newWin', 'width=1024,height=600,top=100,left=100,location=1,menubar=1,resizable=1,scrollbars=1,statusbar=1,toolbar=1');}
 else {newWin.location = theUrl;}
 if (window.focus) {newWin.focus();}
}

///////////////////////////////////////////HTTP REQUEST CODE///////////////////////////////////////////
function setRequester()//Makes the xmlhttp request object.
{
 var xmlHttp;
 try {xmlHttp = new XMLHttpRequest();}//Firefox, Opera 8.0+, IE7, Safari
 catch (e) 
     {try{xmlHttp = new ActiveXObject('Msxml2.XMLHTTP');}//Internet Explorer 6+
      catch (e)
         {try{xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');}//Internet Explorer 5-
          catch (e) {alert('Your browser does not support AJAX!');  return false;}//All others
         }
     }
 return xmlHttp;
}

function getContents(theID, theTask, part)//Posts the form to the relevant Script.asp via xmlHttp.
{
 var requester;  var formValues = 'theID='+theID;
 requester = setRequester();
 requester.onreadystatechange = function ()  {if(requester.readyState == 4 && requester.status == 200){document.getElementById(part).innerHTML = requester.responseText; xmlHttp = null;}}
 requester.open('POST',theTask,true);//
 requester.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
 requester.setRequestHeader("Content-length", formValues.length);
 requester.send(formValues);
}

-->
