
var agt=navigator.userAgent.toLowerCase();

var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);

var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_ie3    = (is_ie && (is_major < 4));
var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
var is_ie4up  = (is_ie && (is_major >= 4));
var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);

function loadIframe() {
		frames['searchIframe'].location ='searchTown.asp?ssql=N'
		popon()
}

var but_path='images/110107/panel_advanced.gif'
var but_path_over='images/110107/panel_advanced_over.gif'
var but_toggle = 0

function initScroll()
{
		//scrollablediv 1
		var scroller = new Bs_ScrollableDiv();
		scroller.init('divContainer_1', 'divContent_1');
		
	  var sliderObj = new Bs_Slider();
		sliderObj.width          = 20;
		sliderObj.height         = 'auto';
		sliderObj.arrowMouseOver = true;
		sliderObj.direction      = 1;
		sliderObj.imgDir         = '';
		sliderObj.setBackgroundImage('scroll_ln.gif', 'repeat');
		sliderObj.setSliderIcon('images/241206/scroll_knob.gif', 20, 5);
		sliderObj.setArrowIconLeft('images/241206/scroll_up.jpg', 17, 20);
		sliderObj.setArrowIconRight('images/241206/scroll_dn.jpg',17, 20);
		
		scroller.setSliderObject(sliderObj, 'sliderDiv1');
if(is_ie5_5up)
		{
		scroller.setSlideSpeed(50, 'pixel'); //50 pixel per second
		}
else	
		{		
		scroller.setSlideSpeed(400, 'pixel'); //50 pixel per second
		}
		
		scroller.setWheelSpeed(10, 'pixel'); //10 pixel per tick		
}

function taLimit() {
	var taObj=event.srcElement;
	if (taObj.value.length==taObj.maxLength*1) return false;
}

function bookmarkhome(jplace)
{

	if(is_ie4up)
		{
		if (document.all)
			window.external.AddFavorite("http://www.restaurantuk.com",document.title);
		}
	else
		{
		alert('Not Supported By This Browser. Please Try Pressing (CTRL+D)\n\nThis site is best viewed using MSIE5+')
		}
}

function addbookmark(jplace)
{

	if(is_ie4up)
		{
		if (document.all)
			window.external.AddFavorite("http://www.restaurantuk.com/directory.asp?" + jplace,document.title);
		}
	else
		{
		alert('Not Supported By This Browser. Please Try Pressing (CTRL+D)\n\nThis site is best viewed using MSIE5+')
		}

}

function validate(theForm)
{
	validSearch = /^[ 0-9a-z-'&!,()]+$/i
	
	if (theForm.PCTownID.value.length < 1 || theForm.PCTownID.value == 'Enter postcode or town')
		{
		alert('Please Enter Town or Postcode,     \nor use \'Advanced Search\'.');
		theForm.PCTownID.focus();
		return false;
		}

	if (theForm.PCTownID.value.search(validSearch) == -1) 
		{
		alert('Your entry contains invalid characters. Please try again.      ')
		theForm.PCTownID.focus();
		return false;
		}

	if (theForm.PCTownID.value.toUpperCase() == 'LONDON')
		{
		frames['searchIframe'].frames['myIframe'].location ='advanced_town3.asp?sql_flag=1'
		searchDiv.style.visibility='visible';
		return false;
		}
	properClose=0;
return true;
}

function applyImageTransition (obj, imgsrc)
{
    obj.filters(0).Apply();
    obj.src=imgsrc;
    obj.filters(0).Play();
}

function setIn(obj, imgsrc)
{
	obj.src = imgsrc;
}

function fadeInOut(obj, imgsrc)
{
if(is_ie5_5up)
	{
	obj.style.filter='progid:DXImageTransform.Microsoft.Fade(duration=1)';
	applyImageTransition(obj,imgsrc)
	}
else
	{
	obj.src = imgsrc;
	}
}

function openWebsite(web_url,win_id,width,height)
{
var ct;
var slotFound;
var alreadyAllocated=0;
var strHTML;

	if(web_url == 'http://' || web_url=='')
		{
		alert('No further details available. Check back soon...    ')
		}
	else
		{
		if(!width) width=800
		if(!height) height=600
	
		win_ref=window.open(web_url, win_id,'width=' + width + ',height=' + height + ',scrollbars=1,resizable=1');
	
		win_ref.focus()
		}
}

function openWeb(rst_id,width,height)
{
	if(!width) width=800+20
	if(!height) height=600+20

	win_ref=window.open('restaurant_web.asp?ID='+rst_id, rst_id,'width=' + width + ',height=' + height + ',scrollbars=1,resizable=1');

	win_ref.focus()
}

function openMenu(rst_id,width,height)
{

	if(!width) width=800
	if(!height) height=600

	win_ref=window.open('restaurant_menu.asp?ID='+rst_id, rst_id,'width=' + width + ',height=' + height + ',scrollbars=1,resizable=1');

	win_ref.focus()
}

function popoff() {
	searchDiv.style.visibility='hidden';
}

function popon() {
  searchDiv.style.visibility='visible';
}

function FocusInput(el)
{
	if(el.value == "Enter postcode or town" || el.value=="Enter restaurant name")	el.value = ""
}

var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=yes,directories=no,status=yes,menubar=no,toolbar=no,resizable=yes';
win=window.open(mypage,myname,settings); win.focus();}

var Xoffset=5;        // modify these values to ...
var Yoffset= -100;        // change the popup position.
var popwidth=260;       // popup width
var bcolor="darkgray";  // popup border color
var fcolor="black";     // popup font color
var fface="verdana";    // popup font face

var iex=(document.all);
var nav=(document.layers);
var old=(navigator.appName=="Netscape" && !document.layers && !document.getElementById);
var n_6=(window.sidebar);

var skin;
var yyy=-1000;

var pupInitialized = 0

function get_mouse(e)
{
  var x,y;

  if(nav || n_6) x=e.pageX;
  if(iex) x=event.x+document.body.scrollLeft; 
  
  if(nav || n_6) y=e.pageY;
  if(iex)
  {
    y=event.y;
    if(navigator.appVersion.indexOf("MSIE 4")==-1)
      y+=document.body.scrollTop;
  }

  if(iex || nav)
  {
    skin.top=y+yyy;
    skin.left=x+Xoffset; 
  }

  if(n_6)
  {
    skin.top=(y+yyy)+"px";
    skin.left=x+Xoffset+"px";
  }    
  nudge(x);
}

function nudge(x)
{

if(pupInitialized == 0) return;

  var extreme,overflow,temp;

  if(iex) extreme=(document.body.clientWidth-popwidth);
  if(n_6 || nav) extreme=(window.innerWidth-popwidth);

  if(parseInt(skin.left)>extreme)
  {
    overflow=parseInt(skin.left)-extreme;
    temp=parseInt(skin.left);
    temp-=overflow;
    if(nav || iex) skin.left=temp;
    if(n_6)skin.left=temp+"px";
  }

  if(parseInt(skin.left)<1)
  {
    overflow=parseInt(skin.left)-1;
    temp=parseInt(skin.left);
    temp-=overflow;
    if(nav || iex) skin.left=temp;
    if(n_6)skin.left=temp+"px";
  }
}

function popup(msg,bak)
{
if(pupInitialized == 0) return;

  var content="<TABLE WIDTH='"+popwidth+"' BORDER='1' BORDERCOLOR="+bcolor+" CELLPADDING=2 CELLSPACING=0 "+"BGCOLOR="+bak+"><TD ALIGN='center' style='font-size:8pt'><FONT COLOR="+fcolor+" FACE="+fface+">"+msg+"</FONT></TD></TABLE>";

  if(old)
  {
    alert(msg);
    return;
  } 
   
  yyy=Yoffset; 
  skin.width=popwidth;

  if(nav)
  { 
    skin.document.open();
    skin.document.write(content);
    skin.document.close();
    skin.visibility="visible";
  }

  if(iex)
  {        
    pup.innerHTML=content;
    skin.visibility="visible";
  }  

  if(n_6)
  {   
    document.getElementById("pup").innerHTML=content;
    skin.visibility="visible";
  }
}

