
<!--
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function changeImages() {
	if (document.images) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}
function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function confPass(){
	if (document.RegisterMe.thePass.value == document.RegisterMe.CPass.value) {
		if(document.RegisterMe.thePass.value==""){
			alert("Please enter a password");
			return false;
		}else{
			if(document.RegisterMe.UName.value==""){
				alert("Please enter a Username");
				return false;
			}else{
				if(document.RegisterMe.theEmail.value==""){
					alert("Please enter a valid email address");
					return false;
				}else{
					return true;
				}
			}
		}
	}else{
	alert("Your password and confirmation of password are different. Please re-enter these details");
	document.RegisterMe.thePass.value = "";
	document.RegisterMe.CPass.value = "";
	return false;
	}
}

function giveWarningAndFixValue(field) {
//removes all non-numeric value and replaces
	var value = parseInt(field.value);
	if(!isNaN(value)) field.value = value;
	else field.value = "0";
	//used for NS4.7 because when changing value the cursor is placed in front of the value, instead of behind
	if(document.layers) field.select();
}

function isNumericValue(str) {
	var isValid = true;
	if(str.search(/^[0-9]+$/) == -1) {
		isValid = false;
	}
	return isValid;
}
function checkValue(field) {
	if(!isNumericValue(field.value)) {
		giveWarningAndFixValue(field);
	}
}

