   var osMap;


    var tenkmList =
    [
       	[580000,230000], [590000,230000], [600000,230000], [610000,230000], [620000,230000], [630000,230000], [560000,240000], [570000,240000], [580000,240000], [590000,240000], [600000,240000], [610000,240000], [620000,240000], [630000,240000], [640000,240000], [560000,250000], [570000,250000], [580000,250000], [590000,250000], [600000,250000], [610000,250000], [620000,250000], [630000,250000], [640000,250000], [550000,260000], [560000,260000], [570000,260000], [580000,260000], [590000,260000], [600000,260000], [610000,260000], [620000,260000], [630000,260000], [640000,260000], [560000,270000], [570000,270000], [580000,270000], [590000,270000], [600000,270000], [610000,270000], [620000,270000], [630000,270000], [640000,270000], [650000,270000], [560000,280000], [570000,280000], [580000,280000], [590000,280000], [620000,280000], [630000,280000], [640000,280000], [650000,280000], [630000,290000], [640000,290000], [650000,290000], [640000,300000], [650000,300000]
    ];
    var tenkmGreyList =
    [
       	[540000,220000], [550000,220000], [560000,220000], [570000,220000], [580000,220000], [590000,220000], [600000,220000], [610000,220000], [620000,220000], [540000,230000], [550000,230000], [560000,230000], [570000,230000], [540000,240000], [550000,240000], [540000,250000], [550000,250000], [540000,260000], [540000,270000], [550000,270000], [540000,280000], [550000,280000], [600000,280000], [610000,280000], [540000,290000], [550000,290000], [560000,290000], [570000,290000], [580000,290000], [590000,290000], [600000,290000], [610000,290000], [620000,290000], [540000,300000], [550000,300000], [560000,300000], [570000,300000], [580000,300000], [590000,300000], [600000,300000], [610000,300000], [620000,300000], [630000,300000], [540000,310000], [550000,310000], [560000,310000], [570000,310000], [580000,310000], [590000,310000], [600000,310000], [610000,310000], [620000,310000], [630000,310000], [640000,310000], [650000,310000]
    ];
