/*
* **************************************************************************
lp.js
Interactive Local Plan
West Lindsey District Council
Ver 1.0
Lovell Johns Ltd.
09/06
****************************************************************************
*/

//*********************GLOBALS
// Insert output from 'js_navrray.txt' below		
//Set up the array for required info about each inset maps.
//Map name,origin X of overview inset frame,origin Y of overview inset frame,width of overview inset frame,blx of map grid,bly of map grid,trx of map grid,try of map grid,Grid Size,Grid Overlap,no. of rows,no. of cols
var theinsetsmaps = new Array (96)
var nofInsets = 96;
theinsetsmaps[0] = new Array("inset_79",513122,366188,969.516,513200,366100,514100,367200,300,100,5,4);
theinsetsmaps[1] = new Array("inset_01",510900,368300,2256.12,510800,368400,513300,370500,300,100,10,12);
theinsetsmaps[2] = new Array("inset_47",499500,370431,2400.04,499400,370800,502000,372500,200,50,11,17);
theinsetsmaps[3] = new Array("inset_21",504458,371216,1398,504400,371400,505900,372500,300,100,5,7);
theinsetsmaps[4] = new Array("inset_31",501456,372514,969.355,501400,372600,502500,373500,300,100,4,5);
theinsetsmaps[5] = new Array("inset_13",502093,371700,2000.03,502300,371700,503900,373900,400,100,7,5);
theinsetsmaps[6] = new Array("inset_46",499000,371931,2400.07,498900,372300,501700,374200,400,100,6,9);
theinsetsmaps[7] = new Array("inset_60",500938,373211,1108.02,500900,373300,502200,374200,300,100,4,6);
theinsetsmaps[8] = new Array("inset_66",503300,373084,1400.14,503200,373200,504700,374300,300,100,5,7);
theinsetsmaps[9] = new Array("inset_45",497400,372631,2400.04,497300,373000,500100,374900,400,100,6,9);
theinsetsmaps[10] = new Array("inset_57",482683,373800,969.515,482800,373700,483500,374800,300,100,5,3);
theinsetsmaps[11] = new Array("inset_70",490423,374285,968,490400,374400,491500,375100,300,100,3,5);
theinsetsmaps[12] = new Array("inset_08",491400,371535,4230,491400,372100,495800,375300,500,200,10,14);
theinsetsmaps[13] = new Array("inset_07",495261,373600,1522,495500,373600,496800,375200,400,100,5,4);
theinsetsmaps[14] = new Array("inset_67",497957,375261,692.511,497900,375300,498700,375950,200,50,4,5);
theinsetsmaps[15] = new Array("inset_37",484449,375400,692.511,484500,375400,485150,376200,200,50,5,4);
theinsetsmaps[16] = new Array("inset_41",483178,375257,969.515,483300,375200,484000,376300,300,100,5,3);
theinsetsmaps[17] = new Array("inset_55",499700,374352,2256.12,499600,374700,502100,376400,300,100,8,12);
theinsetsmaps[18] = new Array("inset_69",488300,374592,2256,488300,374900,490600,376600,300,100,8,11);
theinsetsmaps[19] = new Array("inset_84",502800,374691,2256.12,502700,375000,505200,376700,300,100,8,12);
theinsetsmaps[20] = new Array("inset_40",505500,375554,1600.03,505500,375700,507200,377000,300,100,6,8);
theinsetsmaps[21] = new Array("inset_77",494748,375945,969.515,494800,375900,495700,377000,300,100,5,4);
theinsetsmaps[22] = new Array("inset_19",484218,376129,969.516,484200,376200,485300,377100,300,100,4,5);
theinsetsmaps[23] = new Array("inset_72",502800,376611,1400,502800,376800,504300,377900,300,100,5,7);
theinsetsmaps[24] = new Array("inset_59",494000,377083,969.516,494000,377200,495100,378100,300,100,4,5);
theinsetsmaps[25] = new Array("inset_48",496200,377032,1385.02,496100,377200,497700,378200,400,100,3,5);
theinsetsmaps[26] = new Array("inset_88",483548,378252,1397,483500,378400,485000,379500,300,100,5,7);
theinsetsmaps[27] = new Array("inset_71",494372,378828,1108.02,494300,379000,495600,379900,300,100,4,6);
theinsetsmaps[28] = new Array("inset_16",501456,378255,1800.03,501400,378500,503300,379800,300,100,6,9);
theinsetsmaps[29] = new Array("inset_93",500300,378782,2256.12,500200,379100,502700,380800,300,100,8,12);
theinsetsmaps[30] = new Array("inset_05",494448,380300,969.516,494500,380200,495400,381300,300,100,5,4);
theinsetsmaps[31] = new Array("inset_83",487806,379328,2400.12,488100,379300,490000,381800,400,100,8,6);
theinsetsmaps[32] = new Array("inset_52",483638,381366,1108.02,483600,381500,484900,382400,300,100,4,6);
theinsetsmaps[33] = new Array("inset_12",494369,381664,831.013,494400,381600,495200,382550,200,50,6,5);
theinsetsmaps[34] = new Array("inset_82",487783,381533,969.515,487900,381500,488600,382600,300,100,5,3);
theinsetsmaps[35] = new Array("inset_30",498800,381728,1380,498800,381900,500400,382900,400,100,3,5);
theinsetsmaps[36] = new Array("inset_49",510448,382930,969.516,510500,382900,511400,384000,300,100,5,4);
theinsetsmaps[37] = new Array("inset_35",493854,382500,1600.03,494000,382400,495300,384300,300,100,9,6);
theinsetsmaps[38] = new Array("inset_94",487017,383891,969.516,487000,384000,488100,384900,300,100,4,5);
theinsetsmaps[39] = new Array("inset_18",506048,384101,1108.02,506000,384200,507300,385100,300,100,4,6);
theinsetsmaps[40] = new Array("inset_80",500283,384132,1108.02,500400,384100,501300,385400,300,100,6,4);
theinsetsmaps[41] = new Array("inset_44",513338,385340,692.511,513400,385300,514050,386100,200,50,5,4);
theinsetsmaps[42] = new Array("inset_39",483701,385290,969.516,483700,385400,484800,386300,300,100,4,5);
theinsetsmaps[43] = new Array("inset_20",494342,385427,831.014,494300,385500,495250,386150,200,50,4,6);
theinsetsmaps[44] = new Array("inset_38",486900,385384,970,486900,385500,488000,386200,300,100,3,5);
theinsetsmaps[45] = new Array("inset_43",482209,385944,1600.77,482200,386100,483900,387400,300,100,6,8);
theinsetsmaps[46] = new Array("inset_89",486139,386154,1400.02,486100,386300,487600,387400,300,100,5,7);
theinsetsmaps[47] = new Array("inset_64",499630,386983,969.516,499600,387100,500700,387800,300,100,3,5);
theinsetsmaps[48] = new Array("inset_58",499603,387565,970,499700,387500,500600,388600,300,100,5,4);
theinsetsmaps[49] = new Array("inset_26",494003,387606,1108.02,494100,387600,495000,388900,300,100,6,4);
theinsetsmaps[50] = new Array("inset_23",480300,386707,3649.56,480200,387200,484100,389900,300,100,13,19);
theinsetsmaps[51] = new Array("inset_51",510252,388564,1074,510200,388700,511450,389500,200,50,5,8);
theinsetsmaps[52] = new Array("inset_53",508193,388485,1400,508100,388700,509600,389800,300,100,5,7);
theinsetsmaps[53] = new Array("inset_24",481040,389278,1012,481100,389200,481900,390300,200,50,7,5);
theinsetsmaps[54] = new Array("inset_81",487255,389356,692.511,487200,389400,488000,390050,200,50,4,5);
theinsetsmaps[55] = new Array("inset_87",514663,389654,692.484,514700,389600,515350,390400,200,50,5,4);
theinsetsmaps[56] = new Array("inset_33",494018,389155,2000.03,494300,389100,495900,391300,400,100,7,5);
theinsetsmaps[57] = new Array("inset_25",499489,389883,1385.02,499700,389800,500700,391400,400,100,5,3);
theinsetsmaps[58] = new Array("inset_32",492540,390427,969.516,492600,390400,493500,391500,300,100,5,4);
theinsetsmaps[59] = new Array("inset_86",514420,389707,2000.03,514400,390000,516600,391600,400,100,5,7);
theinsetsmaps[60] = new Array("inset_22",480300,388544,3649,480300,389100,484000,391800,300,100,13,18);
theinsetsmaps[61] = new Array("inset_15",486507,390811,1108.02,486600,390800,487500,392100,300,100,6,4);
theinsetsmaps[62] = new Array("inset_54",480100,391146,1600.03,480000,391300,481700,392600,300,100,6,8);
theinsetsmaps[63] = new Array("inset_91",512853,391862,969.516,512800,392000,513900,392700,300,100,3,5);
theinsetsmaps[64] = new Array("inset_03",498039,392200,831.013,498100,392200,498750,393150,200,50,6,4);
theinsetsmaps[65] = new Array("inset_92",478400,392586,692.511,478500,392500,479000,393300,200,50,5,3);
theinsetsmaps[66] = new Array("inset_63",506700,391983,1385,506700,392200,508300,393200,400,100,3,5);
theinsetsmaps[67] = new Array("inset_95",492606,392668,1108,492700,392600,493600,393900,300,100,6,4);
theinsetsmaps[68] = new Array("inset_17",478480,393917,969.516,478400,394000,479500,394900,300,100,4,5);
theinsetsmaps[69] = new Array("inset_76",498107,394409,692.511,498100,394500,498900,395000,200,50,3,5);
theinsetsmaps[70] = new Array("inset_14",510908,394225,969.516,510900,394300,512000,395200,300,100,4,5);
theinsetsmaps[71] = new Array("inset_04",484600,393998,1692.09,484600,394200,486300,395450,200,50,8,11);
theinsetsmaps[72] = new Array("inset_06",519400,394496,1974.11,519300,394800,521400,396300,300,100,7,10);
theinsetsmaps[73] = new Array("inset_28",492978,395720,969.516,493100,395700,493800,396800,300,100,5,3);
theinsetsmaps[74] = new Array("inset_90",497856,395600,1108,498000,395600,498900,396900,300,100,6,4);
theinsetsmaps[75] = new Array("inset_62",489192,396719,692.511,489300,396700,489800,397500,200,50,5,3);
theinsetsmaps[76] = new Array("inset_42",484200,396948,969.516,484200,397100,485300,397800,300,100,3,5);
theinsetsmaps[77] = new Array("inset_34",507683,397422,969.515,507800,397400,508500,398500,300,100,5,3);
theinsetsmaps[78] = new Array("inset_78",503329,397200,2007,503600,397200,505200,399400,400,100,7,5);
theinsetsmaps[79] = new Array("inset_74",488300,398566,1108.02,488200,398700,489500,399600,300,100,4,6);
theinsetsmaps[80] = new Array("inset_68",514614,399022,969.516,514700,399000,515600,400100,300,100,5,4);
theinsetsmaps[81] = new Array("inset_56",509900,398992,2000.03,509800,399300,512000,400900,400,100,5,7);
theinsetsmaps[82] = new Array("inset_11",511467,400919,846.046,511400,401000,512350,401650,200,50,4,6);
theinsetsmaps[83] = new Array("inset_61",503699,400600,2000.03,503600,400900,505800,402500,400,100,5,7);
theinsetsmaps[84] = new Array("inset_73",486894,399600,2820.15,487300,399600,489500,402700,400,100,10,7);
theinsetsmaps[85] = new Array("inset_85",517300,402583,969.516,517300,402700,518400,403400,300,100,3,5);
theinsetsmaps[86] = new Array("inset_27",508081,404141,1385.02,508000,404300,509600,405600,400,100,4,5);
theinsetsmaps[87] = new Array("inset_75",506842,405422,692.511,506900,405400,507550,406200,200,50,5,4);
theinsetsmaps[88] = new Array("inset_65",501408,406500,692.511,501500,406400,502000,407200,200,50,5,3);
theinsetsmaps[89] = new Array("inset_02",505500,406917,831.013,505600,406900,506250,407850,200,50,6,4);
theinsetsmaps[90] = new Array("inset_29",512678,407838,1385.02,512600,408000,514200,409300,400,100,4,5);
theinsetsmaps[91] = new Array("inset_36",515400,408992,2000.03,515300,409300,517500,410900,400,100,5,7);
theinsetsmaps[92] = new Array("inset_09",493291,389540,690,493400,389500,493900,390300,200,50,5,3);
theinsetsmaps[93] = new Array("inset_50",509600,387588,3440,509600,388100,513100,390600,300,100,12,17);
theinsetsmaps[94] = new Array("inset_10",510058,400052,2256.12,510000,400300,512500,402000,300,100,8,12);
theinsetsmaps[95] = new Array("proposals",475615,364300,51365,477000,364000,526000,417000,3000,1000,26,24);
// ^^^^Insert output from 'js_navarray.txt' above ^^^^^^^^^