function kill()
{
if(pupInitialized == 0) return;

  if(!old)
  {
    yyy=-1000;
    skin.visibility="hidden";
    skin.width=0;
  }
}

function initPup()
{
if(nav) skin=document.pup;
if(iex) skin=pup.style;
if(n_6) skin=document.getElementById("pup").style;

if(nav)document.captureEvents(Event.MOUSEMOVE);
if(n_6) document.addEventListener("mousemove",get_mouse,true);
if(nav||iex)document.onmousemove=get_mouse;

	pupInitialized = 1
}


    var map;
    var gdir;
    var geocoder = null;
    var addressMarker;
    
    function loadDirs() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        gdir = new GDirections(map, document.getElementById("directions"));
        GEvent.addListener(gdir, "load", onGDirectionsLoad);
        GEvent.addListener(gdir, "error", handleErrors);

      }
    }






function NEtoLL(east, north) 
{
  // converts NGR easting and nothing to lat, lon.
  // input metres, output radians
  var nX = Number(north);
  var eX = Number(east);
  a = 6377563.396;       // OSI semi-major
  b = 6356256.91;        // OSI semi-minor
  e0 = 400000;           // easting of false origin
  n0 = -100000;          // northing of false origin
  f0 = 0.9996012717;     // OSI scale factor on central meridian
  e2 = 0.0066705397616;  // OSI eccentricity squared
  lam0 = -0.034906585039886591;  // OSI false east
//  phi0 = 0.85521133347722145;    // OSI false north
//  lam0 = -0.03493475;  // OSI false east
  phi0 = 0.85521133347722145;    // OSI false north
  var af0 = a * f0;
  var bf0 = b * f0;
  var n = (af0 - bf0) / (af0 + bf0);
  var Et = east - e0;
  var phid = InitialLat(north, n0, af0, phi0, n, bf0);
  var nu = af0 / (Math.sqrt(1 - (e2 * (Math.sin(phid) * Math.sin(phid)))));
  var rho = (nu * (1 - e2)) / (1 - (e2 * (Math.sin(phid)) * (Math.sin(phid))));
  var eta2 = (nu / rho) - 1;
  var tlat2 = Math.tan(phid) * Math.tan(phid);
  var tlat4 = Math.pow(Math.tan(phid), 4);
  var tlat6 = Math.pow(Math.tan(phid), 6);
  var clatm1 = Math.pow(Math.cos(phid), -1);
  var VII = Math.tan(phid) / (2 * rho * nu);
  var VIII = (Math.tan(phid) / (24 * rho * (nu * nu * nu))) * (5 + (3 * tlat2) + eta2 - (9 * eta2 * tlat2));
  var IX = ((Math.tan(phid)) / (720 * rho * Math.pow(nu, 5))) * (61 + (90 * tlat2) + (45 * Math.pow(Math.tan(phid), 4) ));
  var phip = (phid - ((Et * Et) * VII) + (Math.pow(Et, 4) * VIII) - (Math.pow(Et, 6) * IX)); 
  var X = Math.pow(Math.cos(phid), -1) / nu;
  var XI = (clatm1 / (6 * (nu * nu * nu))) * ((nu / rho) + (2 * (tlat2)));
  var XII = (clatm1 / (120 * Math.pow(nu, 5))) * (5 + (28 * tlat2) + (24 * tlat4));
  var XIIA = clatm1 / (5040 * Math.pow(nu, 7)) * (61 + (662 * tlat2) + (1320 * tlat4) + (720 * tlat6));
  var lambdap = (lam0 + (Et * X) - ((Et * Et * Et) * XI) + (Math.pow(Et, 5) * XII) - (Math.pow(Et, 7) * XIIA));
  var geo = { latitude: phip, longitude: lambdap };
  return(geo);
} 

function Marc(bf0, n, phi0, phi)
{
  var Marc = bf0 * (((1 + n + ((5 / 4) * (n * n)) + ((5 / 4) * (n * n * n))) * (phi - phi0))
    - (((3 * n) + (3 * (n * n)) + ((21 / 8) * (n * n * n))) * (Math.sin(phi - phi0)) * (Math.cos(phi + phi0)))
    + ((((15 / 8) * (n * n)) + ((15 / 8) * (n * n * n))) * (Math.sin(2 * (phi - phi0))) * (Math.cos(2 * (phi + phi0))))
    - (((35 / 24) * (n * n * n)) * (Math.sin(3 * (phi - phi0))) * (Math.cos(3 * (phi + phi0)))));
  return(Marc);
}

function InitialLat(north, n0, af0, phi0, n, bf0)
{
  var phi1 = ((north - n0) / af0) + phi0;
  var M = Marc(bf0, n, phi0, phi1);
  var phi2 = ((north - n0 - M) / af0) + phi1;
  var ind = 0;
  while ((Math.abs(north - n0 - M) > 0.00001) && (ind < 20))  // max 20 iterations in case of error
  {  
	ind = ind + 1;
	phi2 = ((north - n0 - M) / af0) + phi1;
    M = Marc(bf0, n, phi0, phi2);
    phi1 = phi2;
  }
  return(phi2);  
}

















function convert(p, e1, t, e2) {
  // -- convert polar to cartesian coordinates (using ellipse 1)
  
  p1 = new LatLon(p.lat, p.lon, p.height);  // to avoid modifying passed param
  p1.lat = p.lat.toRad(); p1.lon = p.lon.toRad(); 

  var a = e1.a, b = e1.b;

  var sinPhi = Math.sin(p1.lat), cosPhi = Math.cos(p1.lat);
  var sinLambda = Math.sin(p1.lon), cosLambda = Math.cos(p1.lon);
  var H = p1.height;

  var eSq = (a*a - b*b) / (a*a);
  var nu = a / Math.sqrt(1 - eSq*sinPhi*sinPhi);

  var x1 = (nu+H) * cosPhi * cosLambda;
  var y1 = (nu+H) * cosPhi * sinLambda;
  var z1 = ((1-eSq)*nu + H) * sinPhi;


  // -- apply helmert transform using appropriate params
  
  var tx = t.tx, ty = t.ty, tz = t.tz;
  var rx = t.rx/3600 * Math.PI/180;  // normalise seconds to radians
  var ry = t.ry/3600 * Math.PI/180;
  var rz = t.rz/3600 * Math.PI/180;
  var s1 = t.s/1e6 + 1;              // normalise ppm to (s+1)

  // apply transform
  var x2 = tx + x1*s1 - y1*rz + z1*ry;
  var y2 = ty + x1*rz + y1*s1 - z1*rx;
  var z2 = tz - x1*ry + y1*rx + z1*s1;


  // -- convert cartesian to polar coordinates (using ellipse 2)

  a = e2.a, b = e2.b;
  var precision = 4 / a;  // results accurate to around 4 metres

  eSq = (a*a - b*b) / (a*a);
  var p = Math.sqrt(x2*x2 + y2*y2);
  var phi = Math.atan2(z2, p*(1-eSq)), phiP = 2*Math.PI;
  while (Math.abs(phi-phiP) > precision) {
    nu = a / Math.sqrt(1 - eSq*Math.sin(phi)*Math.sin(phi));
    phiP = phi;
    phi = Math.atan2(z2 + eSq*nu*Math.sin(phi), p);
  }
  var lambda = Math.atan2(y2, x2);
  H = p/Math.cos(phi) - nu;

  return new LatLon(phi.toDeg(), lambda.toDeg(), H);
}


function convertWGS84toOSGB36(p1) {
  var p2 = convert(p1, e.WGS84, h.WGS84toOSGB36, e.Airy1830);
  return p2;
}


/*
 * construct a LatLon object: arguments in numeric degrees
 *
 * note all LatLong methods expect & return numeric degrees (for lat/long & for bearings)
 */
function LatLon(lat, lon, height) {
  if (arguments.length < 3) height = 0;
  this.lat = lat;
  this.lon = lon;
  this.height = height;
}



/*
 * convert geodesic co-ordinates to OS grid reference
 *   see www.gps.gov.uk/guidecontents.asp Annex C
 */
 