var bound1 = 
[
[610000,230000], [624800,230000],[625000,230400], [625400,231000], [625700,231400], [626000,231600], [626300,231600], [626200,232000], [626300,232400], [626200,232600], [626100,232800], [626300,232900], [626200,233100], [625800,232900], [625700,232700], [625800,232500], [625600,232500], [625500,232100], [625600,231800], [625000,231700], [624400,232000], [624300,232300], [624200,232700], [623000,232800], [622500,232300], [622400,232000], [622000,231700], [621500,231600], [621000,231800], [620500,232000], [620000,231800], [619500,231700], [618700,231800], [618400,232000], [618000,232400], [617000,232200], [616500,232100], [616300,231800], [616000,231700], [615500,231500], [615000,231600], [614500,231400], [614000,231700], [613600,231600], [613000,231800], [612500,231900], [612000,231800], [611700,232000], [611500,232100], [611000,232000], [610500,232000], [610300,232200], [610100,232400], [610000,232600], [610000,230000]
];
var bound2 = 
[
[570600,230000], [570600,246100], [570800,245900], [570700,245800], [570900,245200], [570800,244900], [570900,244300], [570700,244000], [570700,243900], [570600,243400], [570800,243000], [571500,242700], [571600,242600], [571800,242700], [572000,242800], [572400,243100], [572800,242800], [573000,242800], [573400,243000], [573700,243300], [574000,243100], [574300,243100], [574400,243000], [574600,243200], [574800,243700], [574900,244000], [575000,244100], [575600,244500], [576000,244500], [576000,244400], [576300,244200], [576600,244500], [576600,244700], [577000,245100], [577400,245100], [577600,245000], [577900,245000], [577900,244900], [578100,245100], [578500,245200], [578600,245600], [578900,245600], [579000,245500], [579600,245300], [579600,245500], [579800,245500], [580000,245500], [580100,245700], [580200,245800], [580500,245900], [580600,246300], [581000,246300], [581400,246200], [581900,246100], [582000,246300], [582200,246300], [582400,246100], [582600,246200], [583000,246400], [583400,246200], [583700,246200], [583800,246500], [584000,246500], [584300,246300], [584400,245900], [585000,245800], [585300,245700], [585600,245500], [585600,245200], [585600,245000], [586000,244900], [585800,244300], [585500,244300], [585400,244000], [585700,243600], [585800,243000], [586000,242900], [586400,242800], [586400,242300], [586900,242000], [587000,241700], [586700,241400], [586600,241200], [586700,241000], [586900,240800], [586900,240600], [587300,240700], [587700,240800], [588000,240600], [588200,240200], [588100,239800], [588200,239600], [588300,239600], [588200,239300], [588300,238900], [588200,238700], [588100,238700], [588000,238300], [588300,237900], [588500,237900], [588500,237800], [588800,237700], [588900,237400], [588800,237000], [589000,236900], [589500,236900], [589600,236700], [589600,236300], [589700,236300], [589800,236000], [589600,235400], [589800,235300], [590200,235300], [590400,235100], [590600,235200], [590600,234900], [590500,234800], [590600,234000], [590500,233800], [590800,233500], [591400,233500], [591500,233100], [592400,233100], [592500,233000], [592600,233000], [593000,233000], [593200,232900], [593400,233000], [593400,233500], [593700,233700], [594200,233700], [595200,233200], [595300,233100], [595600,233100], [596500,233200], [596500,233500], [596700,233800], [596900,234200], [597200,234200], [597400,234000], [597400,233700], [598000,233700], [598400,234000], [598500,234300], [598600,234400], [599200,234400], [599500,234500], [600100,234600], [600700,234700], [600800,234900], [601200,234300], [602000,234500], [602200,234300], [603000,234900], [603500,235100], [603600,235000], [603700,234500], [604100,234300], [604200,234000], [604000,233600], [604400,233500], [604500,233400], [605000,233500], [605600,233500], [606100,233700], [606700,233400], [606700,233600], [606900,233500], [607100,233400], [607400,233200], [607600,233300], [607800,233000], [607800,232800], [608000,232900], [608100,233000], [608500,233100], [609000,233000], [609100,233000], [609100,233300], [609700,233200], [610300,232700], [610300,232800], [610500,232700], [610000,232600], [610000,230000], [570600,230000]
];
var bound3= 
[
[604000,310100], [604000,279000], [604200,279100], [604600,279400], [604800,279600], [605300,279600], [605700,279800], [606100,279900], [606600,279900], [606700,280000], [606800,280000], [607400,280200], [607800,280100], [608600,280100], [609000,280000], [609300,279800], [609500,279700], [609900,279600], [609900,279400], [611200,279300], [611500,279300], [612000,279400], [612200,279300], [612400,279100], [612500,279100], [612700,278900], [613000,278900], [613400,279000], [614000,278900], [614100,278900], [614200,278700], [614600,278700], [614600,278600], [614900,278400], [615300,278400], [615300,278500], [615500,278500], [615500,278400], [616000,278300], [616100,278300], [616200,278200], [616200,278300], [616300,278300], [616400,278400], [616600,278300], [616600,278200], [616900,278200], [617100,278400], [617200,278400], [617300,278500], [617400,278500], [617500,278400], [617600,278500], [617700,278400], [617800,278400], [617900,278300], [618100,278300], [618400,278100], [618500,278100], [618800,277900], [619100,278000], [619400,278100], [619400,278300], [619500,278200], [619600,278400], [619700,278500], [620000,278500], [620100,278600], [620200,278700], [620200,279000], [620400,279100], [620500,279000], [621000,279200], [621100,279100], [621400,279200], [621600,279700], [621900,279700], [622200,280100], [622300,280100], [622500,280700], [622700,280800], [622900,281200], [623000,281200], [623100,281300], [623300,281600], [623400,281700], [623800,282100], [624000,282000], [624100,281900], [624400,282200], [625000,282100], [625200,281900], [625200,281800], [625500,281700], [625700,281700], [625700,281800], [625800,281800], [626000,282000], [626200,282000], [626300,282200], [626700,282400], [626700,282600], [626900,283000], [627000,283400], [627300,283500], [627500,283500], [627700,283700], [627700,284200], [627800,284200], [628300,284500], [628400,284400], [628400,284600], [628700,284800], [628600,285100], [628500,285200], [628500,285300], [628300,285600], [628400,285700], [628400,286000], [628700,286300], [629000,286400], [629100,286400], [629100,286500], [629200,286500], [629300,286600], [629400,286700], [629600,286700], [629800,286900], [630000,286900], [630100,287000], [630400,287000], [630700,287200], [630700,287300], [630600,287500], [630700,287700], [631000,287800], [631000,287900], [631300,288100], [631700,288100], [631600,288300], [631900,288400], [632000,288300], [632100,288500], [632300,288400], [632800,288600], [633000,288500], [633400,288500], [633400,288800], [633500,288800], [633500,289100], [633300,289600], [633400,289700], [633000,289900], [632500,290000], [631800,290300], [631800,290600], [632000,290700], [632200,291300], [632500,291400], [632800,291300], [632900,291100], [633400,290800], [633400,290400], [633700,290000], [634000,289800], [634500,289900], [634600,290000], [635000,290100], [635200,290200], [635400,290800], [635700,291000], [636000,291300], [636100,291400], [636400,291600], [636600,291600], [637000,291300], [637300,291300], [637600,291200], [637500,291100], [637600,291100], [637600,291200], [637700,291200], [637700,291000], [637900,290900], [638000,290800], [638300,290700], [638400,290600], [638500,290700], [638900,290900], [639100,290700], [639300,290700], [639400,291100], [639500,291400], [639800,291400], [640200,291200], [640300,291100], [640400,291000], [640500,290800], [640700,290700], [640800,290900], [640900,290800], [641100,290700], [641100,290500], [641600,290500], [641700,290300], [642100,290800], [642000,291200], [642300,291500], [642300,292000], [642400,292300], [642800,292300], [642900,292500], [643400,292600], [643600,292800], [644300,292400], [644400,292200], [644800,292100], [645100,291500], [645400,291400], [645800,291200], [646600,291100], [647000,291200], [647000,291600], [647500,291800], [647600,292100], [647800,292200], [648100,292000], [648300,291800], [648600,291900], [648900,292600], [649300,292700], [649400,293000], [649300,293300], [649700,293700], [649800,294100], [650000,294300], [650000,294900], [649900,295100], [649600,295200], [649400,295800], [649200,295900], [648400,295500], [648100,295500], [647900,295900], [647500,296200], [647500,296600], [647600,296900], [647400,297100], [647000,297200], [646400,297600], [646200,298000], [646200,298400], [645600,298900], [645700,299600], [645500,299700], [645600,299700], [644800,299700], [644600,300000], [644600,300500], [644800,300800], [645000,301000], [645500,301000], [645600,301100], [645800,301300], [646100,301800], [646400,302200], [646300,303000], [646300,303300], [646500,303600], [647000,303600], [647200,303700], [647400,304000], [647200,304500], [647100,305200], [647200,305700], [647600,306200], [648000,306300], [649000,306800], [650000,307300], [650400,307500], [650900,307600], [651200,308000], [651500,308100], [651700,308000], [652100,307500], [652400,307000], [652400,306000], [652600,305600], [652700,305000], [653000,304100], [653100,303700], [653400,303700], [653400,304000], [653300,304600], [653200,305300], [653200,306000], [653200,307000], [653300,308000], [653400,309000], [653500,309900], [653500,310100], [604000,310100]
];
var bound4 = 
[
[604000,310100], [604000,279000], [603400,279000], [603000,278800], [602000,278800], [601800,279000], [601400,279000], [601200,279100], [601200,279200], [600700,279400], [600300,279700], [600200,280100], [600000,280200], [600000,280500], [599700,280700], [599500,280800], [599300,280700], [599200,280700], [599000,280900], [598700,280700], [598400,280700], [598200,280600], [598100,280600], [598000,280400], [597700,280300], [597600,280400], [597500,280400], [597200,280600], [597000,280600], [596900,280900], [596100,281000], [595700,280700], [595000,280800], [594800,281100], [594500,281300], [594500,281700], [594000,281700], [593200,281800], [592900,281700], [592600,281500], [592600,281300], [592200,281100], [592000,281000], [591600,281000], [591500,280700], [590900,280500], [590300,280700], [589700,280200], [589600,280100], [588800,280100], [588600,280500], [588300,280500], [588100,280300], [588000,280100], [587900,280100], [587600,279900], [587500,279700], [587300,279600], [587200,279500], [587000,279600], [587000,279700], [586800,280100], [586600,280200], [586600,280700], [586800,281000], [587500,281700], [587400,282100], [587500,282300], [587400,282500], [587200,282500], [586900,283000], [586500,283200], [586200,283100], [585900,283300], [585600,283300], [585500,283400], [585300,283400], [585100,283500], [585000,284000], [585000,284300], [585200,284600], [585200,284800], [585300,285000], [585400,285400], [585400,285600], [585300,285900], [585400,286400], [585000,286900], [584900,287000], [584500,287000], [584000,287300], [583500,287100], [583000,287100], [582300,287400], [582100,287400], [581600,287900], [581600,288100], [581300,288300], [581000,288200], [580400,287600], [580200,287600], [580100,287500], [579800,287200], [579800,287100], [579600,287100], [579600,287000], [579200,287000], [579100,286900], [578700,286800], [578600,286900], [578200,286900], [578000,286700], [577500,286700], [577300,287000], [577000,287100], [576700,287100], [576600,287200], [576500,287200], [576300,287100], [576200,287200], [576000,287100], [575600,286900], [575200,287000], [574900,286900], [574600,287000], [574300,287000], [574000,287300], [573600,287300], [573200,287000], [573000,286900], [572600,286700], [572300,286700], [572200,287000], [572000,287000], [571900,286800], [571800,286500], [571600,286300], [571100,286600], [570900,286400], [570500,286500], [570000,286500], [569700,286200], [569000,286200], [568700,286100], [568500,285900], [568300,286100], [568200,286000], [567900,286000], [567600,285600], [567000,285600], [566400,286000], [566300,286100], [566300,310100], [604000,310100]
];
var bound5 = 
[
[556900,230000], [570600,230000], [570600,246100], [570200,246100], [570100,245900], [570000,245900], [569800,245800], [569600,246100], [569400,246000], [568500,246200], [568400,246000], [568100,245800], [568000,245500], [567300,244900], [567200,244800], [567100,244500], [566500,243800], [566400,243800], [565900,243400], [565200,243400], [564900,243500], [564800,243600], [565000,243900], [565000,244000], [565100,244100], [564700,244300], [564700,244400], [564800,244500], [564700,244700], [564700,244900], [564500,245200], [564600,245300], [564500,245500], [564400,245400], [564100,245600], [564100,246000], [563800,246000], [564000,246800], [564100,246700], [564100,246800], [563600,247000], [563500,247000], [563700,247200], [563300,247400], [563300,247600], [563500,248000], [563500,248400], [563600,248800], [563700,249200], [564300,249400], [564100,249500], [564100,249700], [564800,249900], [565000,250000], [565000,250200], [564900,250300], [564900,250400], [564700,250500], [564700,250600], [565000,251200], [565500,251100], [565600,251500], [565600,252400], [565700,252600], [565600,253300], [565700,253600], [565500,254000], [565800,254100], [566000,254000], [566100,254100], [566300,254000], [566800,254000], [566900,254300], [566800,254500], [566900,254700], [567300,254600], [567200,255300], [567800,255600], [568200,255300], [568500,255300], [568900,255000], [569100,254500], [569500,255000], [569600,255000], [569600,254800], [569800,254800], [570200,254700], [570300,254800], [570500,254700], [570600,255000], [570300,255100], [570100,255300], [570200,255500], [570400,255500], [570400,255800], [570600,256000], [570600,256200], [570600,256600], [570600,257400], [570700,257600], [571000,258000], [570900,258100], [571100,258200], [571000,258400], [571100,259100], [571200,259100], [571100,259500], [571300,259700], [571400,260100], [571500,260100], [571500,260200], [571700,260200], [571700,261500], [571800,261800], [571300,262000], [570400,263000], [570000,262900], [569700,262500], [569800,262400], [569600,262200], [569200,262400], [569300,262500], [568800,263100], [568500,263000], [568000,263500], [567700,263900], [567300,263500], [566900,263200], [566100,264200], [566000,264200], [565700,264500], [565000,263900], [564000,263100], [563800,263000], [563000,262400], [562900,262200], [562600,261900], [562300,262300], [562100,262700], [561200,263800], [561100,264000], [560000,265300], [560000,265600], [559800,265900], [560100,266200], [560100,266300], [560500,266600], [560600,267000], [560700,267300], [560700,267500], [560500,267500], [561000,268200], [561100,268700], [560900,269200], [561000,269200], [561600,269100], [561700,268900], [562100,268800], [562300,268500], [562000,268300], [561800,268100], [561900,267900], [562300,267700], [562200,267500], [562300,267400], [562400,267600], [562700,267500], [562800,267600], [563500,267300], [563500,267100], [564000,266800], [565600,264600], [566000,264800], [567000,265300], [567500,265500], [567500,265600], [567900,265900], [568200,266000], [570400,266700], [570600,266800], [570400,267000], [570500,267100], [570300,267100], [570500,267400], [570400,267400], [570400,267600], [570300,267600], [570500,267700], [570600,268000], [570600,268100], [570600,268300], [570500,268300], [570500,268500], [570300,268500], [570200,268400], [570000,268500], [570000,268600], [569800,269000], [569700,269200], [569600,269300], [569500,269500], [569400,269700], [569200,269700], [569000,270000], [568600,270200], [568400,270500], [568200,270600], [568100,270600], [567900,270700], [567800,271000], [567700,271400], [567300,271500], [567200,271600], [567100,271500], [566900,271500], [566800,271600], [566500,271600], [566500,271500], [566200,271500], [565800,271400], [565600,272000], [565600,272300], [565300,272800], [566000,273400], [566100,273300], [566100,273600], [566200,273600], [566200,274200], [566300,274300], [566500,275100], [566000,275500], [565400,275600], [565300,275400], [564900,275400], [564900,275800], [564800,275900], [564800,276100], [564600,276200], [564400,276300], [564200,276300], [564000,276400], [564000,276600], [563000,278600], [562600,279400], [562300,280000], [562000,280600], [561600,281700], [561600,281700], [563000,282800], [564000,283500], [564500,283900], [565000,284100], [564800,284500], [565100,284600], [565200,284800], [565400,285100], [565600,285200], [565900,285300], [565900,285700], [566200,285700], [566300,286100], [566300,310100], [556900,310100], [556900,230000]
];
var bound6 = 
[
[565200,284800], [565100,285000], [564900,285500], [565000,285600], [564800,285800], [564800,286700], [565100,286800], [564800,287000], [564000,287500], [563600,287700], [563300,288000]
];
var bound7 = 
[
[564900,243500], [564800,243300], [564500,243200], [564300,243000], [564100,243000], [564000,242900], [563300,241700]
];
var bound8 = 
[
[587900,240600], [587000,240200], [586600,240100], [586300,240000], [586200,239900], [586200,239800], [586100,239600], [586000,239500], [585600,239000], [585500,239100], [585400,239000], [585300,239100], [585600,239300], [585800,239600], [586100,240000], [586000,240100], [585900,240200], [586000,240500], [586100,240600], [586100,240800], [585800,240900], [585500,241000], [585400,241100], [585200,241000], [585000,241400], [585000,241600], [585100,241900], [585100,242100], [585200,242100], [585200,242300], [585500,242200], [585900,242300], [586300,242400]
];
var bound9 = 
[
[570700,243900], [570500,244100], [570300,244300], [570200,244400], [569700,244500], [569700,244600], [569600,244700], [569400,244500], [569300,244600], [569300,244800], [569100,245000], [569000,244900], [568600,244800], [568500,244600], [568700,244500], [568700,244400], [568500,244500], [568400,244200], [568300,244200], [568300,243900], [568200,243900], [568100,244000], [568100,243900], [568000,243800], [567800,243900], [567800,244100], [567700,244000], [567600,243900], [567600,244100], [567700,244300], [567400,244200], [567400,244300], [567100,244300], [567100,244100], [566900,243900], [566500,243800]
];
var bound10 = 
[
[564900,263800], [565300,263400], [565400,262900], [565000,262700], [564700,262900], [563600,261800], [562900,262200]
];
var bound11 = [
[570600,268100], [571000,268100], [571000,268300], [570700,268600], [570400,268800], [569800,269300], [569500,269200]
];