//*********************BROWSER CHECKING
// Ultimate client-side JavaScript client sniff. Version 3.03
// (C) Netscape Communications 1999-2001.  Permission granted to reuse and distribute.
// Revised 17 May 99 to add is_nav5up and is_ie5up (see below).
// Revised 20 Dec 00 to add is_gecko and change is_nav5up to is_nav6up
//                      also added support for IE5.5 Opera4&5 HotJava3 AOLTV
// Revised 22 Feb 01 to correct Javascript Detection for IE 5.x, Opera 4, 
//                      correct Opera 5 detection
//                      add support for winME and win2k
//                      synch with browser-type-oo.js
// Revised 26 Mar 01 to correct Opera detection
// Revised 02 Oct 01 to add IE6 detection

// Everything you always wanted to know about your JavaScript client
// but were afraid to ask. Creates "is_" variables indicating:
// (1) browser vendor:
//     is_nav, is_ie, is_opera, is_hotjava, is_webtv, is_TVNavigator, is_AOLTV
// (2) browser version number:
//     is_major (integer indicating major version number: 2, 3, 4 ...)
//     is_minor (float   indicating full  version number: 2.02, 3.01, 4.04 ...)
// (3) browser vendor AND major version number
//     is_nav2, is_nav3, is_nav4, is_nav4up, is_nav6, is_nav6up, is_gecko, is_ie3,
//     is_ie4, is_ie4up, is_ie5, is_ie5up, is_ie5_5, is_ie5_5up, is_ie6, is_ie6up, is_hotjava3, is_hotjava3up,
//     is_opera2, is_opera3, is_opera4, is_opera5, is_opera5up
// (4) JavaScript version number:
//     is_js (float indicating full JavaScript version number: 1, 1.1, 1.2 ...)
// (5) OS platform and version:
//     is_win, is_win16, is_win32, is_win31, is_win95, is_winnt, is_win98, is_winme, is_win2k
//     is_os2
//     is_mac, is_mac68k, is_macppc
//     is_unix
//     is_sun, is_sun4, is_sun5, is_suni86
//     is_irix, is_irix5, is_irix6
//     is_hpux, is_hpux9, is_hpux10
//     is_aix, is_aix1, is_aix2, is_aix3, is_aix4
//     is_linux, is_sco, is_unixware, is_mpras, is_reliant
//     is_dec, is_sinix, is_freebsd, is_bsd
//     is_vms
//
// See http://www.it97.de/JavaScript/JS_tutorial/bstat/navobj.html and
// http://www.it97.de/JavaScript/JS_tutorial/bstat/Browseraol.html
// for detailed lists of userAgent strings.
//
// Note: you don't want your Nav4 or IE4 code to "turn off" or
// stop working when new versions of browsers are released, so
// in conditional code forks, use is_ie5up ("IE 5.0 or greater") 
// is_opera5up ("Opera 5.0 or greater") instead of is_ie5 or is_opera5
// to check version in code which you want to work on future
// versions.

    // convert all characters to lowercase to simplify testing
    var agt=navigator.userAgent.toLowerCase();

    // *** BROWSER VERSION ***
    // Note: On IE5, these return 4, so use is_ie5up to detect IE5.
    var is_major = parseInt(navigator.appVersion);
    var is_minor = parseFloat(navigator.appVersion);

    // Note: Opera and WebTV spoof Navigator.  We do strict client detection.
    // If you want to allow spoofing, take out the tests for opera and webtv.
    var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
                && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
    var is_nav2 = (is_nav && (is_major == 2));
    var is_nav3 = (is_nav && (is_major == 3));
    var is_nav4 = (is_nav && (is_major == 4));
    var is_nav4up = (is_nav && (is_major >= 4));
    var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) ||
                          (agt.indexOf("; nav") != -1)) );
    var is_nav6 = (is_nav && (is_major == 5));
    var is_nav6up = (is_nav && (is_major >= 5));
    var is_gecko = (agt.indexOf('gecko') != -1);


    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);

    // KNOWN BUG: On AOL4, returns false if IE3 is embedded browser
    // or if this is the first browser window opened.  Thus the
    // variables is_aol, is_aol3, and is_aol4 aren't 100% reliable.
    var is_aol   = (agt.indexOf("aol") != -1);
    var is_aol3  = (is_aol && is_ie3);
    var is_aol4  = (is_aol && is_ie4);
    var is_aol5  = (agt.indexOf("aol 5") != -1);
    var is_aol6  = (agt.indexOf("aol 6") != -1);

    var is_opera = (agt.indexOf("opera") != -1);
    var is_opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1);
    var is_opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1);
    var is_opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1);
    var is_opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);
    var is_opera5up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4);

    var is_webtv = (agt.indexOf("webtv") != -1); 

    var is_TVNavigator = ((agt.indexOf("navio") != -1) || (agt.indexOf("navio_aoltv") != -1)); 
    var is_AOLTV = is_TVNavigator;

    var is_hotjava = (agt.indexOf("hotjava") != -1);
    var is_hotjava3 = (is_hotjava && (is_major == 3));
    var is_hotjava3up = (is_hotjava && (is_major >= 3));

    // *** JAVASCRIPT VERSION CHECK ***
    var is_js;
    if (is_nav2 || is_ie3) is_js = 1.0;
    else if (is_nav3) is_js = 1.1;
    else if (is_opera5up) is_js = 1.3;
    else if (is_opera) is_js = 1.1;
    else if ((is_nav4 && (is_minor <= 4.05)) || is_ie4) is_js = 1.2;
    else if ((is_nav4 && (is_minor > 4.05)) || is_ie5) is_js = 1.3;
    else if (is_hotjava3up) is_js = 1.4;
    else if (is_nav6 || is_gecko) is_js = 1.5;
    // NOTE: In the future, update this code when newer versions of JS
    // are released. For now, we try to provide some upward compatibility
    // so that future versions of Nav and IE will show they are at
    // *least* JS 1.x capable. Always check for JS version compatibility
    // with > or >=.
    else if (is_nav6up) is_js = 1.5;
    // NOTE: ie5up on mac is 1.4
    else if (is_ie5up) is_js = 1.3

    // HACK: no idea for other browsers; always check for JS version with > or >=
    else is_js = 0.0;

    // *** PLATFORM ***
    var is_win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
    // NOTE: On Opera 3.0, the userAgent string includes "Windows 95/NT4" on all
    //        Win32, so you can't distinguish between Win95 and WinNT.
    var is_win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1));

    // is this a 16 bit compiled version?
    var is_win16 = ((agt.indexOf("win16")!=-1) || 
               (agt.indexOf("16bit")!=-1) || (agt.indexOf("windows 3.1")!=-1) || 
               (agt.indexOf("windows 16-bit")!=-1) );  

    var is_win31 = ((agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("win16")!=-1) ||
                    (agt.indexOf("windows 16-bit")!=-1));

    var is_winme = ((agt.indexOf("win 9x 4.90")!=-1));
    var is_win2k = ((agt.indexOf("windows nt 5.0")!=-1));

    // NOTE: Reliable detection of Win98 may not be possible. It appears that:
    //       - On Nav 4.x and before you'll get plain "Windows" in userAgent.
    //       - On Mercury client, the 32-bit version will return "Win98", but
    //         the 16-bit version running on Win98 will still return "Win95".
    var is_win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1));
    var is_winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1));
    var is_win32 = (is_win95 || is_winnt || is_win98 || 
                    ((is_major >= 4) && (navigator.platform == "Win32")) ||
                    (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1));

    var is_os2   = ((agt.indexOf("os/2")!=-1) || 
                    (navigator.appVersion.indexOf("OS/2")!=-1) ||   
                    (agt.indexOf("ibm-webexplorer")!=-1));

    var is_mac    = (agt.indexOf("mac")!=-1);
    // hack ie5 js version for mac
    if (is_mac && is_ie5up) is_js = 1.4;
    var is_mac68k = (is_mac && ((agt.indexOf("68k")!=-1) || 
                               (agt.indexOf("68000")!=-1)));
    var is_macppc = (is_mac && ((agt.indexOf("ppc")!=-1) || 
                                (agt.indexOf("powerpc")!=-1)));

    var is_sun   = (agt.indexOf("sunos")!=-1);
    var is_sun4  = (agt.indexOf("sunos 4")!=-1);
    var is_sun5  = (agt.indexOf("sunos 5")!=-1);
    var is_suni86= (is_sun && (agt.indexOf("i86")!=-1));
    var is_irix  = (agt.indexOf("irix") !=-1);    // SGI
    var is_irix5 = (agt.indexOf("irix 5") !=-1);
    var is_irix6 = ((agt.indexOf("irix 6") !=-1) || (agt.indexOf("irix6") !=-1));
    var is_hpux  = (agt.indexOf("hp-ux")!=-1);
    var is_hpux9 = (is_hpux && (agt.indexOf("09.")!=-1));
    var is_hpux10= (is_hpux && (agt.indexOf("10.")!=-1));
    var is_aix   = (agt.indexOf("aix") !=-1);      // IBM
    var is_aix1  = (agt.indexOf("aix 1") !=-1);    
    var is_aix2  = (agt.indexOf("aix 2") !=-1);    
    var is_aix3  = (agt.indexOf("aix 3") !=-1);    
    var is_aix4  = (agt.indexOf("aix 4") !=-1);    
    var is_linux = (agt.indexOf("inux")!=-1);
    var is_sco   = (agt.indexOf("sco")!=-1) || (agt.indexOf("unix_sv")!=-1);
    var is_unixware = (agt.indexOf("unix_system_v")!=-1); 
    var is_mpras    = (agt.indexOf("ncr")!=-1); 
    var is_reliant  = (agt.indexOf("reliantunix")!=-1);
    var is_dec   = ((agt.indexOf("dec")!=-1) || (agt.indexOf("osf1")!=-1) || 
           (agt.indexOf("dec_alpha")!=-1) || (agt.indexOf("alphaserver")!=-1) || 
           (agt.indexOf("ultrix")!=-1) || (agt.indexOf("alphastation")!=-1)); 
    var is_sinix = (agt.indexOf("sinix")!=-1);
    var is_freebsd = (agt.indexOf("freebsd")!=-1);
    var is_bsd = (agt.indexOf("bsd")!=-1);
    var is_unix  = ((agt.indexOf("x11")!=-1) || is_sun || is_irix || is_hpux || 
                 is_sco ||is_unixware || is_mpras || is_reliant || 
                 is_dec || is_sinix || is_aix || is_linux || is_bsd || is_freebsd);

    var is_vms   = ((agt.indexOf("vax")!=-1) || (agt.indexOf("openvms")!=-1));