function LatLongToOSGrid(p) {
  var lat = p.lat.toRad(), lon = p.lon.toRad();
  
  var a = 6377563.396, b = 6356256.910;          // Airy 1830 major & minor semi-axes
  var F0 = 0.9996012717;                         // NatGrid scale factor on central meridian
  var lat0 = (49).toRad(), lon0 = (-2).toRad();  // NatGrid true origin
  var N0 = -100000, E0 = 400000;                 // northing & easting of true origin, metres
  var e2 = 1 - (b*b)/(a*a);                      // eccentricity squared
  var n = (a-b)/(a+b), n2 = n*n, n3 = n*n*n;

  var cosLat = Math.cos(lat), sinLat = Math.sin(lat);
  var nu = a*F0/Math.sqrt(1-e2*sinLat*sinLat);              // transverse radius of curvature
  var rho = a*F0*(1-e2)/Math.pow(1-e2*sinLat*sinLat, 1.5);  // meridional radius of curvature
  var eta2 = nu/rho-1;

  var Ma = (1 + n + (5/4)*n2 + (5/4)*n3) * (lat-lat0);
  var Mb = (3*n + 3*n*n + (21/8)*n3) * Math.sin(lat-lat0) * Math.cos(lat+lat0);
  var Mc = ((15/8)*n2 + (15/8)*n3) * Math.sin(2*(lat-lat0)) * Math.cos(2*(lat+lat0));
  var Md = (35/24)*n3 * Math.sin(3*(lat-lat0)) * Math.cos(3*(lat+lat0));
  var M = b * F0 * (Ma - Mb + Mc - Md);              // meridional arc

  var cos3lat = cosLat*cosLat*cosLat;
  var cos5lat = cos3lat*cosLat*cosLat;
  var tan2lat = Math.tan(lat)*Math.tan(lat);
  var tan4lat = tan2lat*tan2lat;

  var I = M + N0;
  var II = (nu/2)*sinLat*cosLat;
  var III = (nu/24)*sinLat*cos3lat*(5-tan2lat+9*eta2);
  var IIIA = (nu/720)*sinLat*cos5lat*(61-58*tan2lat+tan4lat);
  var IV = nu*cosLat;
  var V = (nu/6)*cos3lat*(nu/rho-tan2lat);
  var VI = (nu/120) * cos5lat * (5 - 18*tan2lat + tan4lat + 14*eta2 - 58*tan2lat*eta2);

  var dLon = lon-lon0;
  var dLon2 = dLon*dLon, dLon3 = dLon2*dLon, dLon4 = dLon3*dLon, dLon5 = dLon4*dLon, dLon6 = dLon5*dLon;

  var N = I + II*dLon2 + III*dLon4 + IIIA*dLon6;
  var E = E0 + IV*dLon + V*dLon3 + VI*dLon5;

//	alert('Easting: ' + E)
//	alert('Northing: ' + N)

  var geo = { easting:Math.round(E), northing:Math.round(N) };
  return(geo);
 }

 
 
function LLToEN(lat,lon)
{
pWGS = new LatLon(lat.parseDeg(),lon.parseDeg());
pOSGB = convertWGS84toOSGB36(pWGS);

//geo = LatLongToOSGrid(pOSGB);

pOSG = LatLongToOSGrid(pOSGB);

E1 = pOSG.easting;
N1 = pOSG.northing;


	var geo = { easting:E1, northing:N1 }

	return(geo);


//alert('Easting2: ' + geo.easting);
//alert('Northing2: ' + geo.northing);
}
 



/*
 * convert OS grid reference to geodesic co-ordinates
 */
function ENToLatLong(E,N) {

  var a = 6377563.396, b = 6356256.910;              // Airy 1830 major & minor semi-axes
  var F0 = 0.9996012717;                             // NatGrid scale factor on central meridian
  var lat0 = 49*Math.PI/180, lon0 = -2*Math.PI/180;  // NatGrid true origin
  var N0 = -100000, E0 = 400000;                     // northing & easting of true origin, metres
  var e2 = 1 - (b*b)/(a*a);                          // eccentricity squared
  var n = (a-b)/(a+b), n2 = n*n, n3 = n*n*n;

  var lat=lat0, M=0;
  do {
    lat = (N-N0-M)/(a*F0) + lat;

    var Ma = (1 + n + (5/4)*n2 + (5/4)*n3) * (lat-lat0);
    var Mb = (3*n + 3*n*n + (21/8)*n3) * Math.sin(lat-lat0) * Math.cos(lat+lat0);
    var Mc = ((15/8)*n2 + (15/8)*n3) * Math.sin(2*(lat-lat0)) * Math.cos(2*(lat+lat0));
    var Md = (35/24)*n3 * Math.sin(3*(lat-lat0)) * Math.cos(3*(lat+lat0));
    M = b * F0 * (Ma - Mb + Mc - Md);                // meridional arc

  } while (N-N0-M >= 0.00001);  // ie until < 0.01mm

  var cosLat = Math.cos(lat), sinLat = Math.sin(lat);
  var nu = a*F0/Math.sqrt(1-e2*sinLat*sinLat);              // transverse radius of curvature
  var rho = a*F0*(1-e2)/Math.pow(1-e2*sinLat*sinLat, 1.5);  // meridional radius of curvature
  var eta2 = nu/rho-1;

  var tanLat = Math.tan(lat);
  var tan2lat = tanLat*tanLat, tan4lat = tan2lat*tan2lat, tan6lat = tan4lat*tan2lat;
  var secLat = 1/cosLat;
  var nu3 = nu*nu*nu, nu5 = nu3*nu*nu, nu7 = nu5*nu*nu;
  var VII = tanLat/(2*rho*nu);
  var VIII = tanLat/(24*rho*nu3)*(5+3*tan2lat+eta2-9*tan2lat*eta2);
  var IX = tanLat/(720*rho*nu5)*(61+90*tan2lat+45*tan4lat);
  var X = secLat/nu;
  var XI = secLat/(6*nu3)*(nu/rho+2*tan2lat);
  var XII = secLat/(120*nu5)*(5+28*tan2lat+24*tan4lat);
  var XIIA = secLat/(5040*nu7)*(61+662*tan2lat+1320*tan4lat+720*tan6lat);

  var dE = (E-E0), dE2 = dE*dE, dE3 = dE2*dE, dE4 = dE2*dE2, dE5 = dE3*dE2, dE6 = dE4*dE2, dE7 = dE5*dE2;
  lat = lat - VII*dE2 + VIII*dE4 - IX*dE6;
  var lon = lon0 + X*dE - XI*dE3 + XII*dE5 - XIIA*dE7;
	
  return new LatLon(lat.toDeg(), lon.toDeg());
}

 
function ENToLL(e,n) 
{
pOSGB=ENToLatLong(e,n)
pWGS = convertOSGB36toWGS84(pOSGB);

lat1 = pWGS.lat;
lon1 = pWGS.lon;

	var geo = { latitude:lat1, longitude:lon1 }

	return(geo);
}


// ---- the following are duplicated from latlong-convert-coords.html ---- //

// ellipse parameters
var e = { WGS84:    { a: 6378137,     b: 6356752.3142, f: 1/298.257223563 },
          Airy1830: { a: 6377563.396, b: 6356256.910,  f: 1/299.3249646   } };

// helmert transform parameters
var h = { WGS84toOSGB36: { tx: -446.448,  ty:  125.157,   tz: -542.060,   // m
                           rx:   -0.1502, ry:   -0.2470,  rz:   -0.8421,  // sec
                           s:    20.4894 },                               // ppm
          OSGB36toWGS84: { tx:  446.448,  ty: -125.157,   tz:  542.060,
                           rx:    0.1502, ry:    0.2470,  rz:    0.8421,
                           s:   -20.4894 } };

                 
function convertOSGB36toWGS84(p1) {
  var p2 = convert(p1, e.Airy1830, h.OSGB36toWGS84, e.WGS84);
  return p2;
}




// ---- the following are duplicated from latlong.html ---- //



