// Toggle menu to show or hide submenus
function Toggle(item) 
{
//	obj=document.getElementById(item);
//	visible=(obj.style.display!="none")
//	key=document.getElementById("x" + item);
	obj=document.getElementById(item);
	visible=(obj.style.display!="none")

	if (visible)
  {
	} 
  else 
  {
    if (item.search("id")>-1)
    {
      hideregs();
    }
    else
    {
      hideall();
    }
    obj.style.display="block";
	}
}

// Hide all visible sub menus
function hideall()
{
  hideregs();
	obj2=document.getElementById('map');
	obj2.style.display="none";
	obj2=document.getElementById('regions');
	obj2.style.display="none";
	obj2=document.getElementById('articles');
	obj2.style.display="none";
}

// Hide all regions (sub sub menus)
function hideregs()
{
	obj2=document.getElementById('idScotland');
	obj2.style.display="none";
	obj2=document.getElementById('idNorthernEngland');
	obj2.style.display="none";
	obj2=document.getElementById('idWales');
	obj2.style.display="none";
	obj2=document.getElementById('idMidlands');
	obj2.style.display="none";
	obj2=document.getElementById('idSouthernEngland');
	obj2.style.display="none";
}
// Display a new page in the right hand frame
// Used when a red blob is clicked
function showit(srchref)
{
   parent.fright.location.href=srchref
}

// Open a new window and link to streetmap.uk site
function smap(url)
{
   var w = window.open(url, "win");
}

// Gets the date stamp of a file and displays the date in the 'footer' element
function lastupdated()
{
  da = new Date(document.lastModified)
  dy = String(da.getFullYear())
  dm = String(da.getMonth()+1)
  if(dm.length==1) dm = "0"+dm
  dd = String(da.getDate())
  if(dd.length==1) dd="0"+dd
  ys = 'Last updated on '+dd+'-'+dm+'-'+dy+'<br>End of Page';
  document.getElementById("footer").innerHTML=ys;
  parent.scroll(0,0);
}

// Move the red blobs to their correct positions on the map
function moveim(a,b)
{
   // Get the current dimensions and position of the map
   h=document.images[0].offsetHeight;
   w=document.images[0].offsetWidth;
   t=document.images[0].offsetTop;
   l=document.images[0].offsetLeft;

   // Foxpro finds the actual map dimensions with picdims procedure
   maph = 1380;
   mapw = 831;

   // Calculate the correction multipliers a and b
   a = w/mapw
   b = h/maph
   
   // The array arrblobxy will hold the positions of the red blobs
   // relative to the top left corner of the map file in pixels
   var arrblobxy = new Array(486,962,489,997,156,1032,199,850,267,857,416,531,265,989,418,976,354,673,98,628,137,1288);
   var narrlen   = (arrblobxy.length-1)/2;

   // Apply multipliers and add offsets of the map in the window
   for (i = 0; i < narrlen; i=i+1)
      {
      document.images[i+1].style.position = "absolute"
      document.images[i+1].style.left     = arrblobxy[2*i]*a + l
      document.images[i+1].style.top      = arrblobxy[2*i+1]*b + t
      }
}

function CheckIsIE()
{
	if  (navigator.appName.toUpperCase() == 'MICROSOFT INTERNET EXPLORER')  { return true;}
	else 
	{ 
		return false; 
	}
}


function chkdate()
{
	
	/* Get table object */
	tbl=document.getElementById('tab');
	/* Step through the rows starting at the third row*/
	j=tbl.rows.length-1;
	for (i=2; i<j; i++)
	{
    due2expire = tbl.rows[i].getAttribute("expiry");
		expired=CheckIfExpired(due2expire);
		if (expired)
		{
			tbl.rows[i].style.display='none'; // Hide the row
		}
  }
}

function CheckIfExpired(Date2Check)
{
	NowDate = new Date();
	DueDate = new Date(Date2Check.split('/')[2],Date2Check.split('/')[1],Date2Check.split('/')[0]);
// Allow for month 0 = Jan
	DueDate.setMonth(DueDate.getMonth()-1);

if(DueDate.getTime()<NowDate.getTime()-51640000)
	{
		return true;
	}
	else
	{
		return false;
	}
}


// Resize the font of the Roller Directory page
function modfont()
{
}


// Resize the font of the rh side of the Roller Directory page
function modthisfont()
{
}