//***********END OF BROWSER CHECK

//*********Image click (Overview map page > main mappping) This functionality only works for IE and Opera
function gotoMainMap(e){

	//Get the current overview image.
	var cmdString = String(document.location.search);
	var theName = cmdString.substring(1,cmdString.length);		
		
	//Define the current overview.	
	for(i=0;i<nofInsets;i++){														
		if(theName.toUpperCase() == theinsetsmaps[i][0].toUpperCase()){
			var useIndex = i;
		}
	}
	
	var imageWidth = 400; 																		//Width of opening overview image in pixels
	var pixpermetre =  theinsetsmaps[useIndex][3] / imageWidth;
	var origTLY = theinsetsmaps[useIndex][2] + theinsetsmaps[useIndex][3];						//Make origin top left

	//Get user clicked location x,y (pixels).
	var theX = event.offsetX;			
	var theY =  event.offsetY;

	//Convert to real world metres.
	theX = Number(theX) * pixpermetre;	
	theY = Number(theY) * pixpermetre; 
	theX =  theinsetsmaps[useIndex][1] + theX;
	theY =  origTLY - theY;

	//Define if user has clicked in the map area
	var outSideX = "false";
	var outSideY = "false";
	
	if((theX >= theinsetsmaps[useIndex][6]) | (theX <= theinsetsmaps[useIndex][4])){
		outSideX = "true";		
	}
	if((theY >= theinsetsmaps[useIndex][7]) | (theY <= theinsetsmaps[useIndex][5])){
		outSideY = "true";
	}

	//Define the new map image to load in.
	if((outSideX == "true") | (outSideY == "true")){			
		//alert("outside the area")
	}
	else{
		var distx = theX - theinsetsmaps[useIndex][4];
		var disty = theY - theinsetsmaps[useIndex][5];
		
		var gridcnt = theinsetsmaps[useIndex][8];
  		var thecol = 1; 
		while (gridcnt < distx){
			thecol = thecol + 1;
			gridcnt = gridcnt + (theinsetsmaps[useIndex][8] - theinsetsmaps[useIndex][9]);
		}	
 
		var gridcnt = theinsetsmaps[useIndex][8];
  		var therow = 1;  
		while (gridcnt < disty){
			therow = therow + 1;
			gridcnt = gridcnt + (theinsetsmaps[useIndex][8] - theinsetsmaps[useIndex][9]);
		}			
		
		var theTileNo =  ((therow -1) * theinsetsmaps[useIndex][11]) + thecol;

		//Adjust the tile number to agree with the standard "###"
		if(theTileNo < 10){
			theTileNo = "00" + theTileNo;
		}
		else if(theTileNo < 100){
			theTileNo = "0" + theTileNo;
		}
		else{
			theTileNo = String(theTileNo);
		}

		var theNewHTML = "map_htm/" + theName + "/" + theName + "_" + theTileNo + ".htm";

		//Open the selected tile in same window
 		eval("parent.location='" + theNewHTML + "'");

	}
	
}


