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 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 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_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];}
}

// 
// Next section is used by index.htm and displays a randomly chosen image when page appears
//
// This script was supplied free by Hypergurl
// http://www.hypergurl.com
<!--
    // JavaScript to interpolate random images into a page.
    var ic = 12;     // Number of alternative images
    var xoxo = new Array(ic);  // Array to hold filenames
        
xoxo[0] = "images/map_barking.gif";
xoxo[1] = "images/map_wp1.gif";
xoxo[2] = "images/map_wp2.gif";
xoxo[3] = "images/map_leytonstone.gif";
xoxo[4] = "images/map_lm.gif";
xoxo[5] = "images/map_wqr.gif";
xoxo[6] = "images/map_br.gif";
xoxo[7] = "images/map_st.gif";
xoxo[8] = "images/map_hgl.gif";
xoxo[9] = "images/map_ch.gif";
xoxo[10] = "images/map_uh.gif";
xoxo[11] = "images/map_go.gif";

function pickRandom(range) {
if (Math.random)
return Math.round(Math.random() * (range-1));
else {
var now = new Date();
return (now.getTime() / 1000) % range;
}
}
// Write out an IMG tag, using a randomly-chosen image name.
var choice = pickRandom(ic);
// -->  
//
//

function openUp() {
  window.open("temp_page1.htm", "", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,directories=no,location=no")
}

function OpenWindow() { 
  // 'new' button
  var newwindow = window.open("slideshow.htm","1981","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=500,height=360");
  newwindow.focus();
  newwindow.moveTo(60,60);
  }


function openUp(inVar) {
   // used on links page
   if (inVar == 1) {
      window.open("http://www.mylinkspage.com/rail.html")
   }
   else if (inVar == 2) {
      window.open("http://www.silverlink-trains.com/")
   }
   else if (inVar == 3) {
      window.open("http://www.tfl.gov.uk/tfl/")
   }
   else if (inVar == 4) {
      window.open("http://www.railpassengers.org.uk/")
   }
   else if (inVar == 5) {
      window.open("http://www.londontravelwatch.org.uk/")
   }
   else if (inVar == 6) {
      window.open("http://www.standardmusicvenue.co.uk")
   }
   else if (inVar == 7) {
      window.open("http://www.railfuture.org.uk")
   }
   else if (inVar == 8) {
      window.open("http://eorailway.co.uk")
   }
   else if (inVar == 9) {
      window.open("http://leyton.info")
   }
   else if (inVar == 10) {
      window.open("http://www.walthamforest-fc.co.uk/")
   }
   else if (inVar == 11) {
      window.open("http://www.abfly.org.uk ")
   }
   else if (inVar == 12) {
      window.open("http://www.heart-of-wales.co.uk")
   }
   else if (inVar == 13) {
      window.open("http://www.tfl.gov.uk/tfl/livetravelnews/realtime/rail/rail-all-future.html")
   // window.open("http://www.tfl.gov.uk/gettingaround/6391.aspx")
   }
   else if (inVar == 14) {
      window.open("temp_page2.htm", "", "width=600,height=600,fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,directories=no,location=no")
   }
   else if (inVar == 15) {
      window.open("temp_page3.htm", "", "width=600,height=600,fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,directories=no,location=no")
   }
   else if (inVar == 16) {
      window.open("http://www.lorol.co.uk")
   }
   else if (inVar == 17) {
      window.open("http://www.tfl.gov.uk")
   }
   else if (inVar == 18) {
      window.open("http://no2id.com")
   }
   else if (inVar == 19) {
      window.open("xmas08-09.pdf")
   }
   else if (inVar == 20) {
      window.open("easter.pdf")
   }
   else if (inVar == 21) {
      window.open("http://www.technicopy.co.uk")
   }
}  

function textCounter(field, countfield, maxlimit ) {
  // count number of characters entered into a field
  var v1 = document.tagform.check_char_count.value;

  if ( field.value.length > (maxlimit - 20))
  {
    document.tagform.check_char_count.value = 1;
    if (v1 == 0) {
       field.value = field.value.substring( 0, maxlimit );
       alert( 'You have 20 characters remaining!!' );
       return true;
    }
  }

  if ( field.value.length > maxlimit )
  {
    field.value = field.value.substring( 0, maxlimit );
    alert( 'Comments can be max. ' + maxlimit + ' characters long.' );
    return false;
  }
  else
  {
    countfield.value = maxlimit - field.value.length;
  }

}

function show_alert() {
//  alert('23-April-2010\r\rWEEKEND ENGINEERING WORKS \r\rThe three month respite is over and these have now restarted, with replacement bus services operating. Please click on the link on this page to the relevant page of the TfL website for details.\r\r15 MINUTES FREQUENCY - STILL WAITING FOR THE JAM!    For latest news see our News page');


    alert('3-June-2010\r\rWEEKEND ENGINEERING WORKS \rBuses replace trains on Sundays and some Saturdays. Please click on the link on this page to reach the relevant page on the Transport for London website for details.\r\rNEW TIMETABLE FROM 1 JUNE\r\LOROL confirm new 15-min interval peak timetable will commence on 1st June and are hiring another Sprinter train from London Midland as they now do not have enough trains to run the new timetable. See News page or click timetable button for full details.\r\rNEW TRAINS LATEST\rSee our News page for latest photos of our new trains, expected to enter service by September.\r\rLATEST NEWSLETTER\rOur latest newsletter is now available on our Library page. ');




  return true;
}

// ========================================================================================================
// Following functions are for slideshow window
var rotate_delay = 2000; // delay in milliseconds (5000 = 5 secs)
current = 0;
function next() {
if (document.slideform.slide[current+1]) {
  document.images.show.src = document.slideform.slide[current+1].value;
  document.slideform.slide.selectedIndex = ++current;}
}

function previous() {
if (current-1 >= 0) {
  document.images.show.src = document.slideform.slide[current-1].value;
  document.slideform.slide.selectedIndex = --current; }
}

function ap(text) {
document.slideform.slidebutton.value = (text == "Stop") ? "Start" : "Stop";
rotate();}

function change() {
current = document.slideform.slide.selectedIndex;
document.images.show.src = document.slideform.slide[current].value;}

function rotate() {
if (document.slideform.slidebutton.value == "Stop") {
  current = (current == document.slideform.slide.length-1) ? 0 : current+1;
  document.images.show.src = document.slideform.slide[current].value;
  document.slideform.slide.selectedIndex = current;
  window.setTimeout("rotate()", rotate_delay);  }
}
// End of slideshow functions
// ========================================================================================================

// ========================================================================================================
// 
// Following functions are for displaying tooltips
// they are used in conjunction with tooltips.css
//
// ========================================================================================================
var xPos;
var yPos;

function showToolTip(title,msg,evt){
    if (evt) {
        var url = evt.target;
    }
    else {
        evt = window.event;
        var url = evt.srcElement;
    }
    xPos = evt.clientX;
    yPos = evt.clientY;

   var toolTip = document.getElementById("toolTip");
   toolTip.innerHTML = "<h1>"+title+"</h1><p>"+msg+"</p>";
   toolTip.style.top = parseInt(yPos)+2 + "px";
   toolTip.style.left = parseInt(xPos)+2 + "px";
   toolTip.style.visibility = "visible";
   
}

function hideToolTip(){
   var toolTip = document.getElementById("toolTip");
   toolTip.style.visibility = "hidden";
}