// extend String object with method for parsing degrees or lat/long values to numeric degrees
//
// this is very flexible on formats, allowing signed decimal degrees, or deg-min-sec suffixed by 
// compass direction (NSEW). A variety of separators are accepted (eg 3º 37' 09"W) or fixed-width 
// format without separators (eg 0033709W). Seconds and minutes may be omitted. (Minimal validation 
// is done).

String.prototype.parseDeg = function() {
  if (!isNaN(this)) return Number(this);                 // signed decimal degrees without NSEW

  var degLL = this.replace(/^-/,'').replace(/[NSEW]/i,'');  // strip off any sign or compass dir'n
  var dms = degLL.split(/[^0-9.]+/);                     // split out separate d/m/s
  for (var i in dms) if (dms[i]=='') dms.splice(i,1);    // remove empty elements (see note below)
  switch (dms.length) {                                  // convert to decimal degrees...
    case 3:                                              // interpret 3-part result as d/m/s
      var deg = dms[0]/1 + dms[1]/60 + dms[2]/3600; break;
    case 2:                                              // interpret 2-part result as d/m
      var deg = dms[0]/1 + dms[1]/60; break;
    case 1:                                              // decimal or non-separated dddmmss
      if (/[NS]/i.test(this)) degLL = '0' + degLL;       // - normalise N/S to 3-digit degrees
      var deg = dms[0].slice(0,3)/1 + dms[0].slice(3,5)/60 + dms[0].slice(5)/3600; break;
    default: return NaN;
  }
  if (/^-/.test(this) || /[WS]/i.test(this)) deg = -deg; // take '-', west and south as -ve
  return deg;
}
// note: whitespace at start/end will split() into empty elements (except in IE)


// extend Number object with methods for converting degrees/radians

Number.prototype.toRad = function() {  // convert degrees to radians
  return this * Math.PI / 180;
}

Number.prototype.toDeg = function() {  // convert radians to degrees (signed)
  return this * 180 / Math.PI;
}


// extend Number object with methods for presenting bearings & lat/longs

Number.prototype.toDMS = function(dp) {  // convert numeric degrees to deg/min/sec
  if (arguments.length < 1) dp = 0;      // if no decimal places argument, round to int seconds
  var d = Math.abs(this);  // (unsigned result ready for appending compass dir'n)
  var deg = Math.floor(d);
  var min = Math.floor((d-deg)*60);
  var sec = ((d-deg-min/60)*3600).toFixed(dp);
  // fix any nonsensical rounding-up
  if (sec==60) { sec = (0).toFixed(dp); min++; }
  if (min==60) { min = 0; deg++; }
  if (deg==360) deg = 0;
  // add leading zeros if required
  if (deg<100) deg = '0' + deg; if (deg<10) deg = '0' + deg;
  if (min<10) min = '0' + min;
  if (sec<10) sec = '0' + sec;
  return deg + '\u00B0' + min + '\u2032' + sec + '\u2033';
}
