var riv = 
[
[629000,241500], [629000,241500], [609200,255400], [629600,250500], [629600,250500], [620700,243200], [620700,243200], [649000,276900], [649000,276900], [637000,257300], [646400,298500], [642000,290000], [647500,269500], [646500,298500], [646000,267000], [609200,255600], [646000,267000], [646500,298500], [610200,272100], [607000,233000], [642000,290000], [615000,250000], [615000,250000], [615000,250000], [615000,250000], [615000,250000], [615000,250000], [588000,248000], [588000,248000], [588000,248000], [588000,248000], [634000,245000], [634000,245000], [634000,245000], [634000,245000], [634000,245000], [634000,245000], [617000,244000], [617800,246200], [648600,280200], [648600,280200], [648600,280200], [648600,280200], [648600,280200], [648600,280200], [620900,243800], [627400,243300], [627400,243300], [627400,243300], [629700,250400], [629700,250400], [629700,250400], [629700,250400], [629700,250400], [620900,243800], [617800,246200], [617800,246200], [625800,248300], [627400,251700], [636000,255000], [605600,240600], [605600,240600], [605600,240600], [605600,240600], [606000,249700], [606000,249700], [646800,267200], [646800,267200], [610900,249200], [610900,249200], [610900,249200], [610900,249200], [610900,249200], [620900,243800], [620900,243800], [634800,245700], [634800,245700], [620800,243200], [620800,243200], [620800,243200], [629600,250400], [629600,250400], [629600,250400], [647800,290700], [647800,290700], [647800,290700], [635800,250500], [635800,250500], [635800,250500], [635800,250500], [614000,240000], [617000,236000], [614000,240000], [620900,243800], [620800,243200], [620800,243200], [620800,243200], [567500,285300], [576700,286100], [636000,248000], [637000,256000], [572600,282500], [606000,243000], [610000,236000], [635000,247000], [610200,272100], [620800,243200], [620800,243200], [586000,261000], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [647000,268000], [647000,267000], [578000,280000], [647110,266980], [647110,266980], [628300,231700], [628300,231700], [613800,237400], [613800,237400], [635000,247000], [572800,282600], [640700,258000], [635000,247000], [620800,243200], [620800,243200], [620800,243200], [620800,243200], [620800,243200], [654700,295700], [647110,266980], [647110,266980], [647110,266980], [647110,266980], [647700,266000], [647700,266000], [647700,266000], [647700,266000], [646880,267120], [646880,267120], [623700,244600], [612200,248700], [580000,280000], [640000,300000], [610000,230000], [588600,240700], [628500,231500], [628500,231500], [622300,250400], [576800,286100], [576800,286100], [576800,286100], [609200,255400], [612300,240200], [635600,247300], [635600,247300], [646000,289000], [578800,271500], [620800,243200], [620800,243200], [620800,243200], [620800,243200], [609800,263300], [634600,241800], [647110,266980], [646880,267120], [634900,244400], [635400,244700], [635500,245000]
];