//*********Open the main mapping -centre image called from overview map page. This functionality only works for IE and Opera
function openMapAtCentre(theMap,source){

	var newMap;
	if(theMap.toLowerCase() == "southrey"){
	  newMap = "map_htm/inset_79/inset_79_010.htm";
	}
	else if(theMap.toLowerCase() == "bardney"){
	  newMap = "map_htm/inset_01/inset_01_066.htm";
	}
	else if(theMap.toLowerCase() == "lincoln fringe east"){
	  newMap = "map_htm/inset_47/inset_47_094.htm";
	}
	else if(theMap.toLowerCase() == "fiskerton"){
	  newMap = "map_htm/inset_21/inset_21_024.htm";
	}
	else if(theMap.toLowerCase() == "hawthorn avenue"){
	  newMap = "map_htm/inset_31/inset_31_008.htm";
	}
	else if(theMap.toLowerCase() == "cherry willingham"){
	  newMap = "map_htm/inset_13/inset_13_018.htm";
	}
	else if(theMap.toLowerCase() == "lincoln fringe central"){
	  newMap = "map_htm/inset_46/inset_46_024.htm";
	}
	else if(theMap.toLowerCase() == "north greetwell"){
	  newMap = "map_htm/inset_60/inset_60_009.htm";
	}
	else if(theMap.toLowerCase() == "reepham"){
	  newMap = "map_htm/inset_66/inset_66_018.htm";
	}
	else if(theMap.toLowerCase() == "lincoln fringe west"){
	  newMap = "map_htm/inset_45/inset_45_032.htm";
	}
	else if(theMap.toLowerCase() == "newton on trent"){
	  newMap = "map_htm/inset_57/inset_57_008.htm";
	}
	else if(theMap.toLowerCase() == "saxilby enterprise park"){
	  newMap = "map_htm/inset_70/inset_70_008.htm";
	}
	else if(theMap.toLowerCase() == "burton waters"){
	  newMap = "map_htm/inset_08/inset_08_063.htm";
	}
	else if(theMap.toLowerCase() == "burton"){
	  newMap = "map_htm/inset_07/inset_07_010.htm";
	}
	else if(theMap.toLowerCase() == "riseholme campus"){
	  newMap = "map_htm/inset_67/inset_67_013.htm";
	}
	else if(theMap.toLowerCase() == "kettlethorpe"){
	  newMap = "map_htm/inset_37/inset_37_010.htm";
	}
	else if(theMap.toLowerCase() == "laughterton"){
	  newMap = "map_htm/inset_41/inset_41_008.htm";
	}
	else if(theMap.toLowerCase() == "nettleham"){
	  newMap = "map_htm/inset_55/inset_55_031.htm";
	}
	else if(theMap.toLowerCase() == "saxilby"){
	  newMap = "map_htm/inset_69/inset_69_044.htm";
	}
	else if(theMap.toLowerCase() == "sudbrooke"){
	  newMap = "map_htm/inset_84/inset_84_054.htm";
	}
	else if(theMap.toLowerCase() == "langworth"){
	  newMap = "map_htm/inset_40/inset_40_028.htm";
	}
	else if(theMap.toLowerCase() == "south carlton"){
	  newMap = "map_htm/inset_77/inset_77_010.htm";
	}
	else if(theMap.toLowerCase() == "fenton"){
	  newMap = "map_htm/inset_19/inset_19_012.htm";
	}
	else if(theMap.toLowerCase() == "scothern"){
	  newMap = "map_htm/inset_72/inset_72_018.htm";
	}
	else if(theMap.toLowerCase() == "north carlton"){
	  newMap = "map_htm/inset_59/inset_59_013.htm";
	}
	else if(theMap.toLowerCase() == "lincolnshire show ground"){
	  newMap = "map_htm/inset_48/inset_48_008.htm";
	}
	else if(theMap.toLowerCase() == "torksey"){
	  newMap = "map_htm/inset_88/inset_88_018.htm";
	}
	else if(theMap.toLowerCase() == "scampton"){
	  newMap = "map_htm/inset_71/inset_71_009.htm";
	}
	else if(theMap.toLowerCase() == "dunholme"){
	  newMap = "map_htm/inset_16/inset_16_023.htm";
	}
	else if(theMap.toLowerCase() == "welton"){
	  newMap = "map_htm/inset_93/inset_93_029.htm";
	}
	else if(theMap.toLowerCase() == "brattleby"){
	  newMap = "map_htm/inset_05/inset_05_010.htm";
	}
	else if(theMap.toLowerCase() == "sturton by stow"){
	  newMap = "map_htm/inset_83/inset_83_022.htm";
	}
	else if(theMap.toLowerCase() == "marton"){
	  newMap = "map_htm/inset_52/inset_52_009.htm";
	}
	else if(theMap.toLowerCase() == "cammeringham"){
	  newMap = "map_htm/inset_12/inset_12_018.htm";
	}
	else if(theMap.toLowerCase() == "stow"){
	  newMap = "map_htm/inset_82/inset_82_008.htm";
	}
	else if(theMap.toLowerCase() == "hackthorn"){
	  newMap = "map_htm/inset_30/inset_30_008.htm";
	}
	else if(theMap.toLowerCase() == "lissington"){
	  newMap = "map_htm/inset_49/inset_49_010.htm";
	}
	else if(theMap.toLowerCase() == "ingham"){
	  newMap = "map_htm/inset_35/inset_35_034.htm";
	}
	else if(theMap.toLowerCase() == "willingham by stow"){
	  newMap = "map_htm/inset_94/inset_94_008.htm";
	}
	else if(theMap.toLowerCase() == "faldingworth"){
	  newMap = "map_htm/inset_18/inset_18_015.htm";
	}
	else if(theMap.toLowerCase() == "spridlington"){
	  newMap = "map_htm/inset_80/inset_80_011.htm";
	}
	else if(theMap.toLowerCase() == "legsby"){
	  newMap = "map_htm/inset_44/inset_44_010.htm";
	}
	else if(theMap.toLowerCase() == "knaith park"){
	  newMap = "map_htm/inset_39/inset_39_008.htm";
	}
	else if(theMap.toLowerCase() == "fillingham"){
	  newMap = "map_htm/inset_20/inset_20_009.htm";
	}
	else if(theMap.toLowerCase() == "kexby"){
	  newMap = "map_htm/inset_38/inset_38_008.htm";
	}
	else if(theMap.toLowerCase() == "lea"){
	  newMap = "map_htm/inset_43/inset_43_012.htm";
	}
	else if(theMap.toLowerCase() == "upton"){
	  newMap = "map_htm/inset_89/inset_89_018.htm";
	}
	else if(theMap.toLowerCase() == "owmby by spital"){
	  newMap = "map_htm/inset_64/inset_64_008.htm";
	}
	else if(theMap.toLowerCase() == "normanby by spital"){
	  newMap = "map_htm/inset_58/inset_58_010.htm";
	}
	else if(theMap.toLowerCase() == "glentworth"){
	  newMap = "map_htm/inset_26/inset_26_010.htm";
	}
	else if(theMap.toLowerCase() == "gainsborough south"){
	  newMap = "map_htm/inset_23/inset_23_124.htm";
	}
	else if(theMap.toLowerCase() == "market rasen town centre"){
	  newMap = "map_htm/inset_51/inset_51_020.htm";
	}
	else if(theMap.toLowerCase() == "middle rasen"){
	  newMap = "map_htm/inset_53/inset_53_018.htm";
	}
	else if(theMap.toLowerCase() == "gainsborough town centre"){
	  newMap = "map_htm/inset_24/inset_24_024.htm";
	}
	else if(theMap.toLowerCase() == "springthorpe"){
	  newMap = "map_htm/inset_81/inset_81_008.htm";
	}
	else if(theMap.toLowerCase() == "tealby thorpe"){
	  newMap = "map_htm/inset_87/inset_87_010.htm";
	}
	else if(theMap.toLowerCase() == "hemswell cliff"){
	  newMap = "map_htm/inset_33/inset_33_018.htm";
	}
	else if(theMap.toLowerCase() == "glentham"){
	  newMap = "map_htm/inset_25/inset_25_008.htm";
	}
	else if(theMap.toLowerCase() == "hemswell"){
	  newMap = "map_htm/inset_32/inset_32_010.htm";
	}
	else if(theMap.toLowerCase() == "tealby"){
	  newMap = "map_htm/inset_86/inset_86_018.htm";
	}
	else if(theMap.toLowerCase() == "gainsborough north"){
	  newMap = "map_htm/inset_22/inset_22_066.htm";
	}
	else if(theMap.toLowerCase() == "corringham"){
	  newMap = "map_htm/inset_15/inset_15_015.htm";
	}
	else if(theMap.toLowerCase() == "morton"){
	  newMap = "map_htm/inset_54/inset_54_020.htm";
	}
	else if(theMap.toLowerCase() == "walesby"){
	  newMap = "map_htm/inset_91/inset_91_008.htm";
	}
	else if(theMap.toLowerCase() == "bishop norton"){
	  newMap = "map_htm/inset_03/inset_03_010.htm";
	}
	else if(theMap.toLowerCase() == "walkerith"){
	  newMap = "map_htm/inset_92/inset_92_008.htm";
	}
	else if(theMap.toLowerCase() == "osgodby"){
	  newMap = "map_htm/inset_63/inset_63_008.htm";
	}
	else if(theMap.toLowerCase() == "willoughton"){
	  newMap = "map_htm/inset_95/inset_95_010.htm";
	}
	else if(theMap.toLowerCase() == "east stockwith"){
	  newMap = "map_htm/inset_17/inset_17_012.htm";
	}
	else if(theMap.toLowerCase() == "snitterby"){
	  newMap = "map_htm/inset_76/inset_76_008.htm";
	}
	else if(theMap.toLowerCase() == "claxby"){
	  newMap = "map_htm/inset_14/inset_14_002.htm";
	}
	else if(theMap.toLowerCase() == "blyton"){
	  newMap = "map_htm/inset_04/inset_04_050.htm";
	}
	else if(theMap.toLowerCase() == "brookenby"){
	  newMap = "map_htm/inset_06/inset_06_035.htm";
	}
	else if(theMap.toLowerCase() == "grayingham"){
	  newMap = "map_htm/inset_28/inset_28_008.htm";
	}
	else if(theMap.toLowerCase() == "waddingham"){
	  newMap = "map_htm/inset_90/inset_90_010.htm";
	}
	else if(theMap.toLowerCase() == "northorpe"){
	  newMap = "map_htm/inset_62/inset_62_008.htm";
	}
	else if(theMap.toLowerCase() == "laughton"){
	  newMap = "map_htm/inset_42/inset_42_008.htm";
	}
	else if(theMap.toLowerCase() == "holton le moor"){
	  newMap = "map_htm/inset_34/inset_34_008.htm";
	}
	else if(theMap.toLowerCase() == "south kelsey"){
	  newMap = "map_htm/inset_78/inset_78_012.htm";
	}
	else if(theMap.toLowerCase() == "scotton"){
	  newMap = "map_htm/inset_74/inset_74_010.htm";
	}
	else if(theMap.toLowerCase() == "rothwell"){
	  newMap = "map_htm/inset_68/inset_68_010.htm";
	}
	else if(theMap.toLowerCase() == "nettleton"){
	  newMap = "map_htm/inset_56/inset_56_018.htm";
	}
	else if(theMap.toLowerCase() == "caistor town centre"){
	  newMap = "map_htm/inset_11/inset_11_015.htm";
	}
	else if(theMap.toLowerCase() == "north kelsey"){
	  newMap = "map_htm/inset_61/inset_61_017.htm";
	}
	else if(theMap.toLowerCase() == "scotter"){
	  newMap = "map_htm/inset_73/inset_73_026.htm";
	}
	else if(theMap.toLowerCase() == "swallow"){
	  newMap = "map_htm/inset_85/inset_85_008.htm";
	}
	else if(theMap.toLowerCase() == "grasby"){
	  newMap = "map_htm/inset_27/inset_27_007.htm";
	}
	else if(theMap.toLowerCase() == "searby"){
	  newMap = "map_htm/inset_75/inset_75_010.htm";
	}
	else if(theMap.toLowerCase() == "pingley camp"){
	  newMap = "map_htm/inset_65/inset_65_008.htm";
	}
	else if(theMap.toLowerCase() == "bigby"){
	  newMap = "map_htm/inset_02/inset_02_010.htm";
	}
	else if(theMap.toLowerCase() == "great limber"){
	  newMap = "map_htm/inset_29/inset_29_008.htm";
	}
	else if(theMap.toLowerCase() == "keelby"){
	  newMap = "map_htm/inset_36/inset_36_018.htm";
	}
	else if(theMap.toLowerCase() == "harpswell"){
	  newMap = "map_htm/inset_09/inset_09_008.htm";
	}
	else if(theMap.toLowerCase() == "market rasen"){
	  newMap = "map_htm/inset_50/inset_50_078.htm";
	}
	else if(theMap.toLowerCase() == "caistor"){
	  newMap = "map_htm/inset_10/inset_10_053.htm";
	}
	else if(theMap.toLowerCase() == "proposals map"){
	  newMap = "map_htm/proposals/proposals_276.htm";
	}
	else{
	  newMap = "";
	}
	
	//Go to map location
	if(newMap != ""){
	  if(source == "propmap"){
				  newMap = "../../" + newMap;
	  }
	  eval("parent.location='" + newMap + "'");
	}
}

