//user_updates.js

var sections =new Object();

sections['Fitz Park'] = 'fitz_park';
sections['Latrigg'] = 'latrigg';
sections['Skiddaw'] = 'skiddaw';
sections['Great Calva'] = 'great_calva';
sections['Mungrisedale'] = 'mungrisedale';
sections['Blencathra'] = 'blencathra';
sections['Halls Fell'] = 'halls_fell';
sections['Threlkeld'] = 'threlkeld';
sections['Clough Head'] = 'clough_head';
sections['Great Dodd'] = 'great_dodd';
sections['Stybarrow Dodd'] = 'stybarrow_dodd';
sections['White Side'] = 'white_side';
sections['Helvellyn'] = 'helvellyn';
sections['Dollywaggon Pike'] = 'dollywaggon_pike';
sections['Fairfield'] = 'fairfield';
sections['Seat Sandal'] = 'seat_sandal';
sections['Dunmail Raise'] = 'dunmail_raise';
sections['Steel Fell'] = 'steel_fell';
sections['Calf Crag'] = 'calf_crag';
sections['Sergeant Crag'] = 'sergeant_crag';
sections['High Raise'] = 'high_raise';
sections['Thunacar Knott'] = 'thunacar_knott';
sections['Harrison Stickle'] = 'harrison_stickle';
sections['Martcrag Moor'] = 'martcrag_moor';
sections['Rossett Gill'] = 'rossett_gill';
sections['Bowfell'] = 'bowfell';
sections['Ore Gap'] = 'ore_gap';
sections['Great End'] = 'great_end';
sections['Scafell Pike'] = 'scafell_pike';
sections['Broad Stand'] = 'broad_stand';
sections['Scafell'] = 'scafell';
sections['Rakehead Crag'] = 'rakehead_crag';
sections['Wasdale NT'] = 'wasdale_nt';
sections['Yewbarrow'] = 'yewbarrow';
sections['Dore Head'] = 'dore_head';
sections['Red Pike'] = 'red_pike';
sections['Pillar'] = 'pillar';
sections['Great Gable'] = 'great_gable';
sections['Brandreth'] = 'brandreth';
sections['Honister'] = 'honister';
sections['Dale Head'] = 'dale_head';
sections['Robinson'] = 'robinson';
sections['Scope Beck'] = 'scope_beck';
sections['Stair'] = 'stair';
sections['Portinscale'] = 'portinscale';
sections['Keswick'] = 'keswick';

/****************************************************
*
* If the database has written an array of updates
* to the file then we need to attach those notes
* to the appropriate ID in the document.
*
****************************************************/
addEvent(window, 'load', function(){
if ( typeof(updates) == "undefined" ) return;
var len = updates.length;
  if(len > 0)
  {   
    var d = document;
    for(var i = 0; i < len; i++)
    {
      var pid = updates[i].section;
      var hid = sections[pid];
      
      var elem = d.getElementById(hid);
      if(elem)
      {
        var p = elem.parentNode;
        var notes = d.createElement('div');
        notes.className='userUpdate';
        var n = d.createElement('p');
        var t = d.createTextNode(updates[i].desc);
        n.appendChild(t);
        var lnk = d.createElement('a');
        lnk.appendChild(d.createTextNode("Update"));
        lnk.setAttribute('href', 'bgr_updates.php');
        lnk.setAttribute('title', 'Follow this link if you have further info on this note.');
        n.appendChild(lnk);
        var n2 = d.createElement('p');
        n2.className='updateName';
        var t2 = d.createTextNode(updates[i].name);
        n2.appendChild(t2);
        notes.appendChild(n);
        notes.appendChild(n2);
        p.insertBefore(notes, elem);
      }
    }
  }
}, false);