var smallriv = 
[
[646000,259000], [629000,241500], [629000,241500], [651300,282700], [651300,282700], [651300,282700], [651300,282700], [651300,282700], [651300,282700], [651300,282700], [651300,282700], [651300,282700], [651300,282700], [651300,282700], [651300,282700], [592000,277000], [592000,277000], [592000,277000], [650500,291900], [572300,276800], [576000,263000], [610200,272100], [620700,243200], [620700,243200], [582000,274000], [576000,263000], [587800,240800], [576000,263000], [641300,284600], [635600,290300], [642000,269300], [646200,263500], [610000,240000], [620900,243800], [620400,242600], [620400,242600], [620400,242600], [620400,242600], [648300,290300], [641300,286800], [578400,285400], [575000,272000], [646500,298500], [620000,243000], [620000,243000], [572700,282800], [598100,278900], [646000,267000], [609200,255600], [605000,279800], [605000,279800], [647200,297700], [601300,278800], [582500,273800], [580200,271300], [625800,248300], [608700,279100], [646000,267000], [642500,275600], [635600,290300], [588200,260300], [646500,298500], [613700,278300], [619000,244500], [614400,274500], [578000,278000], [639600,290400], [604400,279200], [646500,298500], [582000,275000], [586000,260000], [641200,286300], [583500,269200], [607000,233000], [617300,244500], [647500,261900], [614400,274500], [609100,255300], [601300,244600], [601300,244600], [610200,272100], [610200,272100], [610200,272100], [610200,272100], [614400,274500], [635600,290300], [617700,246300], [594800,280600], [594800,280600], [594800,280600], [594800,280600], [608000,234000], [608000,234000], [608000,234000], [608000,234000], [608000,234000], [608000,234000], [621100,243600], [621100,243600], [621100,243600], [618300,242900], [604900,241900], [604900,241900], [604900,241900], [604900,241900], [604900,241900], [604900,241900], [569800,277500], [569800,277500], [569800,277500], [569800,277500], [618300,242900], [620500,243500], [620500,243500], [581100,285200], [581100,285200], [581100,285200], [581100,285200], [618300,242900], [598000,278000], [598000,278000], [598000,278000], [598000,278000], [629600,250500], [629600,250500], [629600,250500], [629600,250500], [629600,250500], [573300,283500], [573300,283500], [573300,283500], [573300,283500], [594000,246000], [594000,246000], [594000,246000], [594000,246000], [594000,246000], [576000,284000], [575500,272500], [575500,272500], [575700,280200], [571000,282000], [573000,273000], [594600,280400], [646000,267000], [596000,280500], [636100,255300], [584500,259900], [584500,259900], [584500,259900], [584500,259900], [584500,259900], [620700,243200], [620700,243200], [640600,264800], [595200,280300], [647000,267000], [620900,243800], [636100,255300], [617800,246200], [581000,287000], [567800,277200], [567800,277200], [567800,277200], [614400,274500], [649000,274000], [601500,278800], [601500,278800], [601500,278800], [601500,278800], [601500,278800], [601500,278800], [620700,243200], [641300,286300], [575000,280000], [639600,290400], [620700,243200], [620700,243200], [596000,280500], [620900,243800], [594800,280200], [602300,260100], [602300,260100], [602300,260100], [602300,260100], [594600,280400], [583300,278700], [575000,273000], [575000,273000], [575000,273000], [594800,280200], [645000,266000], [646300,260100], [646300,260100], [646300,260100], [646300,260100], [646300,260100], [646300,260100], [579000,271000], [579000,271000], [579000,271000], [579000,271000], [579000,271000], [579000,271000], [620700,243200], [585000,280000], [585000,280000], [585000,280000], [595000,280000], [636000,255000], [588200,260300], [639600,290600], [573400,283500], [573400,283500], [582500,279400], [636000,255000], [620700,243200], [636000,248000], [636000,255000], [601500,278700], [601500,278700], [601500,278700], [601500,278700], [636000,255000], [647500,278800], [647500,278800], [642000,268000], [586500,245700], [647500,278700], [620700,243200], [608800,256600], [608800,256600], [567600,285500], [595500,280400], [620700,243200], [610500,239200], [610500,239200], [610500,239200], [610500,239200], [634700,264700], [646600,266600], [646600,266600], [646600,266600], [646600,266600], [573400,283500], [573400,283500], [573400,283500], [573400,283500], [610500,239200], [610500,239200], [610500,239200], [586200,281000], [586200,281000], [647800,290700], [647800,290700], [647800,290700], [626200,277300], [581000,287000], [581000,287000], [620800,243200], [620800,243200], [620800,243200], [595400,280200], [595400,280200], [595400,280200], [595400,280200], [595800,280400], [595800,280400], [594300,280300], [594300,280300], [594800,280200], [594800,280200], [595100,280200], [595100,280200], [595100,280200], [595100,280200], [635800,250500], [635800,250500], [635800,250500], [635800,250500], [604600,279300], [604600,279300], [604600,279300], [604300,279000], [604300,279000], [581300,287400], [581300,287400], [650200,277200], [590200,239300], [589400,244800], [589200,239900], [587900,241600], [588600,240700], [588600,240700], [588600,240700], [641300,284600], [639600,290600], [646800,267200], [646800,267200], [646800,267200], [646800,267200], [577000,263000], [588200,260300], [583300,278400], [614400,273700], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [620900,243800], [620900,243800], [614600,237500], [614600,237500], [614600,237500], [620800,243200], [620800,243200], [620800,243200], [620800,243200], [620800,243200], [620800,243200], [620800,243200], [619500,273000], [619500,273000], [586500,245700], [567500,285300], [633900,289300], [614400,273700], [614400,273700], [614400,273700], [614400,273700], [586000,261000], [626200,277300], [591900,265200], [591900,265200], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [634700,264700], [634700,264700], [637000,256000], [637000,256000], [649000,274000], [572600,282500], [623700,244600], [623700,244600], [588200,260300], [583300,278400], [588600,240700], [639600,290600], [592000,277000], [585000,279000], [570000,286000], [635000,247000], [644000,267000], [645800,271900], [644000,267000], [586000,281000], [635000,247000], [614400,274500], [599400,279200], [599400,279200], [595100,280500], [614400,273700], [614400,273700], [587000,282000], [620800,243200], [620800,243200], [650200,277200], [635900,255200], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [576700,286100], [586000,281000], [587000,282000], [602600,278700], [583300,278400], [588200,260300], [578000,280000], [578000,280000], [578000,280000], [647110,266980], [588600,240700], [593100,235300], [572800,282600], [572800,282600], [572800,282600], [583300,272900], [586800,281800], [648800,303700], [583300,272900], [649700,279100], [570400,286200], [598000,278000], [644000,267000], [649300,274300], [633500,238000], [634700,264700], [634700,264700], [634700,264700], [641300,284600], [639600,290600], [648000,290000], [600000,250000], [642500,287200], [620800,243200], [620800,243200], [620800,243200], [620800,243200], [620800,243200], [620800,243200], [620800,243200], [620800,243200], [620800,243200], [620800,243200], [620800,243200], [620800,243200], [620800,243200], [620800,243200], [620800,243200], [637500,270500], [646000,266000], [576000,273000], [610200,272100], [614400,273700], [614400,273700], [614400,273700], [614400,273700], [614400,273700], [614400,273700], [614400,273700], [614400,273700], [614400,273700], [614400,273700], [614400,273700], [614400,273700], [650600,293000], [634900,244400], [620800,243200], [587000,261000], [588200,260300], [576000,276000], [620800,243200], [647600,268500], [650200,277200], [646880,267120], [646880,267120], [646880,267120], [576000,263000], [612200,248700], [586900,281900], [586900,281900], [586900,281900], [610000,240000], [610000,240000], [570000,270000], [599400,279200], [579500,280300], [588600,240700], [628500,231500], [628500,231500], [628500,231500], [628500,231500], [576800,286100], [576800,286100], [576800,286100], [576800,286100], [576800,286100], [576800,286100], [576800,286100], [576800,286100], [576800,286100], [576800,286100], [576800,286100], [576800,286100], [576800,286100], [568000,285000], [618300,242900], [604200,278800], [646200,267000], [618300,242900], [646000,289000], [633900,289300], [634100,246900], [602500,278700], [578800,271500], [620800,243200], [620800,243200], [620800,243200], [620800,243200], [620800,243200], [614400,273700], [614400,273700], [614400,273700], [614400,273700], [614400,273700], [614400,273700], [614400,273700], [614400,273700], [614400,273700], [614400,273700], [614400,273700], [614400,273700], [614400,273700], [614400,273700], [614400,273700], [614400,273700], [646880,267120], [647200,267100], [647200,267100], [646880,267120], [647200,267100], [646880,267120], [645000,269000], [645000,269000], [645000,269000], [645000,269000], [644600,267400], [644600,267400], [644600,267400], [644600,267400], [596400,271100], [588200,260300], [589000,279000], [633900,289300], [571000,286000], [635400,244700], [634700,264700], [634700,264700]
];