//^^^Insert pre- generated code above ^^^


//*********Image click (Proposals Maps map > overview map ) This functionality only works for IE and Opera
function openOverview(e){

	//Set-up
	var imageWidth = 400; 								//Width of main overview image in pixels
	var imageHeight = 400; 								//Width of main overview image in pixels

	var tileWidth = 51365; 								//Width of main overview image in metres
	var tileHeight = 51365;								//Width of main overview image in metres

	var pixpermetreX =  tileWidth /imageWidth;
	var pixpermetreY =  tileHeight /imageHeight;

	var tileOriginX = 475615;							//Origin of main overview image in ground metres
	var tileOriginY = 364300;	
	
	tileOriginY = tileOriginY + tileHeight; 			//Make origin top left

	//Get user clicked location x,y (pixels).
	var theX = event.offsetX			
	var theY = event.offsetY

	//Convert to real world metres.
	theX = Number(theX) * pixpermetreX;	
	theY = Number(theY) * pixpermetreY; 
	theX =  tileOriginX + theX;
	theY =  tileOriginY - theY;
	
	//Check if the user clicked in an inset map area.		
	for(i=0;i<nofInsets;i++){
		
		//Define extent of each inset map area
		ovblx = theinsetsmaps[i][4]; 
		ovbly = theinsetsmaps[i][5]; 
		ovtrx = theinsetsmaps[i][6];
		ovtry = theinsetsmaps[i][7];
		var outSideX = "false";
		var outSideY = "false";
				
		if((theX >= ovtrx) | (theX <= ovblx)){
			outSideX = "true";		
		}
		if((theY >= ovtry) | (theY <= ovbly)){
			outSideY = "true";
		}

		if((outSideX == "false") & (outSideY == "false")){			//User has clicked within an inset map						
			var distx = theX - ovblx;
			var disty = theY - ovbly;
			
			var gridcnt = theinsetsmaps[i][8];
			var thecol = 1;
			while (gridcnt < distx){
				thecol = thecol + 1;
				gridcnt = gridcnt + (theinsetsmaps[i][8] - theinsetsmaps[i][9]);  
			}	
	 
			var gridcnt = theinsetsmaps[i][8];
			var therow = 1;  
			while (gridcnt < disty){
				therow = therow + 1;
				gridcnt = gridcnt + (theinsetsmaps[i][8] - theinsetsmaps[i][9]);  
			}			
			
			var theTileNo =  ((therow -1) * theinsetsmaps[i][11]) + thecol;

			//Adjust the tile number to agree with the standard "###"
			if(theTileNo < 10){
				theTileNo = "00" + theTileNo;
			}
			else if(theTileNo < 100){
				theTileNo = "0" + theTileNo;
			}
			else{
				theTileNo = String(theTileNo);
			}				

			theURL = "map_opening.htm?" + theinsetsmaps[i][0];
						
			//Open the selected tile in same window 
			eval("parent.location='" + theURL + "'");				
			break;																	//Quit the loop as the inset map has been found.
		}
	
	}		
}