function confirmdel()
{
delcheck=confirm("If you delete this page all data in it will be lost. Are you sure you wish to continue?");
if (delcheck==true) {
return true; 
} else {
return false;
}

}
function confirmdelCont()
{
delcheck=confirm("Are you sure you wish to delete this content?");
if (delcheck==true) {
return true; 
} else {
return false;
}

}
function CheckPrice(obj)
{
	//validate the price is a positive integer
	if (obj.value=="")
	{
		alert("You must enter a price.");
		return false;
	}
	else
	{	
	
		if (obj.value.search(/[^\d]/)>-1)
		{
		alert("The price must be whole dollars in numbers only with no other characters.");
		obj.value = '0';
		return false;
		}
		else
		{
		return true;
		}		
	}	
}
function CheckQuantity(obj)
{
	if (obj.value=="")
	{
		alert("You must enter a quantity.");
		return false;
	}
	else
	{
		if (obj.value.search(/[^\d]/)>-1)
		{
		alert("The quantity must be a positive number and contain numbers only with no other characters.");
		obj.value = '1';
		return false;
		}
		else
		{
		return true;
		}		
	}	
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_timelinePlay(tmLnName, myID) { //v1.2
  //Copyright 1997, 2000 Macromedia, Inc. All rights reserved.
  var i,j,tmLn,props,keyFrm,sprite,numKeyFr,firstKeyFr,propNum,theObj,firstTime=false;
  if (document.MM_Time == null) MM_initTimelines(); //if *very* 1st time
  tmLn = document.MM_Time[tmLnName];
  if (myID == null) { myID = ++tmLn.ID; firstTime=true;}//if new call, incr ID
  if (myID == tmLn.ID) { //if Im newest
    setTimeout('MM_timelinePlay("'+tmLnName+'",'+myID+')',tmLn.delay);
    fNew = ++tmLn.curFrame;
    for (i=0; i<tmLn.length; i++) {
      sprite = tmLn[i];
      if (sprite.charAt(0) == 's') {
        if (sprite.obj) {
          numKeyFr = sprite.keyFrames.length; firstKeyFr = sprite.keyFrames[0];
          if (fNew >= firstKeyFr && fNew <= sprite.keyFrames[numKeyFr-1]) {//in range
            keyFrm=1;
            for (j=0; j<sprite.values.length; j++) {
              props = sprite.values[j]; 
              if (numKeyFr != props.length) {
                if (props.prop2 == null) sprite.obj[props.prop] = props[fNew-firstKeyFr];
                else        sprite.obj[props.prop2][props.prop] = props[fNew-firstKeyFr];
              } else {
                while (keyFrm<numKeyFr && fNew>=sprite.keyFrames[keyFrm]) keyFrm++;
                if (firstTime || fNew==sprite.keyFrames[keyFrm-1]) {
                  if (props.prop2 == null) sprite.obj[props.prop] = props[keyFrm-1];
                  else        sprite.obj[props.prop2][props.prop] = props[keyFrm-1];
        } } } } }
      } else if (sprite.charAt(0)=='b' && fNew == sprite.frame) eval(sprite.value);
      if (fNew > tmLn.lastFrame) tmLn.ID = 0;
  } }
}

function MM_timelineGoto(tmLnName, fNew, numGotos) { //v2.0
  //Copyright 1997, 2000 Macromedia, Inc. All rights reserved.
  var i,j,tmLn,props,keyFrm,sprite,numKeyFr,firstKeyFr,lastKeyFr,propNum,theObj;
  if (document.MM_Time == null) MM_initTimelines(); //if *very* 1st time
  tmLn = document.MM_Time[tmLnName];
  if (numGotos != null)
    if (tmLn.gotoCount == null) tmLn.gotoCount = 1;
    else if (tmLn.gotoCount++ >= numGotos) {tmLn.gotoCount=0; return}
  jmpFwd = (fNew > tmLn.curFrame);
  for (i = 0; i < tmLn.length; i++) {
    sprite = (jmpFwd)? tmLn[i] : tmLn[(tmLn.length-1)-i]; //count bkwds if jumping back
    if (sprite.charAt(0) == "s") {
      numKeyFr = sprite.keyFrames.length;
      firstKeyFr = sprite.keyFrames[0];
      lastKeyFr = sprite.keyFrames[numKeyFr - 1];
      if ((jmpFwd && fNew<firstKeyFr) || (!jmpFwd && lastKeyFr<fNew)) continue; //skip if untouchd
      for (keyFrm=1; keyFrm<numKeyFr && fNew>=sprite.keyFrames[keyFrm]; keyFrm++);
      for (j=0; j<sprite.values.length; j++) {
        props = sprite.values[j];
        if (numKeyFr == props.length) propNum = keyFrm-1 //keyframes only
        else propNum = Math.min(Math.max(0,fNew-firstKeyFr),props.length-1); //or keep in legal range
        if (sprite.obj != null) {
          if (props.prop2 == null) sprite.obj[props.prop] = props[propNum];
          else        sprite.obj[props.prop2][props.prop] = props[propNum];
      } }
    } else if (sprite.charAt(0)=='b' && fNew == sprite.frame) eval(sprite.value);
  }
  tmLn.curFrame = fNew;
  if (tmLn.ID == 0) eval('MM_timelinePlay(tmLnName)');
}

//-------- menu ---------
function initialiseMenu(menutype)
{
	if(menutype == 'True')
	{
		document.visibleMenu = null;
		document.checkMenuTimer = null;
		document.closeMenuTimer = null;
		var menu = document.getElementById("mainmenu");
		if (menu != null)
		{
			var objLICollection = menu.getElementsByTagName("TD");
			for(var i = 0; i < objLICollection.length; i++)
			{
				var objLI = objLICollection[i];        
				processNodes(objLI);
			}
			objLICollection = menu.getElementsByTagName("LI");
			for(var i = 0; i < objLICollection.length; i++)
			{
				var objLI = objLICollection[i];        
				processNodes(objLI);
			}
		}
	}
	else
	{
		//nothing required
	}
}

function processNodes(objLI)
{
    objLI.onmouseover=hideSubMenu;

		    objLI.onmouseout=menuLostFocus;

    var subMenus = objLI.getElementsByTagName("UL");
    for(var j = 0; j  < subMenus.length; j++)
    {
        var child = subMenus.item(j);
	    if(child.nodeName == "UL")
	    {
		    objLI.onmouseover=showSubMenu;
		    objLI.onmouseout=menuLostFocus;
            if (objLI.nodeName != "TD")
            {
		        for(var k = 0; k < objLI.childNodes.length; k++)
		        {
		            var link = objLI.childNodes.item(k);
			        if(link.nodeName == "A")
			        {
				        link.style.backgroundImage = "url(/wmsimages/arrows.gif)";
				        link.style.backgroundRepeat = "no-repeat";
				        link.style.backgroundPosition = "156px center"; //controls postition of arrow
				        link.style.paddingRight = "12px";
			        }
    		    }
		    }
		    child.onmouseover=menuGotFocus;
		    //child.onmouseout=menuLostFocus;
	    }
    }
}

function menuGotFocus()
{
	resetCloseTimer();
}

function menuLostFocus()
{
	startCloseTimer();
}

function startCloseTimer()
{
    resetCloseTimer();
    document.closeMenuTimer = window.setInterval("hideAllMenus()", 500);
}

function resetCloseTimer()
{
    if (document.closeMenuTimer != null)
    {
        window.clearInterval(document.closeMenuTimer);
    }
}

function showSubMenu()
{
    showSubMenuCore(this);
}

function isChild(parent, child)
{
    var par = child;
    while (par != null)
    {
        if (parent == par)
        {
            return true;
        }
        par = par.parentNode;
    }
    return false;
}

function showSubMenuCore(objThis)
{
	if (objThis.nodeName == "TD")
	{
		objThis.style.backgroundImage="url(images/rollover.gif)";
	}
    resetCloseTimer();
    if (document.visibleMenu != null)
    {
        if (document.visibleMenu.owner == objThis | isChild(objThis, document.visibleMenu.owner))
        {
            return;
        }
        else
        {
            if (!isChild(document.visibleMenu.owner, objThis))
            {
                if (objThis.nodeName == "TD")
                {
                    hideMenuCore(document.visibleMenu, true);
                }
                else
                {
                    hideMenuCore(document.visibleMenu, false);
                }
            }
        }
    }
    for(var i = 0; i  < objThis.childNodes.length; i++)
    {
        var menu = objThis.childNodes.item(i);
        if(menu.nodeName == "UL")			
        {
            var style = menu.style;
            style.display = "block";
            if (objThis.nodeName == "TD")
            {
                style.left = (getAbsoluteLeft(objThis) - 3) + "px"; //controls the x offset of the rollouts
                style.top = (getAbsoluteTop(objThis) + objThis.offsetHeight - 3) + "px";
            }
            else
            {
                style.left = objThis.offsetWidth + "px";
                style.top = objThis.offsetTop + "px";
            }
            menu.parentMenu = document.visibleMenu;
            document.visibleMenu = menu;
            document.visibleMenu.has_focus = 1;
            menu.owner = objThis;
            if (document.checkMenuTimer != null)
            {
                window.clearInterval(document.checkMenuTimer);
                document.checkMenuTimer = null;
            }
            document.checkMenuTimer = window.setInterval("checkMenu()", 3000);
            
            resetCloseTimer();
            break;            
        }		
    }	
}

function checkMenu()
{
    if (document.visibleMenu != null)
    {
        if (!(document.visibleMenu.has_focus == 1))
        {
            hideMenuCore(document.visibleMenu, true);
        }
    }
}

function hideAllMenus()
{
    resetCloseTimer();
    hideMenuCore(document.visibleMenu, true);
}

function hideSubMenu()
{
    hideMenuCore(document.visibleMenu, false);
}


function hideMenuCore(menu, hideAll)
{
    if (hideAll & document.checkMenuTimer != null)
    {
        window.clearInterval(document.checkMenuTimer);
        document.checkMenuTimer = null;
    }
    if (hideAll)
    {
        while (menu != null)
        {
            menu.style.display = "none";
            menu = getParentMenu(menu);
        }
        document.visibleMenu = null;
    }
    else
    {
        if (menu != null)
        {
            menu.style.display = "none";
            document.visibleMenu = menu.parentMenu;
        }
    }
}

function getParentMenu(menu)
{
    var element = menu.parentNode;
    while (element != null)
    {
        if (element.nodeName == "TD")
        {
            return null;
        }
        if (element.nodeName == "UL")
        {
            return element;
        }
        element = element.parentNode;
    }
    return null;
}

function getAbsoluteLeft(element)
{
	if (element == null)
	{
		return 0;
	}
	var pos;
	if (element.offsetParent == null)
	{
		pos = 0;
	}
	else
	{
		pos = element.offsetParent.clientLeft;
	}
	return pos + element.offsetLeft + getAbsoluteLeft(element.offsetParent);
}

function getAbsoluteTop(element)
{
	if (element == null)
	{
		return 0;
	}
	var pos;
	if (element.offsetParent == null)
	{
		pos = 0;
	}
	else
	{
		pos = element.offsetParent.clientTop;
	}
	return pos + element.offsetTop + getAbsoluteTop(element.offsetParent);
}

function showStandard(){
	var layerToShow = document.getElementById("StandardPanel");
	var layerToHide = document.getElementById("AdvancedPanel");


    layerToShow.style.display = 'inline';
    layerToHide.style.display  = 'none';
}


function showAdvanced(){
	var layerToShow = document.getElementById("AdvancedPanel");
	var layerToHide = document.getElementById("StandardPanel");


    layerToShow.style.display = 'inline';
    layerToHide.style.display  = 'none';
}

// --- upload images
function setImage(filename, file, element, imageElement){
    var objelement = document.getElementById(element);
    var objimageElement = document.getElementById(imageElement);
    if (objelement != null)
    {
		objelement.value=filename;
	}
	if (objimageElement != null)
	{
		objimageElement.src=file;
	}
}
function openNewWindow(sURL, sName, iWidth, iHeight, bResizable, bScrollbars)
{
	var iTop  = (screen.height - iHeight) / 2 ;
	var iLeft = (screen.width  - iWidth) / 2 ;
	
	var sOptions = "toolbar=no" ;
	sOptions += ",width=" + iWidth ; 
	sOptions += ",height=" + iHeight ;
	sOptions += ",resizable="  + (bResizable  ? "yes" : "no") ;
	sOptions += ",scrollbars=" + (bScrollbars ? "yes" : "no") ;
	sOptions += ",left=" + iLeft ;
	sOptions += ",top=" + iTop ;
	
	var oWindow = window.open(sURL, sName, sOptions)
	oWindow.focus();
	
	return oWindow ;
}
function OpenMealImageUpload(ownerWindow, strImageSrcName, strElementName, strImagePath)
{
	var oWindow = openNewWindow("/adm/mealimageupload.aspx?imageLocation="+strImagePath+"&ElementName="+strElementName+"&ImagePath="+strImageSrcName, 'UploadWindow', 300, 150, false, false);
	oWindow.mainWindow=ownerWindow;
	oWindow.opener=ownerWindow;
}

function checkKey(ev)
{
	if (!document.disableMapping && ev.keyCode==13) 
	{
		ev.keyCode=9; 
		return ev.keyCode;
	}
	/*if (!document.disableMapping && ev.keyCode==38) 
	{
		// up arrow
		ev.keyCode=9; 
		ev.shiftKey = true;
		return ev.keyCode;
	}*/
	if (!document.disableMapping && ev.keyCode==40) 
	{
		// down arrow
		ev.keyCode=9;
		return ev.keyCode;
	}
}//-->