function showMap()
{
	OpenLayers.Renderer.SVG.prototype.supported = function() {
        var svgFeature = "http://www.w3.org/TR/SVG11/feature#";
        return (document.implementation &&
           (document.implementation.hasFeature("org.w3c.svg", "1.0") ||
            document.implementation.hasFeature(svgFeature + "SVG", "1.1") ||
            document.implementation.hasFeature(svgFeature + "BasicStructure", "1.1") ));
};

/*         var controls = [
                         new OpenSpace.Control.CopyrightCollection(),
                         new OpenLayers.Control.Navigation(),
			 ];*/
  
	var options = {
		resolutions: [200,100,50,25,10,5], 
//		resolutions: [500,200,100,50,25,10,5,2,1], 
	restrictedExtent: new OpenSpace.MapBounds(545000, 225000, 670000, 310000)};
    osMap = new OpenSpace.Map('map', options);
	osMap.setCenter(new OpenSpace.MapPoint(605500, 258500), 0);
	var vectorLayer = new OpenLayers.Layer.Vector("Vector Layer");
	osMap.addLayer(vectorLayer);
	addTenKmGridList(vectorLayer, tenkmList);
	addBoundary(vectorLayer, bound1);
 	addBoundary(vectorLayer, bound2);
 	addBoundary(vectorLayer, bound3);
 	addBoundary(vectorLayer, bound4);
 	addBoundary(vectorLayer, bound5);
	var tetradPoints = truncatePoints(tetradList, 2000);
	addTetradCircleList(vectorLayer, tetradPoints);
}