//*********Define the Browser window title to = map/inset name.
//vvv Insert pre- generated code below (js_definemaptitle.txt) vvv
function defineMapTitle(theMapNo){
	if(theMapNo.toLowerCase() == "inset_79"){
	  theTitle = "Southrey";
	}
	else if(theMapNo.toLowerCase() == "inset_01"){
	  theTitle = "Bardney";
	}
	else if(theMapNo.toLowerCase() == "inset_47"){
	  theTitle = "Lincoln Fringe East";
	}
	else if(theMapNo.toLowerCase() == "inset_21"){
	  theTitle = "Fiskerton";
	}
	else if(theMapNo.toLowerCase() == "inset_31"){
	  theTitle = "Hawthorn Avenue";
	}
	else if(theMapNo.toLowerCase() == "inset_13"){
	  theTitle = "Cherry Willingham";
	}
	else if(theMapNo.toLowerCase() == "inset_46"){
	  theTitle = "Lincoln Fringe Central";
	}
	else if(theMapNo.toLowerCase() == "inset_60"){
	  theTitle = "North Greetwell";
	}
	else if(theMapNo.toLowerCase() == "inset_66"){
	  theTitle = "Reepham";
	}
	else if(theMapNo.toLowerCase() == "inset_45"){
	  theTitle = "Lincoln Fringe West";
	}
	else if(theMapNo.toLowerCase() == "inset_57"){
	  theTitle = "Newton on Trent";
	}
	else if(theMapNo.toLowerCase() == "inset_70"){
	  theTitle = "Saxilby Enterprise Park";
	}
	else if(theMapNo.toLowerCase() == "inset_08"){
	  theTitle = "Burton Waters";
	}
	else if(theMapNo.toLowerCase() == "inset_07"){
	  theTitle = "Burton";
	}
	else if(theMapNo.toLowerCase() == "inset_67"){
	  theTitle = "Riseholme Campus";
	}
	else if(theMapNo.toLowerCase() == "inset_37"){
	  theTitle = "Kettlethorpe";
	}
	else if(theMapNo.toLowerCase() == "inset_41"){
	  theTitle = "Laughterton";
	}
	else if(theMapNo.toLowerCase() == "inset_55"){
	  theTitle = "Nettleham";
	}
	else if(theMapNo.toLowerCase() == "inset_69"){
	  theTitle = "Saxilby";
	}
	else if(theMapNo.toLowerCase() == "inset_84"){
	  theTitle = "Sudbrooke";
	}
	else if(theMapNo.toLowerCase() == "inset_40"){
	  theTitle = "Langworth";
	}
	else if(theMapNo.toLowerCase() == "inset_77"){
	  theTitle = "South Carlton";
	}
	else if(theMapNo.toLowerCase() == "inset_19"){
	  theTitle = "Fenton";
	}
	else if(theMapNo.toLowerCase() == "inset_72"){
	  theTitle = "Scothern";
	}
	else if(theMapNo.toLowerCase() == "inset_59"){
	  theTitle = "North Carlton";
	}
	else if(theMapNo.toLowerCase() == "inset_48"){
	  theTitle = "Lincolnshire Show Ground";
	}
	else if(theMapNo.toLowerCase() == "inset_88"){
	  theTitle = "Torksey";
	}
	else if(theMapNo.toLowerCase() == "inset_71"){
	  theTitle = "Scampton";
	}
	else if(theMapNo.toLowerCase() == "inset_16"){
	  theTitle = "Dunholme";
	}
	else if(theMapNo.toLowerCase() == "inset_93"){
	  theTitle = "Welton";
	}
	else if(theMapNo.toLowerCase() == "inset_05"){
	  theTitle = "Brattleby";
	}
	else if(theMapNo.toLowerCase() == "inset_83"){
	  theTitle = "Sturton by Stow";
	}
	else if(theMapNo.toLowerCase() == "inset_52"){
	  theTitle = "Marton";
	}
	else if(theMapNo.toLowerCase() == "inset_12"){
	  theTitle = "Cammeringham";
	}
	else if(theMapNo.toLowerCase() == "inset_82"){
	  theTitle = "Stow";
	}
	else if(theMapNo.toLowerCase() == "inset_30"){
	  theTitle = "Hackthorn";
	}
	else if(theMapNo.toLowerCase() == "inset_49"){
	  theTitle = "Lissington";
	}
	else if(theMapNo.toLowerCase() == "inset_35"){
	  theTitle = "Ingham";
	}
	else if(theMapNo.toLowerCase() == "inset_94"){
	  theTitle = "Willingham by Stow";
	}
	else if(theMapNo.toLowerCase() == "inset_18"){
	  theTitle = "Faldingworth";
	}
	else if(theMapNo.toLowerCase() == "inset_80"){
	  theTitle = "Spridlington";
	}
	else if(theMapNo.toLowerCase() == "inset_44"){
	  theTitle = "Legsby";
	}
	else if(theMapNo.toLowerCase() == "inset_39"){
	  theTitle = "Knaith Park";
	}
	else if(theMapNo.toLowerCase() == "inset_20"){
	  theTitle = "Fillingham";
	}
	else if(theMapNo.toLowerCase() == "inset_38"){
	  theTitle = "Kexby";
	}
	else if(theMapNo.toLowerCase() == "inset_43"){
	  theTitle = "Lea";
	}
	else if(theMapNo.toLowerCase() == "inset_89"){
	  theTitle = "Upton";
	}
	else if(theMapNo.toLowerCase() == "inset_64"){
	  theTitle = "Owmby by Spital";
	}
	else if(theMapNo.toLowerCase() == "inset_58"){
	  theTitle = "Normanby by Spital";
	}
	else if(theMapNo.toLowerCase() == "inset_26"){
	  theTitle = "Glentworth";
	}
	else if(theMapNo.toLowerCase() == "inset_23"){
	  theTitle = "Gainsborough South";
	}
	else if(theMapNo.toLowerCase() == "inset_51"){
	  theTitle = "Market Rasen Town Centre";
	}
	else if(theMapNo.toLowerCase() == "inset_53"){
	  theTitle = "Middle Rasen";
	}
	else if(theMapNo.toLowerCase() == "inset_24"){
	  theTitle = "Gainsborough Town Centre";
	}
	else if(theMapNo.toLowerCase() == "inset_81"){
	  theTitle = "Springthorpe";
	}
	else if(theMapNo.toLowerCase() == "inset_87"){
	  theTitle = "Tealby Thorpe";
	}
	else if(theMapNo.toLowerCase() == "inset_33"){
	  theTitle = "Hemswell Cliff";
	}
	else if(theMapNo.toLowerCase() == "inset_25"){
	  theTitle = "Glentham";
	}
	else if(theMapNo.toLowerCase() == "inset_32"){
	  theTitle = "Hemswell";
	}
	else if(theMapNo.toLowerCase() == "inset_86"){
	  theTitle = "Tealby";
	}
	else if(theMapNo.toLowerCase() == "inset_22"){
	  theTitle = "Gainsborough North";
	}
	else if(theMapNo.toLowerCase() == "inset_15"){
	  theTitle = "Corringham";
	}
	else if(theMapNo.toLowerCase() == "inset_54"){
	  theTitle = "Morton";
	}
	else if(theMapNo.toLowerCase() == "inset_91"){
	  theTitle = "Walesby";
	}
	else if(theMapNo.toLowerCase() == "inset_03"){
	  theTitle = "Bishop Norton";
	}
	else if(theMapNo.toLowerCase() == "inset_92"){
	  theTitle = "Walkerith";
	}
	else if(theMapNo.toLowerCase() == "inset_63"){
	  theTitle = "Osgodby";
	}
	else if(theMapNo.toLowerCase() == "inset_95"){
	  theTitle = "Willoughton";
	}
	else if(theMapNo.toLowerCase() == "inset_17"){
	  theTitle = "East Stockwith";
	}
	else if(theMapNo.toLowerCase() == "inset_76"){
	  theTitle = "Snitterby";
	}
	else if(theMapNo.toLowerCase() == "inset_14"){
	  theTitle = "Claxby";
	}
	else if(theMapNo.toLowerCase() == "inset_04"){
	  theTitle = "Blyton";
	}
	else if(theMapNo.toLowerCase() == "inset_06"){
	  theTitle = "Brookenby";
	}
	else if(theMapNo.toLowerCase() == "inset_28"){
	  theTitle = "Grayingham";
	}
	else if(theMapNo.toLowerCase() == "inset_90"){
	  theTitle = "Waddingham";
	}
	else if(theMapNo.toLowerCase() == "inset_62"){
	  theTitle = "Northorpe";
	}
	else if(theMapNo.toLowerCase() == "inset_42"){
	  theTitle = "Laughton";
	}
	else if(theMapNo.toLowerCase() == "inset_34"){
	  theTitle = "Holton le Moor";
	}
	else if(theMapNo.toLowerCase() == "inset_78"){
	  theTitle = "South Kelsey";
	}
	else if(theMapNo.toLowerCase() == "inset_74"){
	  theTitle = "Scotton";
	}
	else if(theMapNo.toLowerCase() == "inset_68"){
	  theTitle = "Rothwell";
	}
	else if(theMapNo.toLowerCase() == "inset_56"){
	  theTitle = "Nettleton";
	}
	else if(theMapNo.toLowerCase() == "inset_11"){
	  theTitle = "Caistor Town Centre";
	}
	else if(theMapNo.toLowerCase() == "inset_61"){
	  theTitle = "North Kelsey";
	}
	else if(theMapNo.toLowerCase() == "inset_73"){
	  theTitle = "Scotter";
	}
	else if(theMapNo.toLowerCase() == "inset_85"){
	  theTitle = "Swallow";
	}
	else if(theMapNo.toLowerCase() == "inset_27"){
	  theTitle = "Grasby";
	}
	else if(theMapNo.toLowerCase() == "inset_75"){
	  theTitle = "Searby";
	}
	else if(theMapNo.toLowerCase() == "inset_65"){
	  theTitle = "Pingley Camp";
	}
	else if(theMapNo.toLowerCase() == "inset_02"){
	  theTitle = "Bigby";
	}
	else if(theMapNo.toLowerCase() == "inset_29"){
	  theTitle = "Great Limber";
	}
	else if(theMapNo.toLowerCase() == "inset_36"){
	  theTitle = "Keelby";
	}
	else if(theMapNo.toLowerCase() == "inset_09"){
	  theTitle = "Harpswell";
	}
	else if(theMapNo.toLowerCase() == "inset_50"){
	  theTitle = "Market Rasen";
	}
	else if(theMapNo.toLowerCase() == "inset_10"){
	  theTitle = "Caistor";
	}
	else if(theMapNo.toLowerCase() == "proposals"){
	  theTitle = "Proposals Map";
	}
	else{
	theTitle = "";
	}
	return theTitle;
}
//^^^Insert pre- generated code above ^^^