var lastElement = 0;    
var doScroll = 0;
var lastrestCt = 0;
var lastBut = 0
//var toPC2;
//var fromPC;
var toPC;
var toPC1;
var toPC2;
var fromPC;
var triedLonLat = 0;
var triedTown = 0;

    function updateDirDiv(toad, totown, topc1, fromx, fromy, tox, toy, restElement, restCt, butID)
    {
	triedLonLat = 0;
	triedTown = 0;

//  geo = NEtoLL(fromx, fromy);
//  lat = geo.latitude / (2*Math.PI) * 360;
//  lon = geo.longitude / (2*Math.PI) * 360;
  geo = ENToLL(fromx, fromy);
  lat = geo.latitude;
  lon = geo.longitude;

fromPC = lat + ',' + lon;

  geo = ENToLL(tox, toy);
  lat = geo.latitude;
  lon = geo.longitude;
//  lat = geo.latitude / (2*Math.PI) * 360;
//  lon = geo.longitude / (2*Math.PI) * 360;

toPC2 = lat + ',' + lon;

toPC = toad + ',' + totown + ',' + topc1
toPC1 = toad + ',' + topc1

//	alert(toPC)

//    	alert(document.getElementById(restElement).innerHTML)
//    	if(lastElement != 0)
//	   	{
	   	if(lastrestCt != 0 && lastrestCt < restCt)
			{	   		
//			alert(document.getElementById("directions").innerHTML)
	   		if(lastBut == 4 || lastBut == 11)
				{
				scrolltopPos = document.body.scrollTop - 334 - document.getElementById("directions").offsetHeight
				GUnload();
				}
	   		if(lastBut >= 1 && lastBut <= 3)
				{
				scrolltopPos = document.body.scrollTop - 404
				}
	   		if(lastBut >= 5 && lastBut <= 10)
				{
				scrolltopPos = document.body.scrollTop - 404
				}
//	   		if(lastBut == 1)
//				{
//				scrolltopPos = document.body.scrollTop - 414
//				}
//	   		if(lastBut == 2)
//				{
//				scrolltopPos = document.body.scrollTop - 414
//				}
//	   		if(lastBut == 3)
//				{
//				scrolltopPos = document.body.scrollTop - 384
//				}
			doScroll = 1
			}
		else
			{
			doScroll = 0
			}
//			document.body.scrollTop	= document.body.scrollTop - 486 - document.getElementById("directions").offsetHeight
//		    	document.getElementById(lastElement).innerHTML = ''
//		    	document.getElementById(lastElement).innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
// 	   		}
//	    	lastElement = restElement;

		if(lastrestCt == restCt && butID == lastBut)
			{
			document.getElementById(restElement).innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
			GUnload();
			lastrestCt = 0
			}
		else
			{
		    	lastrestCt = restCt
    	
   		 	if(document.getElementById("directions1")) document.getElementById("directions1").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		    	if(document.getElementById("directions2")) document.getElementById("directions2").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		   	if(document.getElementById("directions3")) document.getElementById("directions3").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		   	if(document.getElementById("directions4")) document.getElementById("directions4").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
   		 	if(document.getElementById("directions5")) document.getElementById("directions5").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'

//		   	document.getElementById(restElement).innerHTML = '<tr><td><div align=center><table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td><font face=verdana><div id=map style="VISIBILITY:visible WIDTH: 550px; HEIGHT: 500px"></div></font></td></tr><tr><td class=rs_ad><font face=arial><div id=directions style="width: 540px"></div></font></td></tr></TBODY</TABLE></div></td></tr>'
//		   	document.getElementById(restElement).innerHTML = '<form action="#" onsubmit="setDirections(this.from.value, this.to.value, this.locale.value); return false"><table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td><font face=verdana><div id=map style="VISIBILITY:visible WIDTH: 550px; HEIGHT: 330px"></div></font></td></tr><tr><td class=rs_ad><font face=arial><div id=directions style="width: 540px"></div></font></td></tr></TBODY</TABLE></form>'
//		   	document.getElementById(restElement).innerHTML = '<form action="#" onsubmit="setDirections(this.from.value, this.to.value, this.locale.value); return false"><table><tr><th align=right>From:&nbsp;</th><td><input type=text size=25 id=fromAddress name=from value="San Francisco"></td></tr></table><table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td><font face=verdana><div id=map style="VISIBILITY:visible WIDTH: 550px; HEIGHT: 330px"></div></font></td></tr><tr><td class=rs_ad><font face=arial><div id=directions style="width: 540px"></div></font></td></tr></TBODY</TABLE></form>'
//		   	document.getElementById(restElement).innerHTML = '<form action="#" onsubmit="setDirections(this.from.value, this.to.value); return false"><table><tr> <th align=right>From:&nbsp;</th> <td><input type=text size=25 id=fromAddress name="from" value="San Francisco"></td>  <input name=submit type=submit value="Get Directions!"></td>  </tr></table><table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td><font face=verdana><div id=map style="VISIBILITY:visible WIDTH: 550px; HEIGHT: 330px"></div></font></td></tr><tr><td class=rs_ad><font face=arial><div id=directions style="width: 540px"></div></font></td></tr></TBODY</TABLE></form>'
		   	document.getElementById(restElement).innerHTML = '<form action="#" onsubmit="setDirections(this.from.value, this.to.value); return false"><table bgcolor="#CBC6B9" width=550><tr> <td class=rs_ad align=right valign=top>Your FULL Address:&nbsp;</td><td><input type=text size=40 id=fromAddress name=from style="background-color: #DFF4F7; font-size: 8pt; font-family: Verdana; color: #800000; border-style: inset; border-width: 0"></td>  <td><input type=hidden size=18 id=toAddress name=to value="' + toPC + '" style="background-color: #DFF4F7; font-size: 8pt; font-family: Verdana; color: #800000; border-style: inset; border-width: 0"><td><input name=submit type=submit value="Get Directions!"></td>  </tr></table><table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td><font face=verdana><div id=map style="VISIBILITY:visible WIDTH: 550px; HEIGHT: 330px"></div></font></td></tr><tr><td class=rs_ad><font face=arial><div id=directions style="width: 540px"></div></font></td></tr></TBODY</TABLE></form>'

		   	document.getElementById(restElement).style.height = "100%";
			loadDirs();
//			alert('to PC: ' + toPC)
			setDirections(fromPC, toPC, 'en_US')
		
			if(doScroll == 1)
				{
				document.body.scrollTop	= scrolltopPos;
				}
			}
	lastBut = butID
	}
   
    function updateDirDiv2(toad, totown, topc1, fromx, fromy, tox, toy, restElement, restCt, butID)
    {
	triedLonLat = 0;
	triedTown = 0;

//  geo = NEtoLL(fromx, fromy);
//  lat = geo.latitude / (2*Math.PI) * 360;
//  lon = geo.longitude / (2*Math.PI) * 360;
  geo = ENToLL(fromx, fromy);
  lat = geo.latitude;
  lon = geo.longitude;

fromPC = lat + ',' + lon;

  geo = ENToLL(tox, toy);
  lat = geo.latitude;
  lon = geo.longitude;
//  lat = geo.latitude / (2*Math.PI) * 360;
//  lon = geo.longitude / (2*Math.PI) * 360;

toPC2 = lat + ',' + lon;

toPC = toad + ',' + totown + ',' + topc1
toPC1 = toad + ',' + topc1

//	alert(toPC)

//    	alert(document.getElementById(restElement).innerHTML)
//    	if(lastElement != 0)
//	   	{
	   	if(lastrestCt != 0 && lastrestCt < restCt)
			{	   		
//			alert(document.getElementById("directions").innerHTML)
	   		if(lastBut == 4 || lastBut == 11)
				{
				scrolltopPos = document.body.scrollTop - 334 - document.getElementById("directions").offsetHeight
				GUnload();
				}
	   		if(lastBut >= 1 && lastBut <= 3)
				{
				scrolltopPos = document.body.scrollTop - 404
				}
	   		if(lastBut >= 5 && lastBut <= 10)
				{
				scrolltopPos = document.body.scrollTop - 404
				}
//	   		if(lastBut == 1)
//				{
//				scrolltopPos = document.body.scrollTop - 414
//				}
//	   		if(lastBut == 2)
//				{
//				scrolltopPos = document.body.scrollTop - 414
//				}
//	   		if(lastBut == 3)
//				{
//				scrolltopPos = document.body.scrollTop - 384
//				}
			doScroll = 1
			}
		else
			{
			doScroll = 0
			}
//			document.body.scrollTop	= document.body.scrollTop - 486 - document.getElementById("directions").offsetHeight
//		    	document.getElementById(lastElement).innerHTML = ''
//		    	document.getElementById(lastElement).innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
// 	   		}
//	    	lastElement = restElement;

		if(lastrestCt == restCt && butID == lastBut)
			{
			document.getElementById(restElement).innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
			GUnload();
			lastrestCt = 0
			}
		else
			{
		    	lastrestCt = restCt
    	
   		 	if(document.getElementById("directions1")) document.getElementById("directions1").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		    	if(document.getElementById("directions2")) document.getElementById("directions2").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		   	if(document.getElementById("directions3")) document.getElementById("directions3").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		   	if(document.getElementById("directions4")) document.getElementById("directions4").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
   		 	if(document.getElementById("directions5")) document.getElementById("directions5").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'

//		   	document.getElementById(restElement).innerHTML = '<tr><td><div align=center><table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td><font face=verdana><div id=map style="VISIBILITY:visible WIDTH: 550px; HEIGHT: 500px"></div></font></td></tr><tr><td class=rs_ad><font face=arial><div id=directions style="width: 540px"></div></font></td></tr></TBODY</TABLE></div></td></tr>'
//		   	document.getElementById(restElement).innerHTML = '<form action="#" onsubmit="setDirections(this.from.value, this.to.value, this.locale.value); return false"><table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td><font face=verdana><div id=map style="VISIBILITY:visible WIDTH: 550px; HEIGHT: 330px"></div></font></td></tr><tr><td class=rs_ad><font face=arial><div id=directions style="width: 540px"></div></font></td></tr></TBODY</TABLE></form>'
//		   	document.getElementById(restElement).innerHTML = '<form action="#" onsubmit="setDirections(this.from.value, this.to.value, this.locale.value); return false"><table><tr><th align=right>From:&nbsp;</th><td><input type=text size=25 id=fromAddress name=from value="San Francisco"></td></tr></table><table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td><font face=verdana><div id=map style="VISIBILITY:visible WIDTH: 550px; HEIGHT: 330px"></div></font></td></tr><tr><td class=rs_ad><font face=arial><div id=directions style="width: 540px"></div></font></td></tr></TBODY</TABLE></form>'
//		   	document.getElementById(restElement).innerHTML = '<form action="#" onsubmit="setDirections(this.from.value, this.to.value); return false"><table><tr> <th align=right>From:&nbsp;</th> <td><input type=text size=25 id=fromAddress name="from" value="San Francisco"></td>  <input name=submit type=submit value="Get Directions!"></td>  </tr></table><table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td><font face=verdana><div id=map style="VISIBILITY:visible WIDTH: 550px; HEIGHT: 330px"></div></font></td></tr><tr><td class=rs_ad><font face=arial><div id=directions style="width: 540px"></div></font></td></tr></TBODY</TABLE></form>'
		   	document.getElementById(restElement).innerHTML = '<form action="#" onsubmit="setDirections(this.from.value, this.to.value); return false"><table bgcolor="#CBC6B9" width=550><tr> <td class=rs_ad align=right valign=top>Your FULL Address:&nbsp;</td><td><input type=text size=40 id=fromAddress name=from style="background-color: #DFF4F7; font-size: 8pt; font-family: Verdana; color: #800000; border-style: inset; border-width: 0"></td>  <td><input type=hidden size=18 id=toAddress name=to value="' + toPC + '" style="background-color: #DFF4F7; font-size: 8pt; font-family: Verdana; color: #800000; border-style: inset; border-width: 0"><td><input name=submit type=submit value="Get Directions!"></td>  </tr></table><table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td><font face=verdana><div id=map style="VISIBILITY:visible WIDTH: 550px; HEIGHT: 330px"></div></font></td></tr><tr><td class=rs_ad><font face=arial><div id=directions style="width: 540px"></div></font></td></tr></TBODY</TABLE></form>'

		   	document.getElementById(restElement).style.height = "100%";
			loadDirs();
//			alert('to PC: ' + toPC)
			setDirections(fromPC, toPC2, 'en_US')
		
			if(doScroll == 1)
				{
				document.body.scrollTop	= scrolltopPos;
				}
			}
	lastBut = butID
	}
   

    function setDirections(fromAddress, toAddress, locale) {
locale = 'en_US';

	fromPC = fromAddress;

//	alert('from: ' + fromAddress)
//	alert('to: ' + toAddress)

      gdir.load("from: " + fromAddress + " to: " + toAddress,
                { "locale": locale });
    }

    function handleErrors(){
	   if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
		{
		if(triedLonLat)
			{
//			alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: " + gdir.getStatus().code);	
			alert("'" + fromPC + "' was not recognised. Please try again. Please including\nthe town and postcode and try leaving out house or building names.")
			triedLonLat = 0;
			triedTown = 0;
			}
		else
			{
//	alert('FromPC: ' + fromPC);
			if(triedTown)
				{				
//				alert('to PC2: ' + toPC2)
				triedLonLat = 1
				setDirections(fromPC, toPC2, 'en_US')
				}
			else
				{
				triedTown = 1
//				alert('to PC1: ' + toPC1)
//				alert('from: ' + fromPC)
				setDirections(fromPC, toPC1, 'en_US')
				}
			}
		}
	   else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
	     alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: " + gdir.getStatus().code);
	   
	   else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
	     alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: " + gdir.getStatus().code);

	//   else if (gdir.getStatus().code == G_UNAVAILABLE_ADDRESS)  <--- Doc bug... this is either not defined, or Doc is wrong
	//     alert("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.\n Error code: " + gdir.getStatus().code);
	     
	   else if (gdir.getStatus().code == G_GEO_BAD_KEY)
	     alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + gdir.getStatus().code);

	   else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
	     alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);
	    
	   else alert("An unknown error occurred.");
	   
	}

	function onGDirectionsLoad(){ 
		triedLonLat = 0;
		triedTown = 0;

//		alert('Loaded gdir: ' + gdir.getStatus().code)

          // Use this function to access information about the latest load()
          // results.

          // e.g.
	  // document.getElementById("getStatus").innerHTML = gdir.getStatus().code;
	  // and yada yada yada...
	}





	function updateRUKBookDiv(restID, restElement, restCt, butID)
	{
//		alert('Hello')
   		if(lastrestCt != 0 && lastrestCt < restCt)
			{	   		
	   		if(lastBut == 4 || lastBut == 11)
				{
				scrolltopPos = document.body.scrollTop - 334 - document.getElementById("directions").offsetHeight
				GUnload();
				}
	   		if(lastBut >= 1 && lastBut <= 3)
				{
				scrolltopPos = document.body.scrollTop - 404
				}
	   		if(lastBut >= 5 && lastBut <= 10)
				{
				scrolltopPos = document.body.scrollTop - 404
				}
//	   		if(lastBut == 1)
//				{
//				scrolltopPos = document.body.scrollTop - 404
//				}
//	   		if(lastBut == 2)
//				{
//				scrolltopPos = document.body.scrollTop - 404
//				}
//	   		if(lastBut == 3)
//				{
//				scrolltopPos = document.body.scrollTop - 404
//				}
			doScroll = 1
			}
		else
			{
			doScroll = 0
			}

		if(lastrestCt == restCt && butID == lastBut)
			{
			document.getElementById(restElement).innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
			lastrestCt = 0
			}
		else
			{
		    	lastrestCt = restCt
    	
   		 	if(document.getElementById("directions1")) document.getElementById("directions1").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		    	if(document.getElementById("directions2")) document.getElementById("directions2").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		   	if(document.getElementById("directions3")) document.getElementById("directions3").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		   	if(document.getElementById("directions4")) document.getElementById("directions4").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
   		 	if(document.getElementById("directions5")) document.getElementById("directions5").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'

		   	document.getElementById(restElement).innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td class=rs_ad><font face=verdana><div id=offersLB style="VISIBILITY:visible WIDTH: 550px; HEIGHT: 400px"><br><iframe allowtransparency = "true" id ="test" src="https://www.restaurantuk.com/ruk_book.asp?ID=' + restID + '" width = 550 height = 380 frameborder="0" marginwidth="0" marginheight="0" scrolling="no"> </iframe></div></font></td></tr></TBODY</TABLE>'

		   	document.getElementById(restElement).style.height = "100%";

			if(doScroll == 1)
				{
				document.body.scrollTop	= scrolltopPos;
				}
			}
	lastBut = butID
	}





	function updateRUKOffersDiv(restID, restElement, restCt, butID)
	{
//		alert('Hello')
   		if(lastrestCt != 0 && lastrestCt < restCt)
			{	   		
	   		if(lastBut == 4 || lastBut == 11)
				{
				scrolltopPos = document.body.scrollTop - 334 - document.getElementById("directions").offsetHeight
				GUnload();
				}
	   		if(lastBut >= 1 && lastBut <= 3)
				{
				scrolltopPos = document.body.scrollTop - 404
				}
	   		if(lastBut >= 5 && lastBut <= 10)
				{
				scrolltopPos = document.body.scrollTop - 404
				}
			doScroll = 1
			}
		else
			{
			doScroll = 0
			}

		if(lastrestCt == restCt && butID == lastBut)
			{
			document.getElementById(restElement).innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
			lastrestCt = 0
			}
		else
			{
		    	lastrestCt = restCt
    	
   		 	if(document.getElementById("directions1")) document.getElementById("directions1").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		    	if(document.getElementById("directions2")) document.getElementById("directions2").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		   	if(document.getElementById("directions3")) document.getElementById("directions3").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		   	if(document.getElementById("directions4")) document.getElementById("directions4").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
   		 	if(document.getElementById("directions5")) document.getElementById("directions5").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'

		   	document.getElementById(restElement).innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td class=rs_ad><font face=verdana><div id=offersLB style="VISIBILITY:visible WIDTH: 550px; HEIGHT: 400px"><br><iframe allowtransparency = "true" id ="test" src="https://www.restaurantuk.com/ruk_offers.asp?ID=' + restID + '" width = 550 height = 380 frameborder="0" marginwidth="0" marginheight="0" scrolling="no"> </iframe></div></font></td></tr></TBODY</TABLE>'

		   	document.getElementById(restElement).style.height = "100%";

			if(doScroll == 1)
				{
				document.body.scrollTop	= scrolltopPos;
				}
			}
	lastBut = butID
	}


	function updateOffersDiv(restID, restElement, restCt, butID)
	{
//		alert('Hello')
   		if(lastrestCt != 0 && lastrestCt < restCt)
			{	   		
	   		if(lastBut == 4 || lastBut == 11)
				{
				scrolltopPos = document.body.scrollTop - 334 - document.getElementById("directions").offsetHeight
				GUnload();
				}
	   		if(lastBut >= 1 && lastBut <= 3)
				{
				scrolltopPos = document.body.scrollTop - 404
				}
	   		if(lastBut >= 5 && lastBut <= 10)
				{
				scrolltopPos = document.body.scrollTop - 404
				}
//	   		if(lastBut == 1)
//				{
//				scrolltopPos = document.body.scrollTop - 414
//				}
//	   		if(lastBut == 2)
//				{
//				scrolltopPos = document.body.scrollTop - 414
//				}
//	   		if(lastBut == 3)
//				{
//				scrolltopPos = document.body.scrollTop - 384
//				}
			doScroll = 1
			}
		else
			{
			doScroll = 0
			}

		if(lastrestCt == restCt && butID == lastBut)
			{
			document.getElementById(restElement).innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
			lastrestCt = 0
			}
		else
			{
		    	lastrestCt = restCt
    	
   		 	if(document.getElementById("directions1")) document.getElementById("directions1").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		    	if(document.getElementById("directions2")) document.getElementById("directions2").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		   	if(document.getElementById("directions3")) document.getElementById("directions3").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		   	if(document.getElementById("directions4")) document.getElementById("directions4").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
   		 	if(document.getElementById("directions5")) document.getElementById("directions5").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'

		   	document.getElementById(restElement).innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td class=rs_ad><font face=verdana><div id=offersLB style="VISIBILITY:visible WIDTH: 550px; HEIGHT: 400px"><br><iframe allowtransparency = "true" id ="test" src="LBOffers3.asp?ID=' + restID + '" width = 550 height = 380 frameborder="0" marginwidth="0" marginheight="0" scrolling="no"> </iframe></div></font></td></tr></TBODY</TABLE>'

		   	document.getElementById(restElement).style.height = "100%";

			if(doScroll == 1)
				{
				document.body.scrollTop	= scrolltopPos;
				}
			}
	lastBut = butID
	}


	function updateBookDiv(restID, restElement, restCt, butID)
	{
//		alert('Hello')
   		if(lastrestCt != 0 && lastrestCt < restCt)
			{	   		
	   		if(lastBut == 4 || lastBut == 11)
				{
				scrolltopPos = document.body.scrollTop - 334 - document.getElementById("directions").offsetHeight
				GUnload();
				}
	   		if(lastBut >= 1 && lastBut <= 3)
				{
				scrolltopPos = document.body.scrollTop - 404
				}
	   		if(lastBut >= 5 && lastBut <= 10)
				{
				scrolltopPos = document.body.scrollTop - 404
				}
//	   		if(lastBut == 1)
//				{
//				scrolltopPos = document.body.scrollTop - 404
//				}
//	   		if(lastBut == 2)
//				{
//				scrolltopPos = document.body.scrollTop - 404
//				}
//	   		if(lastBut == 3)
//				{
//				scrolltopPos = document.body.scrollTop - 404
//				}
			doScroll = 1
			}
		else
			{
			doScroll = 0
			}

		if(lastrestCt == restCt && butID == lastBut)
			{
			document.getElementById(restElement).innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
			lastrestCt = 0
			}
		else
			{
		    	lastrestCt = restCt
    	
   		 	if(document.getElementById("directions1")) document.getElementById("directions1").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		    	if(document.getElementById("directions2")) document.getElementById("directions2").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		   	if(document.getElementById("directions3")) document.getElementById("directions3").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		   	if(document.getElementById("directions4")) document.getElementById("directions4").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
   		 	if(document.getElementById("directions5")) document.getElementById("directions5").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'

		   	document.getElementById(restElement).innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td class=rs_ad><font face=verdana><div id=offersLB style="VISIBILITY:visible WIDTH: 550px; HEIGHT: 400px"><br><iframe allowtransparency = "true" id ="test" src="LBDetails2.asp?ID=' + restID + '" width = 550 height = 380 frameborder="0" marginwidth="0" marginheight="0"> </iframe></div></font></td></tr></TBODY</TABLE>'

		   	document.getElementById(restElement).style.height = "100%";

			if(doScroll == 1)
				{
				document.body.scrollTop	= scrolltopPos;
				}
			}
	lastBut = butID
	}

	function updateInfoDiv(restID, restElement, restCt, butID)
	{
//		alert('Hello')
   		if(lastrestCt != 0 && lastrestCt < restCt)
			{	   		
	   		if(lastBut == 4 || lastBut == 11)
				{
				scrolltopPos = document.body.scrollTop - 334 - document.getElementById("directions").offsetHeight
				GUnload();
				}
	   		if(lastBut >= 1 && lastBut <= 3)
				{
				scrolltopPos = document.body.scrollTop - 404
				}
	   		if(lastBut >= 5 && lastBut <= 10)
				{
				scrolltopPos = document.body.scrollTop - 404
				}
//	   		if(lastBut == 1)
//				{
//				scrolltopPos = document.body.scrollTop - 404
//				}
//	   		if(lastBut == 2)
//				{
//				scrolltopPos = document.body.scrollTop - 404
//				}
//	   		if(lastBut == 3)
//				{
//				scrolltopPos = document.body.scrollTop - 404
//				}
//	   		if(lastBut == 12)
//				{
//				scrolltopPos = document.body.scrollTop - 404
//				}
			doScroll = 1
			}
		else
			{
			doScroll = 0
			}

		if(lastrestCt == restCt && butID == lastBut)
			{
//		alert('Close Info Menu')
			document.getElementById(restElement).innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
			lastrestCt = 0
			}
		else
			{
//		alert('Load Info: ' + restElement)
		    	lastrestCt = restCt
    	
   		 	if(document.getElementById("directions1")) document.getElementById("directions1").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		    	if(document.getElementById("directions2")) document.getElementById("directions2").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		   	if(document.getElementById("directions3")) document.getElementById("directions3").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		   	if(document.getElementById("directions4")) document.getElementById("directions4").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
   		 	if(document.getElementById("directions5")) document.getElementById("directions5").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
			
//		alert(document.getElementById(restElement).innerHTML);

		   	document.getElementById(restElement).innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=570 border=0><TBODY><tr><td class=rs_ad><font face=verdana><div id=offersLB style="VISIBILITY:visible WIDTH: 550px; HEIGHT: 400px"><br><iframe allowtransparency = "true" id ="test" src="LBInfo2.asp?ID=' + restID + '" width = 580 height = 380 frameborder="0" marginwidth="0" marginheight="0"></iframe></div></font></td></tr></TBODY></TABLE>'

//		alert(document.getElementById(restElement).innerHTML);

		   	document.getElementById(restElement).style.height = "100%";

			if(doScroll == 1)
				{
				document.body.scrollTop	= scrolltopPos;
				}
			}
	lastBut = butID
	}

	function updateReviewDiv(restID, restElement, restCt, butID)
	{
   		if(lastrestCt != 0 && lastrestCt < restCt)
			{	   		
	   		if(lastBut == 4 || lastBut == 11)
				{
				scrolltopPos = document.body.scrollTop - 334 - document.getElementById("directions").offsetHeight
				GUnload();
				}
	   		if(lastBut >= 1 && lastBut <= 3)
				{
				scrolltopPos = document.body.scrollTop - 404
				}
	   		if(lastBut >= 5 && lastBut <= 10)
				{
				scrolltopPos = document.body.scrollTop - 404
				}
			doScroll = 1
			}
		else
			{
			doScroll = 0
			}

		if(lastrestCt == restCt && butID == lastBut)
			{
			document.getElementById(restElement).innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
			lastrestCt = 0
			}
		else
			{
		    	lastrestCt = restCt
    	
   		 	if(document.getElementById("directions1")) document.getElementById("directions1").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		    	if(document.getElementById("directions2")) document.getElementById("directions2").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		   	if(document.getElementById("directions3")) document.getElementById("directions3").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		   	if(document.getElementById("directions4")) document.getElementById("directions4").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
   		 	if(document.getElementById("directions5")) document.getElementById("directions5").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
			

		   	document.getElementById(restElement).innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td class=rs_ad><font face=verdana><div id=offersLB style="VISIBILITY:visible WIDTH: 550px; HEIGHT: 400px"><br><iframe allowtransparency = "true" id ="test" src="ruk_reviews.asp?ID=' + restID + '" width = 550 height = 380 frameborder="0" marginwidth="0" marginheight="0"></iframe></div></font></td></tr></TBODY></TABLE>'


		   	document.getElementById(restElement).style.height = "100%";

			if(doScroll == 1)
				{
				document.body.scrollTop	= scrolltopPos;
				}
			}
	lastBut = butID
	}


	function updateMenuDiv(restID, restElement, restCt, butID)
	{
//		alert('Hello')
   		if(lastrestCt != 0 && lastrestCt < restCt)
			{	   		
	   		if(lastBut == 4 || lastBut == 11)
				{
				scrolltopPos = document.body.scrollTop - 334 - document.getElementById("directions").offsetHeight
				GUnload();
				}
	   		if(lastBut >= 1 && lastBut <= 3)
				{
				scrolltopPos = document.body.scrollTop - 404
				}
	   		if(lastBut >= 5 && lastBut <= 10)
				{
				scrolltopPos = document.body.scrollTop - 404
				}
//	   		if(lastBut == 1)
//				{
//				scrolltopPos = document.body.scrollTop - 404
//				}
//	   		if(lastBut == 2)
//				{
//				scrolltopPos = document.body.scrollTop - 404
//				}
//	   		if(lastBut == 3)
//				{
//				scrolltopPos = document.body.scrollTop - 404
//				}
			doScroll = 1
			}
		else
			{
			doScroll = 0
			}

		if(lastrestCt == restCt && butID == lastBut)
			{
			document.getElementById(restElement).innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
			lastrestCt = 0
			}
		else
			{
		    	lastrestCt = restCt
    	
   		 	if(document.getElementById("directions1")) document.getElementById("directions1").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		    	if(document.getElementById("directions2")) document.getElementById("directions2").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		   	if(document.getElementById("directions3")) document.getElementById("directions3").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		   	if(document.getElementById("directions4")) document.getElementById("directions4").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
   		 	if(document.getElementById("directions5")) document.getElementById("directions5").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'

		   	document.getElementById(restElement).innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td class=rs_ad><font face=verdana><div id=offersLB style="VISIBILITY:visible WIDTH: 550px; HEIGHT: 400px"><br><iframe allowtransparency = "true" id ="test" src="LBMenu.asp?ID=' + restID + '" width = 550 height = 380 frameborder="0" marginwidth="0" marginheight="0"></iframe></div></font></td></tr></TBODY></TABLE>'

		   	document.getElementById(restElement).style.height = "100%";

			if(doScroll == 1)
				{
				document.body.scrollTop	= scrolltopPos;
				}
			}
	lastBut = butID
	}

	function updatePhotoDiv(restID, restElement, restCt, butID)
	{
//		alert('Hello')
   		if(lastrestCt != 0 && lastrestCt < restCt)
			{	   		
	   		if(lastBut == 4 || lastBut == 11)
				{
				scrolltopPos = document.body.scrollTop - 334 - document.getElementById("directions").offsetHeight
				GUnload();
				}
	   		if(lastBut >= 1 && lastBut <= 3)
				{
				scrolltopPos = document.body.scrollTop - 404
				}
	   		if(lastBut >= 5 && lastBut <= 10)
				{
				scrolltopPos = document.body.scrollTop - 404
				}
			doScroll = 1
			}
		else
			{
			doScroll = 0
			}

		if(lastrestCt == restCt && butID == lastBut)
			{
			document.getElementById(restElement).innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
			lastrestCt = 0
			}
		else
			{
		    	lastrestCt = restCt
    	
   		 	if(document.getElementById("directions1")) document.getElementById("directions1").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		    	if(document.getElementById("directions2")) document.getElementById("directions2").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		   	if(document.getElementById("directions3")) document.getElementById("directions3").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		   	if(document.getElementById("directions4")) document.getElementById("directions4").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
   		 	if(document.getElementById("directions5")) document.getElementById("directions5").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'

		   	document.getElementById(restElement).innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td class=rs_ad><font face=verdana><div id=offersLB style="VISIBILITY:visible WIDTH: 550px; HEIGHT: 400px"><br><iframe allowtransparency = "true" id ="test" src="LBPhotos.asp?ID=' + restID + '" width = 550 height = 380 frameborder="0" marginwidth="0" marginheight="0"> </iframe></div></font></td></tr></TBODY</TABLE>'

		   	document.getElementById(restElement).style.height = "100%";

			if(doScroll == 1)
				{
				document.body.scrollTop	= scrolltopPos;
				}
			}
	lastBut = butID
	}

	function updateTakeawayDiv(restID, restElement, restCt, butID)
	{
//		alert('Hello')
   		if(lastrestCt != 0 && lastrestCt < restCt)
			{	   		
	   		if(lastBut == 4 || lastBut == 11)
				{
				scrolltopPos = document.body.scrollTop - 334 - document.getElementById("directions").offsetHeight
				GUnload();
				}
	   		if(lastBut >= 1 && lastBut <= 3)
				{
				scrolltopPos = document.body.scrollTop - 404
				}
	   		if(lastBut >= 5 && lastBut <= 10)
				{
				scrolltopPos = document.body.scrollTop - 404
				}
//	   		if(lastBut == 1)
//				{
//				scrolltopPos = document.body.scrollTop - 404
//				}
//	   		if(lastBut == 2)
//				{
//				scrolltopPos = document.body.scrollTop - 404
//				}
//	   		if(lastBut == 3)
//				{
//				scrolltopPos = document.body.scrollTop - 404
//				}
//	   		if(lastBut == 12)
//				{
//				scrolltopPos = document.body.scrollTop - 404
//				}
			doScroll = 1
			}
		else
			{
			doScroll = 0
			}

		if(lastrestCt == restCt && butID == lastBut)
			{
//		alert('Close Info Menu')
			document.getElementById(restElement).innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
			lastrestCt = 0
			}
		else
			{
//		alert('Load Info: ' + restElement)
		    	lastrestCt = restCt
    	
   		 	if(document.getElementById("directions1")) document.getElementById("directions1").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		    	if(document.getElementById("directions2")) document.getElementById("directions2").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		   	if(document.getElementById("directions3")) document.getElementById("directions3").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		   	if(document.getElementById("directions4")) document.getElementById("directions4").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
   		 	if(document.getElementById("directions5")) document.getElementById("directions5").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
			
//		alert(document.getElementById(restElement).innerHTML);

		   	document.getElementById(restElement).innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=570 border=0><TBODY><tr><td class=rs_ad><font face=verdana><div id=offersLB style="VISIBILITY:visible WIDTH: 550px; HEIGHT: 400px"><br><iframe allowtransparency = "true" id ="test" src="RUK_takeaway.asp?ID=' + restID + '" width = 580 height = 380 frameborder="0" marginwidth="0" marginheight="0"></iframe></div></font></td></tr></TBODY></TABLE>'

//		alert(document.getElementById(restElement).innerHTML);

		   	document.getElementById(restElement).style.height = "100%";

			if(doScroll == 1)
				{
				document.body.scrollTop	= scrolltopPos;
				}
			}
	lastBut = butID
	}


	function updateEmailToDiv(restID, restElement, restCt, butID)
	{
//		alert('Hello')
   		if(lastrestCt != 0 && lastrestCt < restCt)
			{	   		
	   		if(lastBut == 4 || lastBut == 11)
				{
				scrolltopPos = document.body.scrollTop - 334 - document.getElementById("directions").offsetHeight
				GUnload();
				}
	   		if(lastBut >= 1 && lastBut <= 3)
				{
				scrolltopPos = document.body.scrollTop - 404
				}
	   		if(lastBut >= 5 && lastBut <= 10)
				{
				scrolltopPos = document.body.scrollTop - 404
				}
//	   		if(lastBut == 1)
//				{
//				scrolltopPos = document.body.scrollTop - 404
//				}
//	   		if(lastBut == 2)
//				{
//				scrolltopPos = document.body.scrollTop - 404
//				}
//	   		if(lastBut == 3)
//				{
//				scrolltopPos = document.body.scrollTop - 404
//				}
//	   		if(lastBut == 12)
//				{
//				scrolltopPos = document.body.scrollTop - 404
//				}
			doScroll = 1
			}
		else
			{
			doScroll = 0
			}

		if(lastrestCt == restCt && butID == lastBut)
			{
//		alert('Close Info Menu')
			document.getElementById(restElement).innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
			lastrestCt = 0
			}
		else
			{
//		alert('Load Info: ' + restElement)
		    	lastrestCt = restCt
    	
   		 	if(document.getElementById("directions1")) document.getElementById("directions1").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		    	if(document.getElementById("directions2")) document.getElementById("directions2").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		   	if(document.getElementById("directions3")) document.getElementById("directions3").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
		   	if(document.getElementById("directions4")) document.getElementById("directions4").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
   		 	if(document.getElementById("directions5")) document.getElementById("directions5").innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=550 border=0><TBODY><tr><td></td></tr></TBODY></TABLE>'
			
//		alert(document.getElementById(restElement).innerHTML);

		   	document.getElementById(restElement).innerHTML = '<table class=directions cellspacing=0 cellpadding=0 width=570 border=0><TBODY><tr><td class=rs_ad><font face=verdana><div id=offersLB style="VISIBILITY:visible WIDTH: 550px; HEIGHT: 400px"><br><iframe allowtransparency = "true" id ="test" src="HTTPS://WWW.RESTAURANTUK.COM/RUK_emailto.asp?ID=' + restID + '" width = 580 height = 380 frameborder="0" marginwidth="0" marginheight="0"></iframe></div></font></td></tr></TBODY></TABLE>'

//		alert(document.getElementById(restElement).innerHTML);

		   	document.getElementById(restElement).style.height = "100%";

			if(doScroll == 1)
				{
				document.body.scrollTop	= scrolltopPos;
				}
			}
	lastBut = butID
	}