function truncatePoints(list, resolution)
{
	var points = new Array();
	for (var i = 0; i < list.length; i++)
	{
		var x = list[i][0] - (list[i][0] % resolution);
		var y = list[i][1] - (list[i][1] % resolution);
		points[x + ',' + y] = [x,y,list[i][2]];
	}
	var newpoints = new Array();
	for (var i in points)
	{
		newpoints.push(points[i]);
	}
	return newpoints;
}
function addBoundary(vectorLayer, list)
{
	var points = new Array();

	for (var i = 0; i < list.length; i++)
	{
		var point = new OpenLayers.Geometry.Point(list[i][0], list[i][1]);
		points.push(point);
	}
	/*
	* Define polygon style
	*/
	var style_green =
	{
		strokeColor: "#000000",
		strokeOpacity: 0,
		strokeWidth: 2,
		fillColor: "#000000",
		fillOpacity: 0.4
	};
	// create a polygon feature from a list of points
	var linearRing = new OpenLayers.Geometry.LinearRing(points);
	var polygonFeature = new OpenLayers.Feature.Vector(linearRing, null, style_green);
	vectorLayer.addFeatures([polygonFeature]);
}

function addTetradList(vectorLayer, list, fillColor)
{
	for (var i = 0; i < list.length; i++)
	{
		addTetrad(vectorLayer, list[i][0], list[i][1], fillColor);
	}
}
function addTetrad(vectorLayer, left, bottom, fillColor)
{
	left -= left % 2000;
	bottom -= bottom % 2000;
	var right = left + 2000;
	var top = bottom + 2000;
	/*
	* Define polygon style
	*/
	var style_green =
	{
		strokeColor: "#000000",
		strokeOpacity: 1,
		strokeWidth: 2,
		fillColor: fillColor,
		fillOpacity: 0.6
	};
	// Define polygon area
	var points = new Array();
	points[0] = new OpenLayers.Geometry.Point(left, top);
	points[1] = new OpenLayers.Geometry.Point(right, top);
	points[2] = new OpenLayers.Geometry.Point(right, bottom);
	points[3] = new OpenLayers.Geometry.Point(left, bottom);
	// create a polygon feature from a list of points
	var linearRing = new OpenLayers.Geometry.LinearRing(points);
	var polygonFeature = new OpenLayers.Feature.Vector(linearRing, null, style_green);
	vectorLayer.addFeatures([polygonFeature]);
}