//********Get the attribute and open the written doc in new window or open a list of policies (called on main map click/keypress).
function getatt(thePolRef,theDoc){

	if(theDoc.indexOf("inset") != -1){								//*****User has clicked on Inset hotpot -open the new inset map
		openMapAtCentre(thePolRef,'propmap');	
	}
	else if(thePolRef != ""){										//*****User has clicked on policy hotpot - open policy list or written statement
		var comm = thePolRef.indexOf(",");
		if(comm == -1){												//Only one policy selected - Open written statement
		
			//Remove any specifics eg (1) etc. from the policy reference.
			var test = thePolRef.indexOf(" ");
			if(test != -1){
				var newPolRef = thePolRef.substring(0,test);
				thePolRef = newPolRef;
			}
			
			theURL = "../../written/cpt" + theDoc + ".htm#" + thePolRef.toLowerCase();	
			winName =  "Written";  
			features = "menubar=yes,toolbar=yes,scrollbars=yes,resizable=yes,width=630,height=500";
			window.open(theURL,winName,features);
		}
		else														//More than one policy selected - Open the policy list
		{
			polIndex(thePolRef,theDoc);
		}
	}		
}	


//*********Opens index of policies realating to selected site the user has clicked on.
function polIndex(thePolRef,theDoc){																		
		theURL = "../../pol_index.htm?" + thePolRef + "&" + theDoc;	
		winName = "thePolIndex";
		features = "menubar=yes,toolbar=yes,scrollbars=yes,resizable=yes,width=630,height=500";
		window.open(theURL,winName,features);		
}


//*******************Function to remove the space code %20 and ampersand code %38
function removePercentCode(theTitle){

	//Remove space code '%20'
	var newstring = "";																	
	var pos = theTitle.indexOf("%20");
	
	if(pos != -1){
		newstring = newstring + theTitle.substring(0,pos) + " "	;
		test = theTitle.substring((pos+3),theTitle.length);	
		pos = test.indexOf("%20");
	
		while (pos != -1){
			newstring = newstring + test.substring(0,pos) + " ";
			test = test.substring((pos+3),test.length);	
			pos = test.indexOf("%20");
		}
		
		newstring = newstring + test.substring(0,test.length);
	}
	else{
		newstring = theTitle;
	}

	//Remove ampersand code '%38'
	var newstring2 = "";																	
	var pos = newstring.indexOf("%38");
	
	if(pos != -1){
		newstring2 = newstring2 + newstring.substring(0,pos) + "&";	
		test = newstring.substring((pos+3),newstring.length);	
		pos = test.indexOf("%38");
	
		while (pos != -1){
			newstring2 = newstring2 + test.substring(0,pos) + "&";
			test = test.substring((pos+3),test.length);	
			pos = test.indexOf("%38");
		}
		
		newstring2 = newstring2 + test.substring(0,test.length);
	}
	else{
		newstring2 = newstring;
	}

	//Remove trailing and leading spaces.
	if(newstring2.indexOf(" ") == 0){
		newstring3 = newstring2.substring(1,newstring2.length);
	}
	else{
		newstring3 = newstring2;
	}
	if(newstring3.indexOf(" ") == (newstring3.length -1)){
		newstring4 = newstring3.substring(0,(newstring3.length-1));
	}
	else{
		newstring4 = newstring3;
	}
	
	return(newstring4);

}	

//*******************Replaces the policy ref number with the policy name (Used when printed to the policy index page pol_index.htm)
//vvv Insert pre- generated code below (js_getpolicyname.txt) vvv
function getPolicyName(polNum){
	if(polNum == "CORE9"){
	  thePolName = "Retention of Important Open Space/Frontages in Settlements";
	}
	else if(polNum == "CORE10"){
	  thePolName = "Open Space and Landscaping Within Developments";
	}
	else if(polNum == "CRT6"){
	  thePolName = "Riseholme Park Campuss";
	}
	else if(polNum == "CRT20"){
	  thePolName = "Waterway Corridors";
	}
	else if(polNum == "CRT7"){
	  thePolName = "Lincolnshire Showground";
	}
	else if(polNum == "ECON13"){
	  thePolName = "Lincoln Eastern By-Pass";
	}
	else if(polNum == "NBE1"){
	  thePolName = "Development in Conservation Areas";
	}
	else if(polNum == "NBE8"){
	  thePolName = "Historic Parks and Gardens";
	}
	else if(polNum == "NBE7"){
	  thePolName = "Ancient Monuments, Sites and Remains of Archaeological Importance";
	}
	else if(polNum == "NBE9"){
	  thePolName = "The Lincolnshire Wolds Area of Outstanding Natural Beauty";
	}
	else if(polNum == "NBE11"){
	  thePolName = "Development Affecting Sites of Special Scientific Interest and National Nature Reserves";
	}
	else if(polNum == "NBE10"){
	  thePolName = "Development in Areas of Great Landscape Value";
	}
	else if(polNum == "NBE12"){
	  thePolName = "Development Affecting Locally Designated Nature Conservation Sites and Ancient Woodland";
	}
	else if(polNum == "RTC3"){
	  thePolName = "Retailing and Village Centre Uses in Primary Rural Settlements";
	}
	else if(polNum == "RTC1"){
	  thePolName = "Town Centre Development";
	}
	else if(polNum == "RTC2"){
	  thePolName = "Retail Development in Trinity Street, Gainsborough";
	}
	else if(polNum == "STRAT4"){
	  thePolName = "Windfall Housing Development in Gainsborough and the Urban Areas of Lincoln";
	}
	else if(polNum == "STRAT5"){
	  thePolName = "Windfall Housing Development in Market Rasen and Caistor";
	}
	else if(polNum == "STRAT6"){
	  thePolName = "Windfall Housing Development in Primary Rural Settlements";
	}
	else if(polNum == "STRAT13"){
	  thePolName = "Undeveloped Breaks Between Settlements and Green Wedges Around Lincoln";
	}
	else if(polNum == "STRAT16"){
	  thePolName = "Retail Allocations";
	}
	else if(polNum == "STRAT17"){
	  thePolName = "Recreational Area Allocations";
	}
	else if(polNum == "STRAT2"){
	  thePolName = "Location of New Housing – Residential Allocations";
	}
	else if(polNum == "STRAT10"){
	  thePolName = "Longer Term Development Options";
	}
	else if(polNum == "STRAT154"){
	  thePolName = "Mixed Use Allocations";
	}
	else if(polNum == "STRAT15"){
	  thePolName = "Employment Allocations";
	}
	else if(polNum == "STRAT11"){
	  thePolName = "Renewal of Existing Planning Permissions";
	}
	else{
	  thePolName = "";
	}
	
	return(thePolName);

}
//^^^Insert pre- generated code above ^^^


//**********Updates the main map by clicking the region overview map. This functionality only works for IE and Opera
function updatemap1(e){

	//Set-up
	var imageWidth = 200; 								//Width of main overview image in pixels
	var tileWidth = 51365; 								//Width of main overview image in metres
	var pixpermetre =  tileWidth /imageWidth;
	var tileOriginX = 475615;							//Origin of main overview image in ground metres
	var tileOriginY = 364300;
	
	tileOriginY = tileOriginY + tileWidth; 				//Make origin top left

	//Get user clicked location x,y (pixels).
	var theX = event.offsetX;			
	var theY = event.offsetY;
	
	//Convert to real world metres.
	theX = Number(theX) * pixpermetre;	
	theY = Number(theY) * pixpermetre;  
	theX =  tileOriginX + theX;
	theY =  tileOriginY - theY;
	
	//Check if the user clicked in an inset map area.		
	for(i=0;i<nofInsets;i++){
		
		//Define extent of each inset map area
		ovblx = theinsetsmaps[i][4]; 
		ovbly = theinsetsmaps[i][5]; 
		ovtrx = theinsetsmaps[i][6]; 
		ovtry = theinsetsmaps[i][7];
		var outSideX = "false";
		var outSideY = "false";
				
		if((theX >= ovtrx) | (theX <= ovblx)){
			outSideX = "true";		
		}
		if((theY >= ovtry) | (theY <= ovbly)){
			outSideY = "true";
		}

		if((outSideX == "false") & (outSideY == "false")){			//User has clicked within an inset map						
			var distx = theX - ovblx;
			var disty = theY - ovbly;
			
			var gridcnt = theinsetsmaps[i][8];
			var thecol = 1; 
			while (gridcnt < distx){
				thecol = thecol + 1;
				gridcnt = gridcnt + (theinsetsmaps[i][8] - theinsetsmaps[i][9]);  
			}	
	 
			var gridcnt = theinsetsmaps[i][8];
			var therow = 1;  
			while (gridcnt < disty){
				therow = therow + 1;
				gridcnt = gridcnt + (theinsetsmaps[i][8] - theinsetsmaps[i][9]);  
			}			
			
			var theTileNo =  ((therow -1) * theinsetsmaps[i][11]) + thecol;

			//Adjust the tile number to agree with the standard "###"
			if(theTileNo < 10){
				theTileNo = "00" + theTileNo;
			}
			else if(theTileNo < 100){
				theTileNo = "0" + theTileNo;
			}
			else{
				theTileNo = String(theTileNo);
			}

			//Update main map frame
			var newloc = "../../map_htm/" + theinsetsmaps[i][0] + "/" + theinsetsmaps[i][0] + "_" + theTileNo + ".htm";		
			parent.window.location = newloc;	
			break;																	//Quit the loop as the inset map has nbeen found.
		}
	
	}

}