function convertIndexToColour(index)
{
	if (index < 10)
	{
		return '#FFFF00';
	}
	if (index < 20)
	{
			return '#FF6600';
	}
	return '#FF0000';
}

function addTetradCircleList(vectorLayer, list)
{
	for (var i = 0; i < list.length; i++)
	{
		var fillColor = convertIndexToColour(list[i][2]);
		addTetradCircle(vectorLayer, list[i][0], list[i][1], fillColor);
	}
}
function addTetradCircle(vectorLayer, left, bottom, fillColor)
{
	left -= left % 2000;
	bottom -= bottom % 2000;
	var x = left + 1000;
	var y = bottom + 1000;
	fillColor = (fillColor != null) ? fillColor : '#00FF00';
	
	/*
	* Define polygon style
	*/
	var style_green =
	{
		strokeColor: "#000000",
		strokeOpacity: 1,
		strokeWidth: 2,
		fillColor: fillColor,
		fillOpacity: 0.6
	};
	// Define polygon area
	var origin = new OpenLayers.Geometry.Point(x, y);
	// create a polygon feature from a list of points
	var circle = OpenLayers.Geometry.Polygon.createRegularPolygon(origin, 1000, 30, 0);
	var polygonFeature = new OpenLayers.Feature.Vector(circle, null, style_green);
	vectorLayer.addFeatures([polygonFeature]);
}

function addTenKmGridList(vectorLayer, list)
{
	for (var i = 0; i < list.length; i++)
	{
		addTenKmGridSquare(vectorLayer, list[i][0], list[i][1]);
	}
}

function addTenKmGridSquare(vectorLayer, left, bottom)
{
	left -= left % 10000;
	bottom -= bottom % 10000;
	var right = left + 10000;
	var top = bottom + 10000;
	/*
	* Define polygon style
	*/
	var style_black =
	{
		strokeColor: "#000000",
		strokeOpacity: 1,
		strokeWidth: 1,
		fillOpacity: 0.0001
	};
	// Define polygon area
	var points = new Array();
	points[0] = new OpenLayers.Geometry.Point(left, top);
	points[1] = new OpenLayers.Geometry.Point(right, top);
	points[2] = new OpenLayers.Geometry.Point(right, bottom);
	points[3] = new OpenLayers.Geometry.Point(left, bottom);
	// create a polygon feature from a list of points
	var linearRing = new OpenLayers.Geometry.LinearRing(points);
	var polygonFeature = new OpenLayers.Feature.Vector(linearRing, null, style_black);
	vectorLayer.addFeatures([polygonFeature]);

}

function addTenKmGreyList(vectorLayer, list)
{
	for (var i = 0; i < list.length; i++)
	{
		addTenKmGreySquare(vectorLayer, list[i][0], list[i][1]);
	}
}

function addTenKmGreySquare(vectorLayer, left, bottom)
{
	var right = left + 10000;
	var top = bottom + 10000;
	/*
	* Define polygon style
	*/
	var style_black =
	{
		strokeColor: "#000000",
		strokeOpacity: 0.4,
		strokeWidth: 1,
		fillColor: "#000000",
		fillOpacity: 0.4
	};
	// Define polygon area
	var points = new Array();
	points[0] = new OpenLayers.Geometry.Point(left, top);
	points[1] = new OpenLayers.Geometry.Point(right, top);
	points[2] = new OpenLayers.Geometry.Point(right, bottom);
	points[3] = new OpenLayers.Geometry.Point(left, bottom);
	// create a polygon feature from a list of points
	var linearRing = new OpenLayers.Geometry.LinearRing(points);
	var polygonFeature = new OpenLayers.Feature.Vector(linearRing, null, style_black);
	vectorLayer.addFeatures([polygonFeature]);

}

function addTenKmShadedList(vectorLayer, list, fillColor)
{
	for (var i = 0; i < list.length; i++)
	{
		addTenKmShaded(vectorLayer, list[i][0], list[i][1], fillColor);
	}
}

function addTenKmShaded(vectorLayer, left, bottom, fillColor)
{
	var right = left + 10000;
	var top = bottom + 10000;
	/*
	* Define polygon style
	*/
	var style_black =
	{
		strokeColor: "#000000",
		strokeOpacity: 0.4,
		strokeWidth: 1,
		fillColor: fillColor,
		fillOpacity: 0.4
	};
	// Define polygon area
	var points = new Array();
	points[0] = new OpenLayers.Geometry.Point(left, top);
	points[1] = new OpenLayers.Geometry.Point(right, top);
	points[2] = new OpenLayers.Geometry.Point(right, bottom);
	points[3] = new OpenLayers.Geometry.Point(left, bottom);
	// create a polygon feature from a list of points
	var linearRing = new OpenLayers.Geometry.LinearRing(points);
	var polygonFeature = new OpenLayers.Feature.Vector(linearRing, null, style_black);
	vectorLayer.addFeatures([polygonFeature]);

}