//**********Updates the main map by clicking the inset overview map. This functionality only works for IE and Opera
function updatemap2(e){

	//Get the current overview image.
	var cmdString = String(parent.document.location);
	
	var theSep;
	for (n=0;n<cmdString.length; n++){
		var teststring = cmdString.substring(n,(n + 1));
		if(teststring == "/"){
			theSep = n;
		}
	}
	var tempstring = cmdString.substring((theSep +1),(cmdString.length));
	for (n=0;n<tempstring.length; n++){
		var teststring =  tempstring.substring(n,(n + 1));
		if(teststring == "_"){
			theSep = n;
		}
	}	
	var theName = tempstring.substring(0,theSep);		
		
	//Define the current overview.	
	for(i=0;i<nofInsets;i++){
		if(theName.toUpperCase() == theinsetsmaps[i][0].toUpperCase()){
			var useIndex = i;
		}
	}
	
	var imageWidth = 200 ;																		//Width of inset overview image in pixels
	var pixpermetre =  theinsetsmaps[useIndex][3] / imageWidth;
	var origTLY  = theinsetsmaps[useIndex][2] + theinsetsmaps[useIndex][3];		//Make origin top left

	//Get user clicked location x,y (pixels).
	var theX = event.offsetX;			
	var theY =  event.offsetY;

	//Convert to real world metres.
	theX = Number(theX) * pixpermetre;	
	theY = Number(theY) * pixpermetre ;  
	theX =  theinsetsmaps[useIndex][1] + theX;
	theY =  origTLY - theY;

	//Define if user has clicked in the map area
	var outSideX = "false";
	var outSideY = "false";
	
	if((theX >= theinsetsmaps[useIndex][6]) | (theX <= theinsetsmaps[useIndex][4])){
		outSideX = "true";		
	}
	if((theY >= theinsetsmaps[useIndex][7]) | (theY <= theinsetsmaps[useIndex][5])){
		outSideY = "true";
	}

	//Define the new map image to load in.
	if((outSideX == "true") | (outSideY == "true")){			
		//alert("outside the area")
	}
	else{
		var distx = theX - theinsetsmaps[useIndex][4];
		var disty = theY - theinsetsmaps[useIndex][5];
		
		var gridcnt = theinsetsmaps[useIndex][8];
  		var thecol = 1; 
		while (gridcnt < distx){
			thecol = thecol + 1;
			gridcnt = gridcnt + (theinsetsmaps[useIndex][8] - theinsetsmaps[useIndex][9]);  
		}	
 
		var gridcnt = theinsetsmaps[useIndex][8];
  		var therow = 1; 
		while (gridcnt < disty){
			therow = therow + 1;
			gridcnt = gridcnt + (theinsetsmaps[useIndex][8] - theinsetsmaps[useIndex][9]);  
		}			
		
		var theTileNo =  ((therow -1) * theinsetsmaps[useIndex][11]) + thecol;

		//Adjust the tile number to agree with the standard "###"
		if(theTileNo < 10){
			theTileNo = "00" + theTileNo;
		}
		else if(theTileNo < 100){
			theTileNo = "0" + theTileNo;
		}
		else{
			theTileNo = String(theTileNo);
		}
		
		//Update main map frame
		var newloc =  theName + "_" + theTileNo + ".htm"; 
		parent.window.location = newloc;

	}
	
}

//*********Opens mapping from the Proposals Maps
function openMap(selObj,theSource){ 

	//Get the inset number
	if (theSource == 1){
		var inString = selObj.options[selObj.selectedIndex].value;
	}
	else{
		var inString = selObj;
	}
	
	//Get the inset number
	var sep = inString.indexOf("_");
	var string1 = inString.substring(0,(sep+1));
	var string2 = inString.substring((sep+1),inString.length);
	var sep2 = string2.indexOf("_");
	if(sep2 != -1){
		var insetNo = string1 + string2.substring(0,sep2);
	}
	else{
		var insetNo = string1.substring(0,(string1.length -1));
	}

	//If using IE or opera open intermediate window for the user to select exact map location
	if(((is_ie == true) && (is_ie5up == true))|| ((is_opera == true) && (is_opera5up == true))){				//IE or Opera open overview mapping
		var mapLoc = "map_opening.htm?" + insetNo;				 
	}
	else{
		var mapLoc = "map_htm/" + insetNo + "/" + inString + ".htm";
	}

	//Open in current window
 	eval("parent.location='" + mapLoc + "'");

  	if (theSource == 1){
		selObj.selectedIndex=0;
	}
}

//*********Defines how the map list is shown on the Proposals Maps (Keyboard accessible list or combo box)
function getMapList(toShow){
	if(toShow == "combo"){									//Show combo box
		eval("parent.location='map_index.htm?false'");
	}
	else{													//Show as text list
		eval("parent.location='map_index.htm?true'");
	}
}

//*******************************Defines the map to load from the postcode search.
function getSelectedPC(selObj){
	
	//Passed tile location.
	var tileLoc = selObj.options[selObj.selectedIndex].value;
			
	//Get the inset number
	var sep = tileLoc.indexOf("_");
	var string1 = tileLoc.substring(0,(sep+1));
	var string2 = tileLoc.substring((sep+1),tileLoc.length);
	var sep2 = string2.indexOf("_");
	if(sep2 != -1){
		var insetNo = string1 + string2.substring(0,sep2);
	}
	else{
		var insetNo = string1.substring(0,(string1.length -1));
	}

	//Get the path of the selected tile
	var mapLoc = "map_htm/" + insetNo + "/" + tileLoc + ".htm";

	//Open in current window
 	eval("parent.location='" + mapLoc + "'");
								
}

//******************************Opens a map from a link on the written statement
function goToMapLoc(theMapRef){

	 if(theMapRef != ""){	
		var comm = theMapRef.indexOf(",");
		if(comm == -1){												//Only one location go straight to the map.						
			//Get the inset number
			var sep = theMapRef.indexOf("_");
			var string1 = theMapRef.substring(0,(sep+1));
			var string2 = theMapRef.substring((sep+1),theMapRef.length);
			var sep2 = string2.indexOf("_");
			if(sep2 != -1){
				var insetNo = string1 + string2.substring(0,sep2);
			}
			else{
				var insetNo = string1.substring(0,(string1.length -1));
			}
			
			var mapLoc = "../map_htm/" + insetNo + "/" + theMapRef + ".htm";
			    	     
			//Open in current window
 			eval("parent.location='" + mapLoc + "'");
		}	
		else{														//More than one location open intermediate window for user to choose.
			var theURL = "../loc_index.htm?" + theMapRef ;	
 			eval("parent.location='" + theURL + "'");
		}
	}		

}

//******************************Opens a map from the list of towns.
function openTown(selObj,theSource){

	//Get the inset number
	if (theSource == 1){
		var inString = selObj.options[selObj.selectedIndex].value;
	}
	else{
		var inString = selObj;
	}
	
	//Get the inset number
	var sep = inString.indexOf("_");
	var string1 = inString.substring(0,(sep+1));
	var string2 = inString.substring((sep+1),inString.length);
	var sep2 = string2.indexOf("_");
	if(sep2 != -1){
		var insetNo = string1 + string2.substring(0,sep2);
	}
	else{
		var insetNo = string1.substring(0,(string1.length -1));
	}

	var mapLoc = "map_htm/" + insetNo + "/" + inString + ".htm";

	//Open in current window
 	eval("parent.location='" + mapLoc + "'");
  	if (theSource == 1){
		selObj.selectedIndex=0;
	}
}

/*
***********END of Script
*/