{"version":3,"sources":["timeago.js","jquery.cookie.js","MHRLGeneral.js","riversCommon.js","MHRLReadings.js","rivers.js","OSOpenspace.js"],"names":["$","timeago","timestamp","Date","inWords","parse","datetime","$t","refresh","data","element","text","trim","length","attr","prepareData","this","isNaN","date","getTime","extend","settings","refreshMillis","allowFuture","strings","prefixAgo","prefixFromNow","suffixAgo","suffixFromNow","seconds","minute","minutes","hour","hours","day","days","month","months","year","years","wordSeparator","numbers","distanceMillis","$l","prefix","suffix","Math","abs","substitute","stringOrFunction","number","string","isFunction","value","replace","words","round","floor","join","iso8601","s","elem","get","tagName","toLowerCase","fn","self","each","$s","setInterval","document","createElement","jQuery","factory","define","amd","pluses","encode","config","raw","encodeURIComponent","read","converter","indexOf","slice","decodeURIComponent","e","json","JSON","parseCookieValue","cookie","key","options","t","undefined","defaults","expires","setDate","getDate","stringify","String","toUTCString","path","domain","secure","result","cookies","split","i","l","parts","name","shift","removeCookie","sEntityFave","iEntityLastSelect","sUnits","iCurrentEntity","iCurrentGraph","linesLayer","vectorLayer","markerLayer","points","lineFeature","lineString","routeMarkersLayer","routepos","routesize","routeoffset","routeicon","iTimerEntityHighlight","iTimerRSHighlight","sReferenceData","sDynamicData","mapLatlng","map","mapOptions","layerListeners","Entitystyle","RSstyle","Polystyle","EntityLayer","selEntityLayer","RSLayer","VectorLayer","iCurrentStatsEntity","BAR_DELIMITER","ANGLE_BRACKET_LEFT","ANGLE_BRACKET_RIGHT","QCOOKIE_DO_NOT_EXPIRE","toDateString","COOKIE_DO_NOT_EXPIRE","COOKIE_ENTITY_FAVE","COOKIE_GL_OFF","COOKIE_MAP_TYPE","COOKIE_UNITS","COOKIE_COOKIE_NOTE","COOKIE_GENERAL_NOTE","COOKIE_WE_USE_COOKIES_NOTE","COOKIE_DG","COOKIE_ENTITY_LAST_SELECT","COOKIE_ENTITY_DEBUG_ON","COOKIE_DEFAULT_CENTRE_LAT","COOKIE_DEFAULT_CENTRE_LNG","COOKIE_DEFAULT_ZOOM","bEntitiesOn","bRSMarkersOn","iDefaultZoomLevel","Consts","MetricImpFactor","sMAP_TYPE_GOOGLE","sMAP_TYPE_OS","sENTITY_TAG","sFAV_ENTITY_TAG","sENTITY_SEARCH_START_MS","sENTITY_HIGHLIGHT_TIME_MS","sPOLY_COLOUR_WITH_FOCUS","sIMG_ROOT","HL_On","HL_Off","EntityNumOffset","NotDefined","READING_DECIMALS","LCD","sFEET_SINGLE_INDICATOR_WORDS","sINCHES_SINGLE_INDICATOR_WORDS","sFEET_PLURAL_INDICATOR_WORDS","sINCHES_PLURAL_INDICATOR_WORDS","sFEET_SINGLE_INDICATOR_SYMBOLS","sINCHES_SINGLE_INDICATOR_SYMBOLS","sFEET_PLURAL_INDICATOR_SYMBOLS","sINCHES_PLURAL_INDICATOR_SYMBOLS","bREADING_IN_WORDS","sUNIT_CODE_METRIC","sUNIT_CODE_IMPERIAL","sUNIT_CODE_SWITCH_TO_METRIC","sUNIT_CODE_SWITCH_TO_IMPERIAL","sTO_UNIT_CODE","sDELIMITER_BAR","sSPACE","iRIVER_LINK_LEN","sCLASS_ROOT_SPATE_LEVEL","sSTATE_TREND_RISING_CODE","sSTATE_TREND_FALLING_CODE","sSTATE_TREND_STEADY_CODE","sSTATE_TREND_CHANGING_CODE","sSTATE_TREND_NOT_AVAILABLE","sSTATE_TREND_RISING_DESCRIPTION","sSTATE_TREND_FALLING_DESCRIPTION","sSTATE_TREND_STEADY_DESCRIPTION","sSTATE_TREND_CHANGING_DESCRIPTION","sSTATE_TREND_UNKNOWN_DESCRIPTION","sSTATE_LEVEL_ABOVE_CODE","sSTATE_LEVEL_BELOW_CODE","sSTATE_LEVEL_NORMAL_CODE","sSTATE_LEVEL_ABOVE_DESCRIPTION","sSTATE_LEVEL_BELOW_DESCRIPTION","sSTATE_LEVEL_NORMAL_DESCRIPTION","sSTATE_LEVEL_UNKNOWN_DESCRIPTION","sFILE_TYPE_PNG","arrEntityMarker","Array","arrRSMarker","arrEntityLatLng","arrRSLatLng","arrPolyLatLngPoints","arrPolyLines","arrPolyFeature","arrEntityImages","arrEntityRSImages","iPrevEntityNum","iEntityHighlightOff","iPrevRSNum","GetFocusChar","Focus","GetEntityLevelTrendImageName","EMnemonic","GraphicPerEntity","GetRSLevelTrendImageName","RSIndex","ConvertColourNum","ColourCode","ReturnCode","StringExtractDelimitedSubstring","TargetString","LeftDelim","RightDelim","LeftOffset","RightOffset","ReturnString","substring","exception","CookieAddValue","CookieName","CookieString","TheValue","console","log","toString","CookieRemoveValue","StringContainsDelimitedValue","theString","CookieContainsDelimitedValue","GetEntityRSCookieName","Entity","ReadingStation","GetNextDelimitedValue","delimiter","iOffset","substr","GetTrendState","TrendCode","GetLevelState","LevelCode","GetLevelDetails","SourceLevel","SourceLevelImp","SourceLevelPC","RiseFallState","StateColourVal","ToUnitCode","arrReturnArray","push","sStateTrend","sStateImg","EntityMarkerToggle","ilimit","GOOGLE_ON","setOptions","visible","OS_ON","display","RSMarkerToggle","j","jlimit","SetMapCentreAndZoom","UseMap","UseMapCentreLat","UseMapCentreLng","UseMapZoom","SetOptionsOnly","Object","MAPS_ON","google","maps","LatLng","OpenLayers","LonLat","parseInt","setCenter","SaveMapCentreAndZoom","mapCentre","mapZoom","lat","lng","getCenter","getZoom","lon","SetMapCentreAndZoomToDefault","DefMapCentreLat","mapType","defaultZoom","DefMapCentreLng","DefMapZoom","SetLocalMapCentreAndZoom","EntityIndex","thisEntity","EmptyStringIfNull","sString","ZeroIfNull","ClassGetRSStateColourVal","RSData","ClassGetEntityStateColourVal","GetMHRLDate","dateString","myHours","getHours","myMinutes","getMinutes","mySeconds","getSeconds","myDayNo","myAMPM","myDate","getDay","getMonth","getFullYear","GetFullMHRLDate","Format","LogTime","getMilliseconds","TimedConsoleLog","msg","myBarChart","currentChartFilename","currentGraphLink","currentUnits","graphOptions","searchTimer","FavouritesHTML","workerFave","workerSearch","iDefaultStrokeWidth","bLabellingAllRivers","bLabellingSelected","bFavouritesOn","bStartupComplete","MarkFavourite","thisElement","thisMnemonic","next","thisPtr","addClass","removeClass","DisplayPolyLines","thisReferenceEntry","thisDynamicEntry","thisRefRSData","thisEntityImagePlain","thisEntityImageFocus","thisRSImagePlain","thisRSImageFocus","thisPolyListArray","SHOW_MAP_ENT","Marker","position","label","title","setMap","Feature","Vector","Geometry","Point","lbl","EntityID","addFeatures","sRiverTag","event","addListener","EntityMouseover","SHOW_STATS","ShowDefaultGraph","SHOW_MAP_RS","icon","RSFocus","RSMarkerClick","size","Size","offset","Pixel","Icon","addMarker","events","register","k","klimit","llimit","Polyline","strokeColor","strokeOpacity","clickable","strokeWeight","ShowAllRSTextAlertSamples","LineString","PolySegNo","PolySeg","attributes","thisSample","iRSCount","SHOW_TEXT_SAMPLES","html","empty","append","random","toFixed","ShowRSSample","EntandMnemonic","TextAlertFocus","theLoc","GetRandomRSIndex","useLimit","useIndex","HighlightOn","sTagName","clearTimeout","setTimeout","HighlightRSMarker","ForceRSResetTimeout","RSStateDescription","sRSState","ShowEntityStats","EntityNum","bForceRefresh","arrLevelDetails","iIndex","entryIndex","entry","html_str","thisColourVal","pop","height","ToggleUnits","SetToUnits","ShowGraph","SetUnits","doSetOnly","GetGraphImperialUnits","svrData","theMetricMin","ticks","min","theMetricMax","max","theMin","theMax","theStepSize","stepSize","datasets","SetGraphLegendClickHandler","SetGraphDefaults","Chart","global","defaultFontColor","defaultFontSize","elements","line","borderWidth","fill","tension","point","pointRadius","radius","pointHitRadius","pointBorderColor","pointBackgroundColor","pointBorderWidth","pointHoverRadius","pointHoverBackgroundColor","pointHoverBorderColor","pointHoverBorderWidth","hover","intersect","legend","onClick","maintainAspectRatio","animation","duration","apply","arguments","cookieName","index","datasetIndex","ci","chart","getDatasetMeta","hidden","update","onHover","legendItem","getElementById","style","cursor","onLeave","plugins","colorschemes","scheme","scales","yAxes","scaleLabel","labelString","fontSize","xAxes","type","distribution","time","unit","tooltips","callbacks","tooltipItem","yLabel","ConvertToUnits","ToolTipDate","xLabel","labelColor","meta","controller","_config","backgroundColor","DrawMHRLChart","GraphLink","labels","lineOffCookie","cfgName","precision","location","hash","window","pageYOffset","fileName","val","children","getJSON","done","show","fail","hide","iGraph","SetEntityListHighlight","TryThis","prompt","TryThis2","polyFeature","getFeaturesByAttribute","redraw","eFeature","renderIntent","MarkEntityElements","useZIndex","thisPolyColourArray","EntityImg","objPolyColour","OSRenderIntent","setIcon","setVisible","strokeWidth","setUrl","ShowHideEntityRSMarkers","ShowMarkers","HideMarkers","removeAllFeatures","ShowHideEntities","ShowHideAll","ShowHideSelected","setVisibility","ForceEntityResetTimeout","iTimerID","ShowCookieNote","setTime","cookieErr","SetPolyWidths","useWidth","features","ShowHelp","expiresAt","updateTwitterValues","share_url","twttr","widgets","load","setTitleAndLinks","thisName","LocTitle","setFBUrl","url","sUrl","setAttribute","LLtoNE","deg2rad","PI","phi","lam","a","b","e0","n0","f0","e2","lam0","phi0","af0","bf0","slat2","sin","nu","sqrt","rho","eta2","p","IV","cos","clat3","pow","tlat2","tan","V","clat5","tlat4","VI","east","I","Marc","II","III","IIIA","north","nstr","estr","sSourceLevel","sFromUnitCode","sToUnitCode","sReturnString","sInchesFraction","iVal2","iValNumerator","iValDenominator","bContinue","fToValue","sFEET_SINGLE_INDICATOR","sFEET_PLURAL_INDICATOR","sINCHES_SINGLE_INDICATOR","sINCHES_PLURAL_INDICATOR","iFeet","iVal","sInches","sInchesFractionFinal","err","message","timeAgo","date_time","reference_date","diffTime","DoSaveMapCentreAndZoom","Layer","OSOpenSpace","Class","WMS","FOO","serverResolutions","bounds","osUrl","format","projection","osTileSize","initialize","apiKey","params","Error","Projection","Bounds","newOptions","Util","maxExtent","resolutions","units","attribution","authParams","KEY","URL","newArguments","prototype","getFullRequestString","newParams","altUrl","LAYERS","initGriddedTiles","res","getResolution","equals","tileSize","clearGrid","CLASS_NAME","ready","FilterEntities","useSearch","searchTitle","upTo","search","toUpperCase","Worker","addEventListener","error","postMessage","entityList","fullEntityList","entitySearch","entityCookie","FavouritesSetupAndChange","SetFavouritesButtonVisibility","cookieFave","prop","scrollTo","on","parent","thisLocation","hasClass","$liItemIDAttr","$liItemIDIndexStart","$liItemID","AUTO_MAP","$trItemIDAttr","$trItemIDIndexStart","$trItemID","slideDown","parents","eq","slideUp","find","iGraphType","is","ctx","getContext","streetViewControl","scrollwheel","zoom","center","mapTypeId","MapTypeId","HYBRID","featureclick","OSlogit","object","feature","id","nofeatureclick","StyleMap","default","applyDefaults","select","styleMap","visibility","eventListeners","Markers","mapOptionsOld","Map","OSHQ","WGS84","OSGB","layer","div","allOverlays","layers","featureover","drawFeature","featureout","addLayer","filenameRef","favTrigger","iDefaultEntry","bRiverLocationMatch","bRiverMatch","DfltMne","DfltLoc","RLerr","filenameDyn","sFaveWorkList","sNextFave","debugging"],"mappings":"CAeA,SAAAA,GACAA,EAAAC,QAAA,SAAAC,GACA,OAAAA,aAAAC,KACAC,EAAAF,GAEAE,EADA,iBAAAF,EACAF,EAAAC,QAAAI,MAAAH,GAEAF,EAAAC,QAAAK,SAAAJ,KAGA,IAAAK,EAAAP,EAAAC,QA0FA,SAAAO,IACA,IAAAC,EAOA,SAAAC,GAEA,CAAA,IAEAC,GAHAD,EAAAV,EAAAU,IACAD,KAAA,aACAC,EAAAD,KAAA,UAAA,CAAAH,SAAAC,EAAAD,SAAAI,KAEA,GADAC,EAAAX,EAAAY,KAAAF,EAAAC,SACAE,QACAH,EAAAI,KAAA,QAAAH,IAGA,OAAAD,EAAAD,KAAA,WAhBAM,CAAAC,MAIA,OAHAC,MAAAR,EAAAH,WACAN,EAAAgB,MAAAL,KAAAP,EAAAK,EAAAH,WAEAU,KAeA,SAAAZ,EAAAc,GACA,OAAAX,EAAAH,SAGAc,EAHAA,GAIA,IAAAf,MAAAgB,UAAAD,EAAAC,YAjHAnB,EAAAoB,OAAApB,EAAAC,QAAA,CACAoB,SAAA,CACAC,cAAA,IACAC,aAAA,EACAC,QAAA,CACAC,UAAA,KACAC,cAAA,KACAC,UAAA,MACAC,cAAA,WACAC,Q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A,IAAAtiB,QAAAC,MAAAD,QAAAC,IAAA","file":"rm.min.js","sourcesContent":["/**\r\n * Timeago is a jQuery plugin that makes it easy to support automatically\r\n * updating fuzzy timestamps (e.g. \"4 minutes ago\" or \"about 1 day ago\").\r\n *\r\n * @name timeago\r\n * @version 0.10.1\r\n * @requires jQuery v1.2.3+\r\n * @author Ryan McGeary\r\n * @license MIT License - http://www.opensource.org/licenses/mit-license.php\r\n *\r\n * For usage and examples, visit:\r\n * http://timeago.yarp.com/\r\n *\r\n * Copyright (c) 2008-2011, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org)\r\n */\r\n(function($) {\r\n $.timeago = function(timestamp) {\r\n if (timestamp instanceof Date) {\r\n return inWords(timestamp);\r\n } else if (typeof timestamp === \"string\") {\r\n return inWords($.timeago.parse(timestamp));\r\n } else {\r\n return inWords($.timeago.datetime(timestamp));\r\n }\r\n };\r\n var $t = $.timeago;\r\n\r\n $.extend($.timeago, {\r\n settings: {\r\n refreshMillis: 60000,\r\n allowFuture: false,\r\n strings: {\r\n prefixAgo: null,\r\n prefixFromNow: null,\r\n suffixAgo: \"ago\",\r\n suffixFromNow: \"from now\",\r\n seconds: \"less than a minute\",\r\n minute: \"about a minute\",\r\n minutes: \"%d minutes\",\r\n hour: \"about an hour\",\r\n hours: \"about %d hours\",\r\n day: \"a day\",\r\n days: \"%d days\",\r\n month: \"about a month\",\r\n months: \"%d months\",\r\n year: \"about a year\",\r\n years: \"%d years\",\r\n wordSeparator: \" \",\r\n numbers: []\r\n }\r\n },\r\n inWords: function(distanceMillis) {\r\n var $l = this.settings.strings;\r\n var prefix = $l.prefixAgo;\r\n var suffix = $l.suffixAgo;\r\n if (this.settings.allowFuture) {\r\n if (distanceMillis < 0) {\r\n prefix = $l.prefixFromNow;\r\n suffix = $l.suffixFromNow;\r\n }\r\n }\r\n\r\n var seconds = Math.abs(distanceMillis) / 1000;\r\n var minutes = seconds / 60;\r\n var hours = minutes / 60;\r\n var days = hours / 24;\r\n var years = days / 365;\r\n\r\n function substitute(stringOrFunction, number) {\r\n var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction;\r\n var value = ($l.numbers && $l.numbers[number]) || number;\r\n return string.replace(/%d/i, value);\r\n }\r\n\r\n var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) ||\r\n seconds < 90 && substitute($l.minute, 1) ||\r\n minutes < 45 && substitute($l.minutes, Math.round(minutes)) ||\r\n minutes < 90 && substitute($l.hour, 1) ||\r\n hours < 24 && substitute($l.hours, Math.round(hours)) ||\r\n hours < 48 && substitute($l.day, 1) ||\r\n days < 30 && substitute($l.days, Math.floor(days)) ||\r\n days < 60 && substitute($l.month, 1) ||\r\n days < 365 && substitute($l.months, Math.floor(days / 30)) ||\r\n years < 2 && substitute($l.year, 1) ||\r\n substitute($l.years, Math.floor(years));\r\n\r\n return $.trim([prefix, words, suffix].join($l.wordSeparator));\r\n },\r\n parse: function(iso8601) {\r\n var s = $.trim(iso8601);\r\n s = s.replace(/\\.\\d\\d\\d+/,\"\"); // remove milliseconds\r\n s = s.replace(/-/,\"/\").replace(/-/,\"/\");\r\n s = s.replace(/T/,\" \").replace(/Z/,\" UTC\");\r\n s = s.replace(/([\\+\\-]\\d\\d)\\:?(\\d\\d)/,\" $1$2\"); // -04:00 -> -0400\r\n return new Date(s);\r\n },\r\n datetime: function(elem) {\r\n // jQuery's `is()` doesn't play well with HTML5 in IE\r\n var isTime = $(elem).get(0).tagName.toLowerCase() === \"time\"; // $(elem).is(\"time\");\r\n var iso8601 = isTime ? $(elem).attr(\"datetime\") : $(elem).attr(\"title\");\r\n return $t.parse(iso8601);\r\n }\r\n });\r\n\r\n $.fn.timeago = function() {\r\n var self = this;\r\n self.each(refresh);\r\n\r\n var $s = $t.settings;\r\n if ($s.refreshMillis > 0) {\r\n setInterval(function() { self.each(refresh); }, $s.refreshMillis);\r\n }\r\n return self;\r\n };\r\n\r\n function refresh() {\r\n var data = prepareData(this);\r\n if (!isNaN(data.datetime)) {\r\n $(this).text(inWords(data.datetime));\r\n }\r\n return this;\r\n }\r\n\r\n function prepareData(element) {\r\n element = $(element);\r\n if (!element.data(\"timeago\")) {\r\n element.data(\"timeago\", { datetime: $t.datetime(element) });\r\n var text = $.trim(element.text());\r\n if (text.length > 0) {\r\n element.attr(\"title\", text);\r\n }\r\n }\r\n return element.data(\"timeago\");\r\n }\r\n\r\n function inWords(date) {\r\n return $t.inWords(distance(date));\r\n }\r\n\r\n function distance(date) {\r\n return (new Date().getTime() - date.getTime());\r\n }\r\n\r\n // fix for IE6 suckage\r\n document.createElement(\"abbr\");\r\n document.createElement(\"time\");\r\n}(jQuery));\r\n","/*!\r\n * jQuery Cookie Plugin v1.4.0\r\n * https://github.com/carhartl/jquery-cookie\r\n *\r\n * Copyright 2013 Klaus Hartl\r\n * Released under the MIT license\r\n */\r\n(function (factory) {\r\n\tif (typeof define === 'function' && define.amd) {\r\n\t\t// AMD. Register as anonymous module.\r\n\t\tdefine(['jquery'], factory);\r\n\t} else {\r\n\t\t// Browser globals.\r\n\t\tfactory(jQuery);\r\n\t}\r\n}(function ($) {\r\n\r\n\tvar pluses = /\\+/g;\r\n\r\n\tfunction encode(s) {\r\n\t\treturn config.raw ? s : encodeURIComponent(s);\r\n\t}\r\n\r\n\tfunction decode(s) {\r\n\t\treturn config.raw ? s : decodeURIComponent(s);\r\n\t}\r\n\r\n\tfunction stringifyCookieValue(value) {\r\n\t\treturn encode(config.json ? JSON.stringify(value) : String(value));\r\n\t}\r\n\r\n\tfunction parseCookieValue(s) {\r\n\t\tif (s.indexOf('\"') === 0) {\r\n\t\t\t// This is a quoted cookie as according to RFC2068, unescape...\r\n\t\t\ts = s.slice(1, -1).replace(/\\\\\"/g, '\"').replace(/\\\\\\\\/g, '\\\\');\r\n\t\t}\r\n\r\n\t\ttry {\r\n\t\t\t// Replace server-side written pluses with spaces.\r\n\t\t\t// If we can't decode the cookie, ignore it, it's unusable.\r\n\t\t\ts = decodeURIComponent(s.replace(pluses, ' '));\r\n\t\t} catch(e) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\ttry {\r\n\t\t\t// If we can't parse the cookie, ignore it, it's unusable.\r\n\t\t\treturn config.json ? JSON.parse(s) : s;\r\n\t\t} catch(e) {}\r\n\t}\r\n\r\n\tfunction read(s, converter) {\r\n\t\tvar value = config.raw ? s : parseCookieValue(s);\r\n\t\treturn $.isFunction(converter) ? converter(value) : value;\r\n\t}\r\n\r\n\tvar config = $.cookie = function (key, value, options) {\r\n\r\n\t\t// Write\r\n\t\tif (value !== undefined && !$.isFunction(value)) {\r\n\t\t\toptions = $.extend({}, config.defaults, options);\r\n\r\n\t\t\tif (typeof options.expires === 'number') {\r\n\t\t\t\tvar days = options.expires, t = options.expires = new Date();\r\n\t\t\t\tt.setDate(t.getDate() + days);\r\n\t\t\t}\r\n\r\n\t\t\treturn (document.cookie = [\r\n\t\t\t\tencode(key), '=', stringifyCookieValue(value),\r\n\t\t\t\toptions.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE\r\n\t\t\t\toptions.path ? '; path=' + options.path : '',\r\n\t\t\t\toptions.domain ? '; domain=' + options.domain : '',\r\n\t\t\t\toptions.secure ? '; secure' : ''\r\n\t\t\t].join(''));\r\n\t\t}\r\n\r\n\t\t// Read\r\n\r\n\t\tvar result = key ? undefined : {};\r\n\r\n\t\t// To prevent the for loop in the first place assign an empty array\r\n\t\t// in case there are no cookies at all. Also prevents odd result when\r\n\t\t// calling $.cookie().\r\n\t\tvar cookies = document.cookie ? document.cookie.split('; ') : [];\r\n\r\n\t\tfor (var i = 0, l = cookies.length; i < l; i++) {\r\n\t\t\tvar parts = cookies[i].split('=');\r\n\t\t\tvar name = decode(parts.shift());\r\n\t\t\tvar cookie = parts.join('=');\r\n\r\n\t\t\tif (key && key === name) {\r\n\t\t\t\t// If second argument (value) is a function it's a converter...\r\n\t\t\t\tresult = read(cookie, value);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\t// Prevent storing a cookie that we couldn't decode.\r\n\t\t\tif (!key && (cookie = read(cookie)) !== undefined) {\r\n\t\t\t\tresult[name] = cookie;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\t};\r\n\r\n\tconfig.defaults = {};\r\n\r\n\t$.removeCookie = function (key, options) {\r\n\t\tif ($.cookie(key) !== undefined) {\r\n\t\t\t// Must not alter options, thus extending a fresh object...\r\n\t\t\t$.cookie(key, '', $.extend({}, options, { expires: -1 }));\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\r\n}));\r\n","// ***********************************************************\r\n// * MHRL Project : Javascript general routines *\r\n// ***********************************************************\r\n\r\n//String.prototype.trim = function() { return this.replace(/^\\s+|\\s+$/g, ''); };\r\n\r\nvar BAR_DELIMITER = \"|\";\r\nvar ANGLE_BRACKET_LEFT = \"(\";\r\nvar ANGLE_BRACKET_RIGHT = \")\";\r\nvar QCOOKIE_DO_NOT_EXPIRE = new Date(2099).toDateString;\r\nvar COOKIE_DO_NOT_EXPIRE = { expires: 315360000000 };\r\nvar sEntityFave, iEntityLastSelect, sUnits;\r\nvar COOKIE_ENTITY_FAVE = \"EntityFaves\";\r\nvar COOKIE_GL_OFF = \"GLOff\";\r\nvar COOKIE_MAP_TYPE = \"MapType\";\r\nvar COOKIE_UNITS = \"Units\";\r\nvar COOKIE_COOKIE_NOTE = \"NoteCookies\";\r\nvar COOKIE_GENERAL_NOTE = \"NoteGen\";\r\nvar COOKIE_WE_USE_COOKIES_NOTE = \"NoteCookies\";\r\nvar COOKIE_DG = \"DGph\";\r\nvar COOKIE_ENTITY_LAST_SELECT = \"EntityLastSelect\";\r\nvar COOKIE_ENTITY_DEBUG_ON = \"Debug\";\r\nvar COOKIE_DEFAULT_CENTRE_LAT = \"DefaultCentreLat\";\r\nvar COOKIE_DEFAULT_CENTRE_LNG = \"DefaultCentreLng\";\r\nvar COOKIE_DEFAULT_ZOOM = \"DefaultZoom\";\r\nvar iCurrentEntity;\r\nvar iCurrentGraph;\r\nvar bEntitiesOn = true;\r\nvar bRSMarkersOn = true;\r\nvar iDefaultZoomLevel = 2;\r\n\r\n// Stats panel constants\r\nvar Consts =\r\n {\r\n MetricImpFactor: 3.28084,\r\n sMAP_TYPE_GOOGLE: \"Goo\",\r\n sMAP_TYPE_OS: \"OS\",\r\n sENTITY_TAG: \"#rli\",\r\n sFAV_ENTITY_TAG: \"#fav_rli\",\r\n sENTITY_SEARCH_START_MS: 500,\r\n sENTITY_HIGHLIGHT_TIME_MS: 1000,\r\n sPOLY_COLOUR_WITH_FOCUS: \"#222222\",\r\n sIMG_ROOT: \"images/markers/\",\r\n HL_On: \"#AAAAAA\",\r\n HL_Off: \"#FFFFFF\",\r\n EntityNumOffset: 3,\r\n NotDefined: -1,\r\n READING_DECIMALS: 2,\r\n LCD: 16,\r\n sFEET_SINGLE_INDICATOR_WORDS: \" foot\",\r\n sINCHES_SINGLE_INDICATOR_WORDS: \" inch\",\r\n sFEET_PLURAL_INDICATOR_WORDS: \" feet\",\r\n sINCHES_PLURAL_INDICATOR_WORDS: \" inches\",\r\n sFEET_SINGLE_INDICATOR_SYMBOLS: \"'\",\r\n sINCHES_SINGLE_INDICATOR_SYMBOLS: '\"',\r\n sFEET_PLURAL_INDICATOR_SYMBOLS: \"'\",\r\n sINCHES_PLURAL_INDICATOR_SYMBOLS: '\"',\r\n bREADING_IN_WORDS: false,\r\n sUNIT_CODE_METRIC: \"M\",\r\n sUNIT_CODE_IMPERIAL: \"I\",\r\n sUNIT_CODE_SWITCH_TO_METRIC: \"Switch to Metric\",\r\n sUNIT_CODE_SWITCH_TO_IMPERIAL: \"Switch to Imperial\",\r\n sTO_UNIT_CODE: \"F\",\r\n sDELIMITER_BAR: \"|\",\r\n sSPACE: \" \",\r\n iRIVER_LINK_LEN: \"#rli\".length,\r\n sCLASS_ROOT_SPATE_LEVEL: \"spate_level_\",\r\n sSTATE_TREND_RISING_CODE: \"R\",\r\n sSTATE_TREND_FALLING_CODE: \"F\",\r\n sSTATE_TREND_STEADY_CODE: \"S\",\r\n sSTATE_TREND_CHANGING_CODE: \"S\",\r\n sSTATE_TREND_NOT_AVAILABLE: \"NA\",\r\n sSTATE_TREND_RISING_DESCRIPTION: \"rising\",\r\n sSTATE_TREND_FALLING_DESCRIPTION: \"falling\",\r\n sSTATE_TREND_STEADY_DESCRIPTION: \"steady\",\r\n sSTATE_TREND_CHANGING_DESCRIPTION: \"changing\",\r\n sSTATE_TREND_UNKNOWN_DESCRIPTION: \"unknown\",\r\n // sSTATE_TREND_RISING_IMAGE:\"levelrising.png\",\r\n // sSTATE_TREND_FALLING_IMAGE:\"levelfalling.png\",\r\n // sSTATE_TREND_STEADY_IMAGE:\"levelsteady.png\",\r\n // sSTATE_TREND_UNKNOWN_IMAGE:\"levelunknown.png\",\r\n\r\n sSTATE_LEVEL_ABOVE_CODE: \"A\",\r\n sSTATE_LEVEL_BELOW_CODE: \"B\",\r\n sSTATE_LEVEL_NORMAL_CODE: \"N\",\r\n sSTATE_LEVEL_ABOVE_DESCRIPTION: \"aboveTEST\",\r\n sSTATE_LEVEL_BELOW_DESCRIPTION: \"belowTEST\",\r\n sSTATE_LEVEL_NORMAL_DESCRIPTION: \"normalTEST\",\r\n sSTATE_LEVEL_UNKNOWN_DESCRIPTION: \"unknownTEST\",\r\n sFILE_TYPE_PNG: \".png\"\r\n // sSTATE_LEVEL_ABOVE_IMAGE:\"levelabove.png\",\r\n // sSTATE_LEVEL_BELOW_IMAGE:\"levelbelow.png\",\r\n // sSTATE_LEVEL_NORMAL_IMAGE:\"levelnormal.png\",\r\n // sSTATE_LEVEL_UNKNOWN_IMAGE:\"levelunknown.png\",\r\n }\r\nvar linesLayer, vectorLayer, markerLayer, points, lineFeature, lineString, routeMarkersLayer, routepos, routesize, routeoffset, routeicon;\r\n\r\nvar arrEntityMarker = new Array(); // array of Entity Markers\r\nvar arrRSMarker = new Array(); // array of Reading Station Markers\r\nvar arrEntityLatLng = new Array(); // array of Entity Marker Coordinates\r\nvar arrRSLatLng = new Array(); // array of Reading Station Marker Coordinates\r\nvar arrPolyLatLngPoints = new Array(); // array of individual Polyline points\r\nvar arrPolyLines = new Array(); // array of Polylines\r\nvar arrPolyFeature = new Array(); // array of OS Features for Polylines\r\nvar arrEntityImages = new Array(); // array of Plain and Focus images for Entity Marker mouseovers\r\nvar arrEntityRSImages = new Array(); // array of Plain and Focus images for Entity RS Marker mouseovers\r\nvar iPrevEntityNum = Consts.NotDefined; // Entity number of last entity mouse overed.\r\nvar iTimerEntityHighlight; // Timer ID returned from setTimeout for returning Entity elements\r\n// to normal video.\r\nvar iTimerRSHighlight; // Timer ID returned from setTimeout for returning RS Markers\r\n// to normal video.\r\nvar iEntityHighlightOff = \"\"; // Function call that should be made to turn off the highlight on \r\n// current set of Entity elements\r\nvar iPrevRSNum = Consts.NotDefined; // Reading Station number of last entity mouse overed.\r\nvar sReferenceData, sDynamicData;\r\nvar mapLatlng; // Latlng location of the main page's map\r\n\r\nvar map, mapOptions; // Map and Map Option settings for the main page's map\r\nvar layerListeners, Entitystyle, RSstyle, Polystyle, EntityLayer, selEntityLayer, RSLayer, VectorLayer;\r\n//var layerListeners, Entitystyle, RSstyle, Polystyle, EntityLayer, selEntityLayer, RSLayer;\r\n\r\n// Miscellaneous others\r\nfunction GetFocusChar(Focus) {\r\n // Return a string denoting whether the given Focus parameter is True or False\r\n // i.e. \"FOCUS\" or \"PLAIN\"\r\n\r\n if (Focus) {\r\n return \"FOCUS\";\r\n }\r\n else {\r\n return \"PLAIN\";\r\n }\r\n}\r\n\r\nfunction GetEntityLevelTrendImageName(EMnemonic, Focus, GraphicPerEntity) {\r\n // Return the Entity Marker Image name that corresponds to the given Overall Above/Below State, \r\n // Overall Rise/Fall State and OverallStateColourVal\r\n // e.g. Below/Rising/1, Below/Steady/1, Below/Falling/1, Below/Change/1, ... ../../2..., ...\r\n // e.g. Above/Rising/1, Above/Steady/1, Above/Falling/1, Above/Change/1, ... ../../2..., ...\r\n // e.g. Normal/Rising/1, Normal/Steady/1, Normal/Falling/1, Normal/Change/1, ... ../../2..., ...\r\n // Focus denotes whether this image is to be used for Mouseover (focus) or plain display\r\n\r\n // For OpenSpace, use the same graphic throughout and annotate as necessary (if possible)\r\n\r\n if (GraphicPerEntity == true) {\r\n// return \"images/markers/EMkr\" + EMnemonic + GetFocusChar(Focus) + \".gif\";\r\n return \"http://maps.google.com/mapfiles/kml/paddle/blu-blank.png\";\r\n }\r\n else {\r\n // $^$\r\n// return \"images/markers/EMkr\" + EMnemonic + GetFocusChar(Focus) + \".gif\";\r\n return \"http://maps.google.com/mapfiles/kml/paddle/grn-blank.png\";\r\n }\r\n}\r\n\r\nfunction GetRSLevelTrendImageName(RSIndex, Focus) {\r\n // Return the Reading Station Marker Image name e.g. RSMkr3PLAIN.png or RSMkr3FOCUS.png\r\n // Focus denotes whether this image is to be used for plain display, or when mouseovered\r\n\r\n return \"images/markers/RSMkr\" + (RSIndex + 1) + GetFocusChar(Focus) + \".png\";\r\n}\r\n\r\nfunction ConvertColourNum(ColourCode) {\r\n // Return the hashed RGB colour string relating to the given colour code (1-7 ish)\r\n\r\n var ReturnCode;\r\n\r\n switch (ColourCode) {\r\n case 1: ReturnCode = \"#7A7A7A\";\r\n break;\r\n case 2: ReturnCode = \"#99FFFF\";\r\n break;\r\n case 3: ReturnCode = \"#00FF00\";\r\n break;\r\n case 4: ReturnCode = \"#FFFF00\";\r\n break;\r\n case 5: ReturnCode = \"#EB00F6\";\r\n break;\r\n case 6: ReturnCode = \"#FF6600\";\r\n break;\r\n case 7: ReturnCode = \"#FF0000\";\r\n break;\r\n // default: ReturnCode = \"#4C0099\"; // Default is black if no \"valid\" colour code given\r\n default: ReturnCode = \"#000000\"; // Default is black if no \"valid\" colour code given\r\n\r\n // default : ReturnCode = \"#333333\"; // Default is black if no \"valid\" colour code given\r\n break;\r\n\r\n // case 1 : ReturnCode = \"#7A7A7A\";\r\n // break;\r\n // case 2 : ReturnCode = \"#92ABE6\";\r\n // break;\r\n // case 3 : ReturnCode = \"#1DFF00\";\r\n // break;\r\n // case 4 : ReturnCode = \"#FFFF00\";\r\n // break;\r\n // case 5 : ReturnCode = \"#FF00FF\";\r\n // break;\r\n // case 6 : ReturnCode = \"#FF6600\";\r\n // break;\r\n // case 7 : ReturnCode = \"#FF0000\";\r\n // break;\r\n // default : ReturnCode = \"#333333\"; // Default is black if no \"valid\" colour code given\r\n // break;\r\n\r\n }\r\n //console.log (\"Poly Colour will be \" + ReturnCode);\r\n return ReturnCode;\r\n\r\n}\r\n\r\nfunction StringExtractDelimitedSubstring(TargetString, LeftDelim, RightDelim) {\r\n // Extract a substring from the given string where it is delimited by the given left \r\n // and right delimiter characters\r\n\r\n var LeftOffset, RightOffset;\r\n var ReturnString = \"\";\r\n\r\n // Get the index of the left delimiter \r\n try {\r\n LeftOffset = TargetString.indexOf(LeftDelim);\r\n if (LeftOffset != -1) {\r\n // Take the substring of the string from that left delimiter\r\n ReturnString = TargetString.substring(LeftOffset);\r\n RightOffset = ReturnString.indexOf(RightDelim);\r\n if (RightOffset != -1) {\r\n ReturnString = ReturnString.slice(1, RightOffset);\r\n }\r\n }\r\n }\r\n catch (exception) {\r\n //alert (exception.description)\r\n }\r\n\r\n finally {\r\n return ReturnString;\r\n }\r\n\r\n}\r\n\r\n// ^^ Cookie Routines\r\n\r\n// ******************************************\r\n// ****** Add a value to Cookie string ******\r\n// ******************************************\r\nfunction CookieAddValue(CookieName, CookieString, TheValue) {\r\n // Add the given value as a \"|\" delimited item to the given existing Cookie string \r\n // and save the cookie name/value pair\r\n // Return the new Cookie string\r\n\r\n if ((CookieString == null) || (CookieString == undefined)) {\r\n CookieString = \"\";\r\n }\r\n\r\n if (CookieString.indexOf(TheValue) == -1) {\r\n console.log(\"Adding Cookie Value to Name : \", TheValue, \"/\", CookieName);\r\n if (CookieString.length == 0) {\r\n CookieString = BAR_DELIMITER + TheValue + BAR_DELIMITER;\r\n }\r\n else {\r\n CookieString += TheValue + BAR_DELIMITER;\r\n }\r\n\r\n $.cookie(CookieName, CookieString.toString(), COOKIE_DO_NOT_EXPIRE);\r\n }\r\n return CookieString;\r\n}\r\n\r\n// ***********************************************************\r\n// ****** Remove a delimited value from a Cookie string ******\r\n// ***********************************************************\r\nfunction CookieRemoveValue(CookieName, CookieString, TheValue) {\r\n // Remove the given \"|\" delimited value from the given existing Cookie string \r\n // Return the new Cookie string\r\n\r\n console.log(\"Removing Cookie Value from Name : \", TheValue, \"/\", CookieName);\r\n console.log(\"Cookie String was : \", CookieString);\r\n CookieString = CookieString.replace(TheValue + BAR_DELIMITER, \"\");\r\n console.log(\"Cookie String now : \", CookieString);\r\n $.cookie(CookieName, CookieString.toString(), COOKIE_DO_NOT_EXPIRE);\r\n return CookieString;\r\n}\r\n\r\n\r\nfunction StringContainsDelimitedValue(theString, TheValue) {\r\n // Look for the given value together with leading delimiter and return True/False\r\n\r\n try {\r\n if (theString.indexOf(TheValue + BAR_DELIMITER) == -1) {\r\n return false;\r\n }\r\n else {\r\n return true;\r\n }\r\n }\r\n // If the value was null, then an exception will be thrown by the indexOf call\r\n // Return false since the string won't exist in this case\r\n catch (exception) {\r\n return false;\r\n }\r\n}\r\n\r\n\r\n// ***********************************************************\r\n// * Determine whether the given CookieName contains the *\r\n// * given string using the default delimiter \"|\" *\r\n// ***********************************************************\r\nfunction CookieContainsDelimitedValue(CookieName, TheValue) {\r\n // Look for the given value together with leading delimiter and return True/False\r\n\r\n try {\r\n var theString = $.cookie(CookieName);\r\n return StringContainsDelimitedValue(theString, TheValue);\r\n if (theString.indexOf(BAR_DELIMITER + TheValue + BAR_DELIMITER) == -1) {\r\n return false;\r\n }\r\n else {\r\n return true;\r\n }\r\n }\r\n // If the value was null, then an exception will be thrown by the indexOf call\r\n // Return false since the string won't exist in this case\r\n catch (exception) {\r\n return false;\r\n }\r\n}\r\n\r\n\r\n\r\nfunction GetEntityRSCookieName(Entity, ReadingStation) {\r\n return \"$\" + Entity + \"$\" + ReadingStation;\r\n}\r\n\r\n// ************************************************************\r\n// * Return the next element within a given string with the *\r\n// * given delimiter. The routine expects delimiters to the *\r\n// * left of elements. *\r\n// * If an empty string has been passed, return the empty *\r\n// * string *\r\n// ************************************************************\r\nfunction GetNextDelimitedValue(theString, delimiter) {\r\n // Look for the given value together with leading delimiter and return True/False\r\n\r\n var iOffset;\r\n\r\n if (theString.length == 0) {\r\n return (\"\");\r\n }\r\n else {\r\n try {\r\n iOffset = theString.indexOf(delimiter);\r\n if (iOffset == -1) {\r\n // No more delimiters so return the string passed as the final element\r\n return (theString);\r\n }\r\n else {\r\n return (theString.substr(0, iOffset));\r\n }\r\n }\r\n // If the value was null, then an exception will be thrown by the indexOf call\r\n // Return the null string since the string won't exist in this case\r\n catch (exception) {\r\n return \"\";\r\n }\r\n }\r\n}\r\n\r\nfunction GetTrendState(TrendCode) {\r\n // From the given Trend Code, return a string denoting the level state\r\n\r\n switch (TrendCode) {\r\n case Consts.sSTATE_TREND_RISING_CODE:\r\n return \"\" + Consts.sSTATE_TREND_RISING_DESCRIPTION + \"\";\r\n break;\r\n case Consts.sSTATE_TREND_FALLING_CODE:\r\n return \"\" + Consts.sSTATE_TREND_FALLING_DESCRIPTION + \"\";\r\n break;\r\n case Consts.sSTATE_TREND_STEADY_CODE:\r\n return \"\" + Consts.sSTATE_TREND_STEADY_DESCRIPTION + \"\";\r\n break;\r\n case Consts.sSTATE_TREND_CHANGING_CODE:\r\n return \"\" + Consts.sSTATE_TREND_CHANGING_DESCRIPTION + \"\";\r\n break;\r\n default:\r\n return Consts.sSTATE_TREND_UNKNOWN_DESCRIPTION;\r\n break;\r\n }\r\n}\r\n\r\nfunction GetLevelState(LevelCode) {\r\n // From the given Level Code, return a string denoting the level state\r\n\r\n switch (LevelCode) {\r\n case Consts.sSTATE_LEVEL_ABOVE_CODE:\r\n return \"above\";\r\n break;\r\n case Consts.sSTATE_LEVEL_BELOW_CODE:\r\n return \"below\";\r\n break;\r\n case Consts.sSTATE_LEVEL_NORMAL_CODE:\r\n return \"normal\";\r\n break;\r\n default:\r\n return \"??????\";\r\n break;\r\n }\r\n}\r\n\r\nfunction GetLevelDetails(SourceLevel, SourceLevelImp, SourceLevelPC, RiseFallState,\r\n StateColourVal, ToUnitCode) {\r\n // From the given level detail, return an array containing :-\r\n // Output level in the requested \"ToUnitCode\". e.g. 1.2 metres or 3 feet 4 inches. This is taken directly\r\n // from the relevant Dynamic JSON data structure element (Level or LevelImp for metres, imperial respectively\r\n // The trend. e.g. \"rising\"\r\n // the state graphics file identifier (made up of StateColourVal and trend)\r\n\r\n // * Note : Level and DatumLevel will already be rounded to the required number of decimal places\r\n // ^^ DatumLevel left in for now in case we add a relative level above/below normal to the output at some point\r\n // ^^ UnitCode not currently used. Note if units other than Metres and Feet and Inches are used, further\r\n // work will be necessary.\r\n\r\n var sStateImg, sStateTrend;\r\n\r\n var arrReturnArray = [];\r\n\r\n //console.log (\"SourceLevel [\", SourceLevel, \"]\");\r\n\r\n // arrReturnArray.push(Math.min((SourceLevel / 5 * 100), 100));\r\n arrReturnArray.push(SourceLevelPC);\r\n\r\n // Work out the state\r\n sStateTrend = GetTrendState(RiseFallState);\r\n\r\n // Load all return elements into an array so that they POP in the following order :-\r\n // Relative Level, Absolute Level, LevelImg, TrendImg, LevelDesc, TrendDesc\r\n\r\n arrReturnArray.push(sStateTrend);\r\n\r\n if (RiseFallState == Consts.sSTATE_TREND_NOT_AVAILABLE) {\r\n arrReturnArray.push('');\r\n } else {\r\n // If the reading is not available, push the empty string, otherwise push \" and \"\r\n // This is then rendered as \" and rising\" (for instance) or \"unknown\"\r\n if (ToUnitCode == Consts.sUNIT_CODE_METRIC) {\r\n arrReturnArray.push(SourceLevel + Consts.sUNIT_CODE_METRIC.toLowerCase() + ' and ');\r\n } else {\r\n arrReturnArray.push(SourceLevelImp + ' and ');\r\n }\r\n }\r\n // and the appropriate image\r\n if (RiseFallState == Consts.sSTATE_TREND_NOT_AVAILABLE) {\r\n sStateImg = \"state0\" + Consts.sFILE_TYPE_PNG;\r\n } else {\r\n sStateImg = \"state\" + StateColourVal + RiseFallState + Consts.sFILE_TYPE_PNG;\r\n }\r\n arrReturnArray.push(sStateImg);\r\n\r\n return arrReturnArray;\r\n\r\n}\r\n\r\nfunction EntityMarkerToggle() {\r\n // Toggle all Entity Markers On/Off depending on their current state\r\n\r\n //console.log ('Entity Marker Toggle hit');\r\n for (var i = 0, ilimit = arrEntityImages.length; i < ilimit; i++) {\r\n // Hide or display Adjust the Entity marker image to highlighted/non highlighted\r\n if (sReferenceData[i]['__MO'] == 1) {\r\n if (GOOGLE_ON == 1) {\r\n if (bEntitiesOn == true) {\r\n arrEntityMarker[i].setOptions({ visible: false });\r\n //console.log ('Hiding Entity Marker ', i);\r\n }\r\n else {\r\n arrEntityMarker[i].setOptions({ visible: true });\r\n //console.log ('Showing Entity Marker ', i);\r\n }\r\n }\r\n else if (OS_ON == 1) {\r\n if (bEntitiesOn == true) {\r\n arrEntityMarker[i].display(false);\r\n //console.log ('Hiding Entity Marker ', i);\r\n }\r\n else {\r\n arrEntityMarker[i].display(true);\r\n //console.log ('Showing Entity Marker ', i);\r\n }\r\n }\r\n\r\n }\r\n }\r\n bEntitiesOn = !bEntitiesOn;\r\n}\r\n\r\n\r\nfunction RSMarkerToggle() {\r\n // Toggle all RS Markers On/Off depending on their current state\r\n\r\n //console.log ('RS Marker Toggle hit');\r\n for (var i = 0, ilimit = arrEntityImages.length; i < ilimit; i++) {\r\n if (sReferenceData[i]['__MO'] == 1) {\r\n for (var j = 0, jlimit = arrEntityRSImages[i].length; j < jlimit; j++) {\r\n // Hide or display Adjust the Entity marker image to highlighted/non highlighted\r\n if (bRSMarkersOn == true) {\r\n if (GOOGLE_ON == 1) {\r\n arrRSMarker[i][j].setOptions({ visible: false });\r\n //console.log ('Hiding RS Marker ', i, j);\r\n }\r\n else if (OS_ON == 1) {\r\n arrRSMarker[i][j].display(false);\r\n //console.log ('Hiding RS Marker ', i, j);\r\n }\r\n }\r\n else {\r\n if (GOOGLE_ON == 1) {\r\n arrRSMarker[i][j].setOptions({ visible: true });\r\n //console.log ('Showing RS Marker ', i, j);\r\n }\r\n else if (OS_ON == 1) {\r\n arrRSMarker[i][j].display(true);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n bRSMarkersOn = !bRSMarkersOn;\r\n}\r\n\r\nfunction SetMapCentreAndZoom(UseMap, UseMapCentreLat, UseMapCentreLng, UseMapZoom, SetOptionsOnly) {\r\n // Set the map center and zoom level to its configured default\r\n\r\n var mapOptions = new Object();\r\n var mapLatlng;\r\n\r\n if (MAPS_ON == 1) {\r\n console.log(\"Moving map to Centre / Zoom \", UseMapCentreLat, UseMapCentreLng, UseMapZoom);\r\n //+_+\r\n if (GOOGLE_ON == 1) {\r\n mapLatlng = new google.maps.LatLng(UseMapCentreLat, UseMapCentreLng);\r\n\r\n mapOptions['center'] = mapLatlng;\r\n mapOptions['zoom'] = UseMapZoom;\r\n\r\n if (SetOptionsOnly == false) {\r\n map.setOptions(mapOptions);\r\n }\r\n }\r\n else if (OS_ON == 1) {\r\n mapLatlng = new OpenLayers.LonLat(parseInt(UseMapCentreLng), parseInt(UseMapCentreLat));\r\n\r\n if (SetOptionsOnly == false) {\r\n // map.setCenter(mapLatlng);\r\n map.setCenter(mapLatlng, UseMapZoom);\r\n }\r\n }\r\n }\r\n}\r\n\r\nfunction SaveMapCentreAndZoom() {\r\n // Derive the center and zoom level of the map as it currently stands and save it to a cookie.\r\n\r\n var mapCentre;\r\n var mapZoom;\r\n var lat;\r\n var lng;\r\n\r\n if (GOOGLE_ON === 1) {\r\n mapCentre = map.getCenter();\r\n mapZoom = map.getZoom();\r\n lat = mapCentre.lat();\r\n lng = mapCentre.lng();\r\n }\r\n else if (OS_ON == 1) {\r\n mapCentre = map.getCenter();\r\n mapZoom = map.getZoom();\r\n lat = mapCentre.lat;\r\n lng = mapCentre.lon;\r\n }\r\n\r\n // console.log (\"Setting map up as Centre / Zoom \", mapCentre, mapZoom);\r\n // console.log (\"Lat is \", mapCentre.lat());\r\n // console.log (\"Lng is \", mapCentre.lng());\r\n\r\n var CookieDebug = $.cookie(COOKIE_ENTITY_DEBUG_ON);\r\n //$$^^\r\n // if (CookieDebug.length != 0) {\r\n // alert(mapCentre.lat() + \", \" + mapCentre.lng() + \", \" + mapZoom);\r\n // }\r\n $.cookie(COOKIE_DEFAULT_CENTRE_LAT, lat.toString(), COOKIE_DO_NOT_EXPIRE);\r\n $.cookie(COOKIE_DEFAULT_CENTRE_LNG, lng.toString(), COOKIE_DO_NOT_EXPIRE);\r\n $.cookie(COOKIE_DEFAULT_ZOOM, mapZoom.toString(), COOKIE_DO_NOT_EXPIRE);\r\n}\r\n\r\nfunction SetMapCentreAndZoomToDefault(SetOptionsOnly) {\r\n // Retrieve the default map centre and zoom settings from its cookie and call SetMapCentreAndZoomToDefault\r\n // to put in in place\r\n\r\n var defaultZoom;\r\n\r\n console.log(\"Setting map to default centre & zoom\");\r\n\r\n var DefMapCentreLat = $.cookie(COOKIE_DEFAULT_CENTRE_LAT);\r\n var mapType = $.cookie(COOKIE_MAP_TYPE);\r\n\r\n // If either the centre is undefined, or we're using OS Maps and the default looks like its\r\n // beeing previously running on Latitude/Longitude instead of Northing/Easting, default it\r\n if ((DefMapCentreLat == null) ||\r\n ((OS_ON == 1) && (mapType != Consts.sMAP_TYPE_OS)) || ((GOOGLE_ON == 1) && (mapType != Consts.sMAP_TYPE_GOOGLE))) {\r\n if (GOOGLE_ON == 1) {\r\n $.cookie(COOKIE_DEFAULT_CENTRE_LAT, \"56.6381058\".toString(), COOKIE_DO_NOT_EXPIRE);\r\n $.cookie(COOKIE_DEFAULT_CENTRE_LNG, \"-3.7902828\".toString(), COOKIE_DO_NOT_EXPIRE);\r\n defaultZoom = \"7\";\r\n $.cookie(COOKIE_MAP_TYPE, Consts.sMAP_TYPE_GOOGLE, COOKIE_DO_NOT_EXPIRE);\r\n }\r\n else if (OS_ON == 1) {\r\n $.cookie(COOKIE_DEFAULT_CENTRE_LAT, \"323386\".toString(), COOKIE_DO_NOT_EXPIRE);\r\n $.cookie(COOKIE_DEFAULT_CENTRE_LNG, \"401324\".toString(), COOKIE_DO_NOT_EXPIRE);\r\n // $.cookie(COOKIE_DEFAULT_CENTRE_LAT, \"56.6381058\".toString(), COOKIE_DO_NOT_EXPIRE);\r\n // $.cookie(COOKIE_DEFAULT_CENTRE_LNG, \"-3.7902828\".toString(), COOKIE_DO_NOT_EXPIRE);\r\n defaultZoom = \"1\";\r\n $.cookie(COOKIE_MAP_TYPE, Consts.sMAP_TYPE_OS, COOKIE_DO_NOT_EXPIRE);\r\n }\r\n $.cookie(COOKIE_DEFAULT_ZOOM, defaultZoom, COOKIE_DO_NOT_EXPIRE);\r\n DefMapCentreLat = $.cookie(COOKIE_DEFAULT_CENTRE_LAT);\r\n }\r\n\r\n var DefMapCentreLng = $.cookie(COOKIE_DEFAULT_CENTRE_LNG);\r\n var DefMapZoom = parseInt($.cookie(COOKIE_DEFAULT_ZOOM));\r\n\r\n iDefaultZoomLevel = parseInt(DefMapZoom);\r\n\r\n if ((DefMapCentreLat != 0) && (DefMapCentreLng != 0) && (DefMapZoom != null)) {\r\n SetMapCentreAndZoom(map, DefMapCentreLat, DefMapCentreLng, DefMapZoom, SetOptionsOnly);\r\n }\r\n}\r\n\r\n\r\nfunction SetLocalMapCentreAndZoom(EntityIndex) {\r\n // Retrieve the Local Map Latitude, Longitude and ZoomLevel for the given EntityIndex from the \r\n // Reference data JSON object and pass to SetMapCentreAndZoom to position the map accordingly\r\n\r\n var thisEntity = sReferenceData[EntityIndex];\r\n\r\n console.log(\"Setting map to default centre & zoom to\", EntityIndex);\r\n\r\n if (GOOGLE_ON == 1) {\r\n SetMapCentreAndZoom(map, thisEntity['__LMLL'][0], thisEntity['__LMLL'][1],\r\n thisEntity['__LMZL'], false);\r\n }\r\n else if (OS_ON == 1) {\r\n SetMapCentreAndZoom(map, thisEntity['LocalMap__NO'], thisEntity['LocalMap__EA'],\r\n thisEntity['__LMZL'], false);\r\n }\r\n}\r\n\r\nfunction EmptyStringIfNull(sString) {\r\n // Return the given string if not null, otherwise return the empty string\r\n if ((sString == null) || (sString == \"undefined\")) {\r\n return (\"\");\r\n }\r\n else {\r\n return (sString);\r\n }\r\n}\r\n\r\nfunction ZeroIfNull(sString) {\r\n // Return the given string if not null, otherwise return 0\r\n if (sString == null) {\r\n return (0);\r\n }\r\n else {\r\n return (sString);\r\n }\r\n}\r\n\r\nfunction ClassGetRSStateColourVal(EntityIndex, RSIndex) {\r\n // Return the \"spate_level\" class name based on the given Entity's Reading Station StateColourVal\r\n\r\n return (Consts.sCLASS_ROOT_SPATE_LEVEL + sDynamicData[EntityIndex].RSData[RSIndex]['__SCV']);\r\n}\r\n\r\nfunction ClassGetEntityStateColourVal(EntityIndex) {\r\n // Return the \"spate_level\" class name based on the given Entity's OverallStateColourVal\r\n\r\n return (Consts.sCLASS_ROOT_SPATE_LEVEL + sDynamicData[EntityIndex]['__OSCL']);\r\n}\r\n\r\nfunction GetMHRLDate(dateString) {\r\n // var date = new Date(\"2010-09-21T15:48:12.754+02:00\");\r\n var date = new Date(dateString);\r\n var Shortdays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];\r\n var days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];\r\n var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];\r\n var myDate, myHours, myMinutes, mySeconds, myDayNo, myAMPM;\r\n\r\n myHours = date.getHours();\r\n myMinutes = date.getMinutes();\r\n mySeconds = date.getSeconds();\r\n myDayNo = date.getDate();\r\n if (myHours > 12) {\r\n myHours -= 12;\r\n myAMPM = \"PM\";\r\n }\r\n else {\r\n myAMPM = \"AM\";\r\n }\r\n\r\n // if (myHours < 10) { myHours = \"0\" + myHours; }\r\n if (myMinutes < 10) { myMinutes = \"0\" + myMinutes; }\r\n if (mySeconds < 10) { mySeconds = \"0\" + mySeconds; }\r\n if (myDayNo < 10) { myDayNo = \"0\" + myDayNo; }\r\n\r\n // Don't bother with seconds\r\n myDate = Shortdays[date.getDay()] + \" \" + myDayNo + \" \" + months[date.getMonth()] + \" \" + date.getFullYear() + \" \";\r\n myDate += myHours + \":\" + myMinutes + \" \" + myAMPM;\r\n // myDate += \":\" + mySeconds;\r\n // myDate += \"0\" + date.getTimezoneOffset() / 60 + \":00 \" + date.getFullYear();\r\n return (myDate);\r\n}\r\n\r\nfunction GetFullMHRLDate(dateString) {\r\n String.Format(\"{0:ddd dd MMMM, HH:mm:ss}\", dateString)\r\n}\r\n\r\nfunction LogTime() {\r\n var date = new Date()\r\n return date.getHours().toString() + \":\" + date.getMinutes().toString() + \":\" + date.getSeconds().toString() + \".\" + date.getMilliseconds().toString()\r\n}\r\n\r\nfunction TimedConsoleLog(msg) {\r\n console.log(LogTime() + \":\" + msg);\r\n}\r\n\r\n// ******* Date/time formatting\r\n//String.Format(\"{0:y yy yyy yyyy}\", dt); // \"8 08 008 2008\" year\r\n//String.Format(\"{0:M MM MMM MMMM}\", dt); // \"3 03 Mar March\" month\r\n//String.Format(\"{0:d dd ddd dddd}\", dt); // \"9 09 Sun Sunday\" day\r\n//String.Format(\"{0:h hh H HH}\", dt); // \"4 04 16 16\" hour 12/24\r\n//String.Format(\"{0:m mm}\", dt); // \"5 05\" minute\r\n//String.Format(\"{0:s ss}\", dt); // \"7 07\" second\r\n//String.Format(\"{0:f ff fff ffff}\", dt); // \"1 12 123 1230\" sec.fraction\r\n//String.Format(\"{0:F FF FFF FFFF}\", dt); // \"1 12 123 123\" without zeroes\r\n//String.Format(\"{0:t tt}\", dt); // \"P PM\" A.M. or P.M.\r\n//String.Format(\"{0:z zz zzz}\", dt); // \"-6 -06 -06:00\" time zone\r\n\r\n","var iCurrentStatsEntity;\r\nvar iDefaultStrokeWidth = 2;\r\nvar bLabellingAllRivers = false;\r\nvar bLabellingSelected = true;\r\nvar bFavouritesOn = false;\r\nvar bStartupComplete = false;\r\nvar myBarChart, currentChartFilename, currentGraphLink, currentUnits;\r\nvar graphOptions;\r\nvar searchTimer;\r\nvar FavouritesHTML;\r\nvar workerFave, workerSearch;\r\n\r\n// *******************************************************************\r\n// ***** River Entry Favourite/Unfavourite IMAGE Click Function ****** \r\n// *******************************************************************\r\n//TODO:$$$ Replace with the use of badges / buttons\r\nfunction MarkFavourite(thisElement) {\r\n var thisMnemonic = $(thisElement).next().next().text();\r\n console.log(\"*************** Extracted \", thisMnemonic);\r\n\r\n thisPtr = $(thisElement);\r\n thisPtr.addClass(\"UnFavouriteMe\");\r\n thisPtr.removeClass(\"FavouriteMe\");\r\n thisPtr.attr('src', 'images/UFM.png');\r\n\r\n // Add the Entity to the EntityFavourite Cookie value\r\n sEntityFave = CookieAddValue(COOKIE_ENTITY_FAVE, sEntityFave, thisMnemonic);\r\n}\r\n\r\n// ***************************************************************\r\n// ***** Show Favourites Only / Show All link Click Function ***** \r\n// ***************************************************************\r\n\r\n// Now handled a different way\r\n//function ToggleFavourite(thisElement) {\r\n// console.log (\"Favourites Only click\", thisElement);\r\n\r\n// if (thisElement.hasClass(\"ShowAll\")) {\r\n// console.log (TimedConsoleLog (\"Doing Show All\"));\r\n// // Currently showing Favourites only, now Show All\r\n// $(thisElement).removeClass(\"FavouritesOnly\");\r\n// console.log(TimedConsoleLog(\"Doing the #RList div bulk slidedown\"));\r\n// $('#RList > div').slideDown(\"slow\");\r\n// //$('#RList div').slideDown(\"slow\");\r\n// console.log(TimedConsoleLog(\"Tis done\"));\r\n// $('#FavouritesOnly').text('Favourites');\r\n// $('#FavouritesOnly').removeClass('ShowAll');\r\n// $('#FavouritesOnly').addClass('FavesOnly');\r\n// bFavouritesOn = false;\r\n// }\r\n// else {\r\n// // Currently showing all, now Show Favourites only\r\n// console.log(TimedConsoleLog(\"Doing Faves Only\"));\r\n// $(thisElement).addClass(\"FavouritesOnly\");\r\n// $('#FavouritesOnly').text('Show All');\r\n// $('#FavouritesOnly').removeClass('FavesOnly');\r\n// $('#FavouritesOnly').addClass('ShowAll');\r\n// console.log(TimedConsoleLog(\"The parent is \", $('#RList a img.FavouriteMe').parents().eq(2)));\r\n// // $('#RList a img.FavouriteMe').parents().eq(2).slideUp();\r\n// $('#RList a img.FavouriteMe').each(function() {\r\n// $(this).parents().eq(2).slideUp(\"slow\");\r\n// });\r\n// $(\"#RiverSection\").scrollTop(0);\r\n// bFavouritesOn = true;\r\n// // $('#FavouritesOnly a').text('Show All Rivers\\\"\"');\r\n// }\r\n\r\n// TimedConsoleLog(\"Finished Favouriting\");\r\n//// $(\"#RiverSection\").getNiceScroll().resize();\r\n//// $(\"#divRiverList\").getNiceScroll().resize();\r\n// return false;\r\n//}\r\n\r\n\r\nfunction DisplayPolyLines() {\r\n // Each of the arrays 'sEntityMarkerData', 'sRSMarkerData' and 'sPolyData' have the same number of\r\n // first dimension elements, each denoting content for a single entity. Hence, each array \r\n // needs to carry data for entities in the same order.\r\n // Parse the 3 arrays containing details of each river's Entity marker, reading station markers and \r\n // polylines. Draw each component on the map object and add Event Listeners to highlight the \r\n // entity marker, reading stations, polylines and RiverList entry on the mouseover of any of these. \r\n // At the same time, display the latest river level data in the Stats panel for the selected entity\r\n // from the Dynamic data structure\r\n // If mouseover of any reading station markers occurs when the associated river entity has already been \r\n // selected, highlight the individual DIV for that RS's displayed statistic\r\n // If a RS DIV receives a mouseover, highlight the RS marker on the map. ^^ Don't know if this is done yet.\r\n\r\n //+__+\r\n\r\n var pos, size, offset, infoWindowAnchor, icon, content, popUpSize;\r\n\r\n var thisReferenceEntry, thisDynamicEntry, thisInfoContent;\r\n var thisRefRSData, thisDynRSData;\r\n var thisEntityImagePlain, thisEntityImageFocus, thisRSImagePlain, thisRSImageFocus;\r\n var thisPolyListArray;\r\n var imgObject = {};\r\n var polyHighlight = {\r\n strokeColor: \"#00FFFF\"\r\n };\r\n\r\n console.log(\"DisplayPolyLines\");\r\n // Iterate through the Reference and Dynamic arrays\r\n // Create the Entity Markers\r\n for (var i = 0, ilimit = sDynamicData.length; i < ilimit; i++) {\r\n\r\n thisReferenceEntry = sReferenceData[i];\r\n thisDynamicEntry = sDynamicData[i];\r\n\r\n // Create the Entity LatLng object\r\n if (MAPS_ON == 1) {\r\n //+_+\r\n if (GOOGLE_ON == 1) {\r\n //+_+\r\n arrEntityLatLng[i] = new google.maps.LatLng(thisReferenceEntry['__ELL'][0],\r\n thisReferenceEntry['__ELL'][1]);\r\n\r\n // Determine the Entity images to be used (with and without Focus)\r\n thisEntityImagePlain = GetEntityLevelTrendImageName(thisReferenceEntry['__Mne'], false, (GOOGLE_ON == 1));\r\n thisEntityImageFocus = GetEntityLevelTrendImageName(thisReferenceEntry['__Mne'], true, (GOOGLE_ON == 1));\r\n\r\n // Create an object with Plain and Focus properties for the entity to be used later with mouseover events\r\n // Need to do the same for Reading Stations\r\n arrEntityImages[i] = new Object();\r\n arrEntityImages[i]['ImgPlain'] = thisEntityImagePlain;\r\n arrEntityImages[i]['ImgFocus'] = thisEntityImageFocus;\r\n }\r\n else if (OS_ON == 1) {\r\n //+_+\r\n }\r\n }\r\n\r\n // *********************************************\r\n // ************* ENTITY MARKERS ****************\r\n // *********************************************\r\n\r\n // and now the Entity marker itself\r\n if (SHOW_MAP_ENT == 1) {\r\n if (MAPS_ON == 1) {\r\n //+_+\r\n //console.log(\"Maps ON\");\r\n if (GOOGLE_ON == 1) {\r\n\r\n arrEntityMarker[i] = new google.maps.Marker({\r\n position: arrEntityLatLng[i],\r\n// icon: thisEntityImagePlain,\r\n visible: false, \r\n label: thisReferenceEntry['__Mne'],\r\n title: 'River ' + thisReferenceEntry['Name']\r\n });\r\n\r\n// arrEntityMarker[i] = new google.maps.Marker({\r\n// position: arrEntityLatLng[i],\r\n// icon: thisEntityImagePlain,\r\n// visible: false,\r\n// title: 'River ' + thisReferenceEntry['Name']\r\n// });\r\n //console.log ('Entity Marker being mapped', i);\r\n // Don't place the Entity marker on the map or create its listener just yet\r\n //+_+$^$\r\n arrEntityMarker[i].setMap(map);\r\n }\r\n else if (OS_ON == 1) {\r\n //console.log(\"Creating OS Marker \" + thisReferenceEntry['Name']);\r\n thisInfoContent = 'River ' + thisReferenceEntry['Name'] + '';\r\n\r\n //+__+ get rid of Pos, no longer needed\r\n\r\n // ^$^ Needs initially to be invisible\r\n\r\n arrEntityMarker[i] = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(parseInt(thisReferenceEntry['Ent__EA']),\r\n parseInt(thisReferenceEntry['Ent__NO'])),\r\n { \"lbl\": thisReferenceEntry['Name'], \"EntityID\": i });\r\n\r\n\r\n EntityLayer.addFeatures(arrEntityMarker[i]);\r\n }\r\n\r\n\r\n }\r\n sRiverTag = \"#\" + Consts.sENTITY_TAG + i; //^^ Delete this line\r\n\r\n // Add mouseover and mouseout listener events for the Entity Marker\r\n if (MAPS_ON == 1) {\r\n if (GOOGLE_ON == 1) {\r\n google.maps.event.addListener(arrEntityMarker[i], 'mouseover', (function (i) {\r\n return function () {\r\n EntityMouseover(i);\r\n // Display the default graph type 1\r\n if (SHOW_STATS == 1) {\r\n ShowDefaultGraph();\r\n }\r\n // MarkEntityElements (i, true, Consts.sPOLY_COLOUR_WITH_FOCUS, Consts.sIMG_ROOT + sEntityMarkerData[i][2])\r\n }\r\n })(i));\r\n }\r\n else if (OS_ON == 1) {\r\n //+_+\r\n\r\n // +_+ ADD THIS BACK IN IF THE FEATURE LEVEL EVENT HANDLING DOESN'T WORK\r\n }\r\n }\r\n }\r\n\r\n // ******************************************************\r\n // ************* READING STATION MARKERS ****************\r\n // ******************************************************\r\n\r\n //console.log(\"RS Marker Prep\");\r\n if (SHOW_MAP_RS == 1) {\r\n\r\n // Create the Reading Station Markers\r\n // First, create arrays for the current Entity's set of Reading Stations for each one's \r\n // LatLng, Marker and InFocus/Plain images\r\n arrRSLatLng[i] = new Array();\r\n arrRSMarker[i] = new Array();\r\n arrEntityRSImages[i] = new Array();\r\n\r\n for (var j = 0, jlimit = thisReferenceEntry['RSData'].length; j < jlimit; j++) {\r\n\r\n // Setup object to point to current Reference and Dynamic JSON Elements\r\n thisRefRSData = sReferenceData[i]['RSData'][j];\r\n thisDynRSData = sDynamicData[i]['RSData'][j];\r\n // thisRefRSData = thisReferenceEntry[j];\r\n // thisDynRSData = thisReferenceEntry[j];\r\n // Determine the RS images to be used (with and without Focus)\r\n //console.log (\"Getting Trend Image \", j);\r\n thisRSImagePlain = GetRSLevelTrendImageName(j, false);\r\n thisRSImageFocus = GetRSLevelTrendImageName(j, true);\r\n\r\n // Create an object with Plain and Focus properties for the RS Marker to be used later with \r\n // mouseover events\r\n arrEntityRSImages[i][j] = new Object();\r\n arrEntityRSImages[i][j]['ImgPlain'] = thisRSImagePlain;\r\n arrEntityRSImages[i][j]['ImgFocus'] = thisRSImageFocus;\r\n //console.log (\"Mapping RS Marker Image Plain \" + arrEntityRSImages[i][j]['ImgPlain']);\r\n //console.log (\"Mapping RS Marker Image Focus \" + arrEntityRSImages[i][j]['ImgFocus']);\r\n\r\n // Create the RS Markers for the current entity\r\n //console.log (\"Starting loop [\", j, \"] through the RS Marker Loop for Entity \", i);\r\n if (MAPS_ON == 1) {\r\n //+_+\r\n if (GOOGLE_ON == 1) {\r\n arrRSLatLng[i][j] = new google.maps.LatLng(thisRefRSData['__LL'][0], thisRefRSData['__LL'][1]);\r\n arrRSMarker[i][j] = new google.maps.Marker({\r\n position: arrRSLatLng[i][j],\r\n icon: thisRSImagePlain,\r\n visible: false,\r\n title: thisReferenceEntry['Name'] + \", \" + thisRefRSData['Name'] + \" ( \" + thisRefRSData['__Mne'] + \")\"\r\n //+_+\r\n });\r\n //console.log ('!!!!!!!!!!!!!!!!! RS Marker being mapped ', i, j, arrRSMarker[i][j]);\r\n\r\n // Don't place the RS Marker on the map or create its listener at this point ^^\r\n // +_+\r\n arrRSMarker[i][j].setMap(map);\r\n // Add mouseover and mouseout listener events for the RS Entity Marker\r\n google.maps.event.addListener(arrRSMarker[i][j], 'mouseover', (function (i, j) {\r\n return function () {\r\n RSFocus(i, j, true)\r\n }\r\n })(i, j));\r\n\r\n google.maps.event.addListener(arrRSMarker[i][j], 'mouseout', (function (i, j) {\r\n return function () {\r\n RSFocus(i, j, false)\r\n }\r\n })(i, j));\r\n //+_+\r\n\r\n // Also add a mouse click event that will display all elements of the related Entity\r\n // when an RS Marker is clicked\r\n //+_+\r\n google.maps.event.addListener(arrRSMarker[i][j], 'click', (function (i, j) {\r\n return function () {\r\n RSMarkerClick(i, j)\r\n // Display the default graph type 1\r\n if (SHOW_STATS == 1) {\r\n ShowDefaultGraph();\r\n }\r\n }\r\n })(i, j));\r\n }\r\n else if (OS_ON == 1) {\r\n //console.log (\"Mapping OS RS Markers!!!!!!!!!!!\");\r\n // +_+\r\n\r\n thisInfoContent = '\" River ' + thisReferenceEntry['Name'] + ', ' +\r\n thisRefRSData['Name'] + ' ( ' + thisRefRSData['__Mne'] + ')' + '';\r\n\r\n arrRSLatLng[i][j] = new OpenLayers.LonLat(parseInt(thisRefRSData['__EA']),\r\n parseInt(thisRefRSData['__NO']));\r\n\r\n size = new OpenLayers.Size(33, 45);\r\n offset = new OpenLayers.Pixel(-16, -36);\r\n infoWindowAnchor = new OpenLayers.Pixel(16, 16);\r\n\r\n icon = new OpenLayers.Icon(thisRSImagePlain, size, offset);\r\n\r\n arrRSMarker[i][j] = new OpenLayers.Marker(arrRSLatLng[i][j], icon);\r\n\r\n //console.log(\"display off\");\r\n arrRSMarker[i][j].display(false);\r\n RSLayer.addMarker(arrRSMarker[i][j]);\r\n //+_+\r\n\r\n // Don't place the RS Marker on the map or create its listener at this point ^^\r\n // Add mouseover and mouseout listener events for the RS Entity Marker\r\n\r\n // $^$ All events here to be removed. Now not sure why. Though we can get away without these events\r\n\r\n arrRSMarker[i][j].events.register('mouseover', arrRSMarker[i][j], (function (i) {\r\n return function () {\r\n RSFocus(i, j, true)\r\n }\r\n })(i, j));\r\n\r\n arrRSMarker[i][j].events.register('mouseout', arrRSMarker[i][j], (function (i, j) {\r\n return function () {\r\n RSFocus(i, j, false)\r\n }\r\n })(i, j));\r\n //+_+\r\n\r\n // Also add a mouse click event that will display all elements of the related Entity\r\n // when an RS Marker is clicked\r\n //+_+\r\n arrRSMarker[i][j].events.register('click', arrRSMarker[i][j], (function (i, j) {\r\n return function () {\r\n RSMarkerClick(i, j)\r\n // Display the default graph type 1\r\n if (SHOW_STATS == 1) {\r\n ShowDefaultGraph();\r\n }\r\n }\r\n })(i, j));\r\n\r\n // $^$ All events here to be removed\r\n\r\n }\r\n }\r\n\r\n\r\n } // loop end\r\n\r\n }\r\n\r\n\r\n // ******************************************************\r\n // ********************* POLYLINES **********************\r\n // ******************************************************\r\n\r\n if (SHOW_MAP_ENT == 1) {\r\n // Create the Entity Polylines and event listeners\r\n //console.log('!!!!!!Create Polys');\r\n\r\n // Create a new array for the set of Polylines (and PolyFeatures for OS Maps) for the current Entity\r\n arrPolyLines[i] = new Array();\r\n arrPolyFeature[i] = new Array();\r\n // And an array to receive the PolyLine points for the current segment of the polyline\r\n arrPolyLatLngPoints[i] = new Array();\r\n\r\n // The first loop (k) traverses over each segment of this Entity's (i) Polyline\r\n for (var k = 0, klimit = thisReferenceEntry['__PL'].length; k < klimit; k++) {\r\n // The second loop (l) traverses over the inidivual LatLng Coordinates of the current (k) segment\r\n // Create an array ready receive the set of 1 or more LatLng points for the current segment\r\n arrPolyLatLngPoints[i][k] = new Array();\r\n thisPolyListArray = thisReferenceEntry['__PL'][k];\r\n //console.log (\"Mapping points for \" + k);$^$\r\n for (var l = 0, llimit = thisPolyListArray.length; l < llimit; l++) {\r\n // Create the Polyline for the current entity, current segment\r\n //console.log(\"In loop \" + thisPolyListArray.length);\r\n if (MAPS_ON == 1) {\r\n //+_+\r\n // *** NOTE : The Reference Data JSON Array should be populated with only 2 elements for each point\r\n // *** accordingly with LatLng or Easting/Northing dependent on whether GoogleMaps or OSMaps\r\n // *** will be used in order to massively reduce the size of the JSON file\r\n if (GOOGLE_ON == 1) {\r\n arrPolyLatLngPoints[i][k].push(new google.maps.LatLng(thisPolyListArray[l][0], thisPolyListArray[l][1]));\r\n }\r\n else if (OS_ON == 1) {\r\n //+_+\r\n // Note the use of array subelements [2] & [3] assumes that only the coordinates\r\n // relevant for this graphing suite have been created\r\n arrPolyLatLngPoints[i][k].push(new OpenLayers.Geometry.Point(thisPolyListArray[l][0], thisPolyListArray[l][1]));\r\n // arrPolyLatLngPoints[i][k].push(new OpenLayers.Geometry.Point(thisPolyListArray[l][2], thisPolyListArray[l][3]));\r\n }\r\n }\r\n }\r\n\r\n // k = arrPolyLatLngPoints.length - 1; //^^ Don't understand what this is here for\r\n\r\n // Check that we're mapping in general and that mapping is On for this entity\r\n if ((MAPS_ON == 1) && (thisReferenceEntry['__MO'] == 1)) {\r\n //+_+\r\n if (GOOGLE_ON == 1) {\r\n arrPolyLines[i][k] = new google.maps.Polyline({\r\n path: arrPolyLatLngPoints[i][k], strokeColor: ConvertColourNum(thisDynamicEntry['PolyColour'][k]), strokeOpacity: 1.0,\r\n clickable: true, strokeWeight: 2\r\n });\r\n // Add the Polyline to the map\r\n arrPolyLines[i][k].setMap(map);\r\n // Add mouseover and mouseout listener events for the Polyline\r\n google.maps.event.addListener(arrPolyLines[i][k], 'mouseover', (function (i) {\r\n return function () {\r\n // MarkEntityElements (i, true, Consts.sPOLY_COLOUR_WITH_FOCUS, Consts.sIMG_ROOT + sEntityMarkerData[i][2])\r\n EntityMouseover(i);\r\n // Display the default graph type 1\r\n if (SHOW_STATS == 1) {\r\n ShowDefaultGraph();\r\n }\r\n iCurrentStatsEntity = i;\r\n $.cookie(COOKIE_ENTITY_LAST_SELECT, iCurrentStatsEntity.toString(), COOKIE_DO_NOT_EXPIRE);\r\n ShowAllRSTextAlertSamples();\r\n }\r\n })(i));\r\n }\r\n else if (OS_ON == 1) {\r\n //console.log (\"Creating line string and feature for \" + k);\r\n arrPolyLines[i][k] = new OpenLayers.Geometry.LineString(arrPolyLatLngPoints[i][k]);\r\n PolySegNo = i.toString() + \"_\" + k.toString();\r\n arrPolyFeature[i][k] = new OpenLayers.Feature.Vector(arrPolyLines[i][k],\r\n { \"lbl\": thisReferenceEntry['Name'], \"EntityID\": i, \"PolySeg\": PolySegNo },\r\n {\r\n strokeColor: ConvertColourNum(thisDynamicEntry['PolyColour'][k]), strokeOpacity: 1\r\n // strokeWidth: 5\r\n\r\n });\r\n arrPolyLines[i][k].attributes = { \"EntityID\": i };\r\n // Add the Polyline to the map\r\n\r\n VectorLayer.addFeatures(arrPolyFeature[i][k]);\r\n\r\n // $^$^$ Register a listener event here\r\n\r\n // console.log(\"Original call\");\r\n\r\n\r\n }\r\n }\r\n\r\n }\r\n }\r\n }\r\n console.log('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Polys DONE');\r\n if (OS_ON == 1) {\r\n //console.log(\"!!!!!!!!!!!!!!!!!!!!!!!!!Adding ayer to map\");\r\n\r\n }\r\n};\r\n\r\n// $$\r\n\r\n//TODO: Do we need these example any more?\r\n\r\nfunction ShowAllRSTextAlertSamples() {\r\n var thisSample;\r\n var iRSCount = sReferenceData[iCurrentStatsEntity]['RSData'].length;\r\n\r\n if (SHOW_TEXT_SAMPLES == 1) {\r\n\r\n TimedConsoleLog(\"ShowAllRSTextAlertSamples\");\r\n // River Latest Levels\r\n $('.popupEntity').html(sReferenceData[iCurrentStatsEntity]['Name']);\r\n //TODO: ^^^ HomeEntity now redundant?\r\n $('.popupHomeEntity').html(sReferenceData[iCurrentStatsEntity]['Name']);\r\n $('.riverLastUpdate').html(GetMHRLDate(sDynamicData[iCurrentStatsEntity]['__CSSDT']));\r\n\r\n $('.popupEntityMnemonic').html(sReferenceData[iCurrentStatsEntity]['__Mne']);\r\n if (sReferenceData[iCurrentStatsEntity]['Loc'] != undefined)\r\n $('.popupEntityLoc').html(sReferenceData[iCurrentStatsEntity]['Loc'])\r\n else\r\n $('.popupEntityLoc').html(\"\");\r\n // Location Text Alerts\r\n $('#popupRSSamples').empty();\r\n for (var RSIndex = 0, ilimit = iRSCount; RSIndex < ilimit; RSIndex++) {\r\n\r\n thisSample = '
  • ';\r\n thisSample += '
    ';\r\n thisSample += '
  • Text LEVEL ';\r\n thisSample += '      
    to 07860 077 377
  • ';\r\n thisSample += '
    ';\r\n\r\n $('#popupRSSamples').append(thisSample);\r\n\r\n $('#pRS' + RSIndex).html(sReferenceData[iCurrentStatsEntity]['RSData'][RSIndex]['Name']);\r\n $('#pEM' + RSIndex).html(sReferenceData[iCurrentStatsEntity]['__Mne']);\r\n $('#pRSM' + RSIndex).html(sReferenceData[iCurrentStatsEntity]['RSData'][RSIndex]['__Mne']);\r\n\r\n }\r\n\r\n $('.popupLevel2').html((0.75 + (2 * Math.random())).toFixed(2));\r\n TimedConsoleLog(\"ShowAllRSTextAlertSamples End - resize\");\r\n\r\n // Resize the scrollbar\r\n try {\r\n // $(\"#MobileAlertExamples\").getNiceScroll().resize();\r\n }\r\n catch (err5) { }\r\n\r\n TimedConsoleLog(\"ShowAllRSTextAlertSamples End - resize end\");\r\n }\r\n}\r\n\r\n// Display random Text Alert help for the given RSIndex of the currently select entity\r\nfunction ShowRSSample(RSIndex) {\r\n var EntandMnemonic, theLoc;\r\n\r\n\r\n if (SHOW_TEXT_SAMPLES == 1) {\r\n $('.popupEntity').html(sReferenceData[iCurrentStatsEntity]['Name']);\r\n $('.popupRS').html(sReferenceData[iCurrentStatsEntity]['RSData'][RSIndex]['Name']);\r\n $('.popupEntityMnemonic').html(sReferenceData[iCurrentStatsEntity]['__Mne']);\r\n $('.popupRSMnemonic').html(sReferenceData[iCurrentStatsEntity]['RSData'][RSIndex]['__Mne']);\r\n $('.popupLevel1').html((0.5 + Math.random()).toFixed(2));\r\n $('.popupLevel2').html((0.75 + (2 * Math.random())).toFixed(2));\r\n $('.popupLevel3').html((0 + Math.random()).toFixed(2));\r\n\r\n\r\n if (sReferenceData[iCurrentStatsEntity]['Loc'] != undefined)\r\n theLoc = sReferenceData[iCurrentStatsEntity]['Loc']\r\n else\r\n theLoc = \"\";\r\n\r\n EntandMnemonic = '' +\r\n theLoc + '' + ' ' + sReferenceData[iCurrentStatsEntity]['Name'] + \" at \" +\r\n sReferenceData[iCurrentStatsEntity]['RSData'][RSIndex]['Name'];\r\n $('#stats_TextEntMne').html(EntandMnemonic);\r\n }\r\n}\r\n\r\n// Display random Text Alert help for the given RSIndex of the currently select entity\r\nfunction TextAlertFocus(RSIndex) {\r\n var EntandMnemonic, theLoc;\r\n\r\n if (SHOW_TEXT_SAMPLES == 1) {\r\n\r\n $('.popupEntity').html(sReferenceData[iCurrentStatsEntity]['Name']);\r\n $('.popupRS').html(sReferenceData[iCurrentStatsEntity]['RSData'][RSIndex]['Name']);\r\n $('.popupEntityMnemonic').html(sReferenceData[iCurrentStatsEntity]['__Mne']);\r\n $('.popupRSMnemonic').html(sReferenceData[iCurrentStatsEntity]['RSData'][RSIndex]['__Mne']);\r\n $('.popupLevel1').html((0.5 + Math.random()).toFixed(2));\r\n $('.popupLevel2').html((0.75 + (2 * Math.random())).toFixed(2));\r\n $('.popupLevel3').html((0 + Math.random()).toFixed(2));\r\n\r\n\r\n if (sReferenceData[iCurrentStatsEntity]['Loc'] != undefined)\r\n theLoc = \" (\" + sReferenceData[iCurrentStatsEntity]['Loc'] + \")\";\r\n else\r\n theLoc = \"\";\r\n\r\n $('.popupEntityPl').html(sReferenceData[iCurrentStatsEntity]['Name'] + theLoc);\r\n\r\n EntandMnemonic = '' +\r\n theLoc + '' + ' ' + sReferenceData[iCurrentStatsEntity][\"Name\"] + ' at ' +\r\n sReferenceData[iCurrentStatsEntity][\"RSData\"][RSIndex][\"Name\"];\r\n $('#stats_TextEntMne').html(EntandMnemonic);\r\n }\r\n}\r\n\r\n// Get a random RS index from the currently select entity\r\nfunction GetRandomRSIndex() {\r\n var useIndex, useLimit;\r\n\r\n //alert(sReferenceData[iCurrentStatsEntity]['RSData'].length);\r\n\r\n useLimit = sReferenceData[iCurrentStatsEntity]['RSData'].length;\r\n\r\n useIndex = Math.floor(Math.random() * useLimit);\r\n if (useIndex > useLimit) {\r\n useIndex = useLimit;\r\n }\r\n TextAlertFocus(useIndex);\r\n}\r\n\r\nfunction RSFocus(EntityIndex, RSIndex, HighlightOn) {\r\n // A Mouseover or Mouseout event has occurred on an RS Marker or an RS's stats table row.\r\n // Highlight the row containing the associated Reading Stations's stats table row\r\n // and display the Focus version of the RS Marker after removing highlighting\r\n // for any previously focussed RS stats table tow.\r\n\r\n var sTagName;\r\n\r\n console.log('RS Focus called Entity/RS/Highlight/iPrevRSNum', EntityIndex, RSIndex, HighlightOn, iPrevRSNum);\r\n\r\n // If the Entity this Reading Station refers to is no currently the Entity being\r\n // displayed in the Stats table, do not respond to the event\r\n if (EntityIndex == iCurrentStatsEntity) {\r\n if ((iPrevRSNum == RSIndex) && (iTimerRSHighlight != Consts.NotDefined))\r\n // If the same Entity as was previously highlighted is being highlighted again\r\n // and the timer request to return it to normal video is still running, cancel and restart it\r\n {\r\n clearTimeout(iTimerRSHighlight);\r\n iTimerRSHighlight = setTimeout(function () { HighlightRSMarker(EntityIndex, RSIndex, false); }, Consts.sENTITY_HIGHLIGHT_TIME_MS);\r\n return;\r\n };\r\n\r\n // If the same RS is still in focus, do nothing\r\n if (RSIndex != iPrevRSNum) {\r\n if (iPrevRSNum != Consts.NotDefined) {\r\n if (iTimerRSHighlight != Consts.NotDefined) {\r\n ForceRSResetTimeout(iTimerRSHighlight, EntityIndex, iPrevRSNum)\r\n }\r\n\r\n // Remove the \"highlight\" class from both the top and bottom row of the previous entry\r\n sTagName = \"#stats_row_top__\" + iPrevRSNum;\r\n $(sTagName).removeClass('highlight');\r\n sTagName = \"#stats_row_bot__\" + iPrevRSNum;\r\n $(sTagName).removeClass('highlight');\r\n // Set the RS Marker to its plain image\r\n // HighlightRSMarker (EntityIndex, iPrevRSNum, false);\r\n //console.log (\"class content bot old now \", sTagName, \" : \", $(sTagName).html());\r\n }\r\n\r\n\r\n // Add the \"highlight\" class to both the top and bottom row of the previous entry\r\n sTagName = \"#stats_row_top__\" + RSIndex;\r\n $(sTagName).addClass('highlight');\r\n sTagName = \"#stats_row_bot__\" + RSIndex;\r\n $(sTagName).addClass('highlight');\r\n // Now set the current RS Marker to its Focus Image and set the reset timer again\r\n HighlightRSMarker(EntityIndex, RSIndex, true);\r\n //console.log (\"class content BOT NEW now \", sTagName, \" : \", $(sTagName).html());\r\n iTimerRSHighlight = setTimeout(function () { HighlightRSMarker(EntityIndex, RSIndex, false); }, Consts.sENTITY_HIGHLIGHT_TIME_MS);\r\n\r\n iPrevRSNum = RSIndex;\r\n }\r\n TextAlertFocus(RSIndex);\r\n }\r\n};\r\n\r\nfunction RSMarkerClick(EntityIndex, RSIndex) {\r\n // An RS Marker has been clicked. Highlight the associated Entity elements by calling EntityMouseover\r\n // Highlight the row containing the associated Reading Stations's stats table row\r\n // and display the Focus version of the RS Marker after removing highlighting\r\n // for any previously focussed RS stats table tow.\r\n\r\n console.log('RSMarkerClick called Entity/RSIndex', EntityIndex, RSIndex);\r\n\r\n EntityMouseover(EntityIndex);\r\n};\r\n\r\nfunction RSStateDescription(sRSState) {\r\n // Return the description as in EntityList.xslt which matches the given state image - e.g. \"state6F.png\"\r\n\r\n if (sRSState == \"state1S.png\") { return \"Dead low, steady\" }\r\n else if (sRSState == \"state1R.png\") { return \"Dead low, rising\" }\r\n else if (sRSState == \"state1F.png\") { return \"Dead low, falling\" }\r\n else if (sRSState == \"state2S.png\") { return \"Low, steady\" }\r\n else if (sRSState == \"state2R.png\") { return \"Low, rising\" }\r\n else if (sRSState == \"state2F.png\") { return \"Low, falling\" }\r\n else if (sRSState == \"state3S.png\") { return \"Around normal, steady\" }\r\n else if (sRSState == \"state3R.png\") { return \"Around normal, rising\" }\r\n else if (sRSState == \"state3F.png\") { return \"Around normal, falling\" }\r\n else if (sRSState == \"state4S.png\") { return \"Above normal, steady\" }\r\n else if (sRSState == \"state4R.png\") { return \"Above normal, rising\" }\r\n else if (sRSState == \"state4F.png\") { return \"Above normal, falling\" }\r\n else if (sRSState == \"state5S.png\") { return \"Well above normal, steady\" }\r\n else if (sRSState == \"state5R.png\") { return \"Well above normal, rising\" }\r\n else if (sRSState == \"state5F.png\") { return \"Well above normal, falling\" }\r\n else if (sRSState == \"state6S.png\") { return \"Spate, steady\" }\r\n else if (sRSState == \"state6R.png\") { return \"Spate, rising\" }\r\n else if (sRSState == \"state6F.png\") { return \"Spate, falling\" }\r\n else if (sRSState == \"state7S.png\") { return \"Heavy spate, steady\" }\r\n else if (sRSState == \"state7R.png\") { return \"Heavy spate, rising\" }\r\n else if (sRSState == \"state7F.png\") { return \"Heavy spate, falling\" }\r\n else if (sRSState == \"state0.png\") { return \"Unknown\" }\r\n};\r\n\r\n\r\nfunction ShowEntityStats(EntityNum, bForceRefresh)\r\n// Extract the Entity and Level details from a combination of the Static and Dynamic JSON structures\r\n// and generate the appropriate HTML within ths \"stats_Body\" container to display the results\r\n// Set the global variable iCurrentStatsEntity to denote the Entity number for which stats on Reading\r\n// Stations are currently on display in the Stats Area\r\n// The bForceRefresh parameter is used to force an update when the \"SwitchUnits\" button has been pressed\r\n{\r\n\r\n var thisColourVal, arrLevelDetails, iIndex, fmtDate, sRSState;\r\n\r\n TimedConsoleLog(\"ShowEntityStats start \" + EntityNum + \" / \" + iCurrentStatsEntity);\r\n // No need to redisplay if this river is already on display\r\n if ((iCurrentStatsEntity != EntityNum) || (bForceRefresh == true) || (bStartupComplete == false)) {\r\n // Empty the body of the table and recreate from the RS Static and Dynamic data for the given element\r\n TimedConsoleLog(\"HTML update\");\r\n $('#stats_Body').empty();\r\n $('#stats_DateTime').html(GetMHRLDate(sDynamicData[EntityNum]['__CSSDT']));\r\n $('#stats_DateTimeAgo').attr(\"title\", sDynamicData[EntityNum]['__CSSDT']);\r\n $('#stats_DateTimeAgo').data(\"timeago\", null).timeago();\r\n\r\n jQuery(\"abbr.timeago\").timeago();\r\n\r\n //TODO: $$$ REmove NUDT element from json\r\n //$('#stats_NextUpdate').html(GetMHRLDate(sDynamicData[EntityNum]['__NUDT']));\r\n $('#stats_Entity').html(sReferenceData[EntityNum]['Name']);\r\n $('#stats_Mnemonic').html('(' + sReferenceData[EntityNum]['__Mne'] + ')');\r\n console.log(\"******* Stats Mnemonic is \" + EntityNum + sReferenceData[EntityNum]['__Mne']);\r\n iIndex = 0;\r\n\r\n TimedConsoleLog(\"ref data parse\");\r\n $.each(sReferenceData[EntityNum]['RSData'], function (entryIndex, entry) {\r\n // Retrieve the settings and state in the required units from the Dyanmic data JSON\r\n // and add as 2 rows to the Stats Display\r\n\r\n // @@@ Remove __DL and __UC from reference data and this call\r\n //arrLevelDetails = GetLevelDetails(entry['__DL'], sReferenceData[EntityNum]['__UC'],\r\n arrLevelDetails = GetLevelDetails(\r\n sDynamicData[EntityNum]['RSData'][entryIndex]['Level'],\r\n sDynamicData[EntityNum]['RSData'][entryIndex]['__LI'],\r\n sDynamicData[EntityNum]['RSData'][entryIndex]['__LPC'],\r\n sDynamicData[EntityNum]['RSData'][entryIndex]['__RFS'],\r\n sDynamicData[EntityNum]['RSData'][entryIndex]['__SCV'],\r\n sUnits);\r\n\r\n thisColourVal = sDynamicData[EntityNum]['RSData'][entryIndex]['__SCV'];\r\n\r\n // console.log (arrLevelDetails.pop());\r\n // console.log (arrLevelDetails.pop());\r\n // console.log (arrLevelDetails.pop());\r\n // console.log (arrLevelDetails.pop());\r\n // console.log (arrLevelDetails.pop());\r\n // // Relative Level, Absolute Level, LevelImg, TrendImg, LevelDesc, TrendDesc\r\n\r\n // Insert the ** FIRST LINE **, include the class to denote Spate Level\r\n var html_str;\r\n html_str = '';\r\n\r\n html_str += ' ';\r\n\r\n // Pop the Spate Level / Rise Fall state image name\r\n sRSState = arrLevelDetails.pop();\r\n\r\n // Reading Station state image e.g. state2R.png\r\n html_str += '' + entry['Name'] + ' (' + entry['__Mne'] + ')';\r\n html_str += ' \"'';\r\n // html_str += ' \"Text';\r\n html_str += '';\r\n\r\n\r\n // html_str += '' + arrLevelDetails.pop() + '';\r\n\r\n // ^^ Ditch the Absolute level which isn't currently used\r\n // console.log (\"-> \", arrLevelDetails.pop());\r\n\r\n // Above/Below/Normal image\r\n // html_str += ' ';\r\n // Rising/Falling/Steady image\r\n // html_str += ' ';\r\n\r\n // Add the new body html \r\n //console.log (\"Add [\" + html_str);\r\n $('#stats_Body').append(html_str);\r\n\r\n // And now the ** SECOND LINE **, popping the level and trend\r\n html_str = '';\r\n html_str += '';\r\n html_str += '' + arrLevelDetails.pop() + arrLevelDetails.pop() + '';\r\n html_str += '';\r\n // html_str += '';\r\n // Add the new body html \r\n //console.log (\"Add [\" + html_str);\r\n $('#stats_Body').append(html_str);\r\n\r\n // Add the bar indicator as a third line\r\n\r\n html_str = '';\r\n html_str += '';\r\n html_str += '' + '
    ';\r\n html_str += '';\r\n $('#stats_Body').append(html_str);\r\n\r\n // Get ready for the next Reading Station\r\n iIndex += 1;\r\n\r\n });\r\n\r\n // Note the new Entity for which stats are now on display\r\n iCurrentStatsEntity = EntityNum;\r\n var rsCount = sReferenceData[EntityNum].RSData.length;\r\n if (rsCount <= 6) {\r\n $('#specific_stats').height('auto');\r\n } else {\r\n $('#specific_stats').height(6 * 77);\r\n\r\n // $('#specific_stats').height($('statsDiv').height);\r\n }\r\n console.log(\"height is \" + sReferenceData[EntityNum].RSData.length);\r\n TimedConsoleLog(\"Random RS Index\");\r\n GetRandomRSIndex();\r\n\r\n try {\r\n //TODO:$$$ May need to be reinstated\r\n // $(\"#specific_stats\").getNiceScroll().resize();\r\n }\r\n catch (err6) { }\r\n\r\n TimedConsoleLog(\"ShowEntityStats end\");\r\n\r\n }\r\n};\r\n\r\nfunction ToggleUnits(SetToUnits) {\r\n // Alternate between the various Units settings (Imperial and Metric at the time of writing)\r\n // calling the routine to redraw the appropriate map also\r\n\r\n if (SetToUnits != undefined) {\r\n sUnits = SetToUnits;\r\n };\r\n\r\n if ((sUnits == Consts.sUNIT_CODE_METRIC) || (SetToUnits == Consts.sUNIT_CODE_IMPERIAL)) {\r\n // Was Metric, go to Imperial\r\n sUnits = Consts.sUNIT_CODE_IMPERIAL;\r\n $('#unitsButton a').text(Consts.sUNIT_CODE_SWITCH_TO_METRIC);\r\n }\r\n else {\r\n // Was Imperial, go to Metric\r\n sUnits = Consts.sUNIT_CODE_METRIC;\r\n $('#unitsButton a').text(Consts.sUNIT_CODE_SWITCH_TO_IMPERIAL);\r\n }\r\n // Update the cookie\r\n $.cookie(COOKIE_UNITS, sUnits.toString(), COOKIE_DO_NOT_EXPIRE);\r\n // and update the graph\r\n //console.log (\"show graph from toggle units\");\r\n ShowGraph(iCurrentGraph);\r\n};\r\n\r\nfunction SetUnits(doSetOnly) {\r\n console.log(\"SetUnits Called\");\r\n // Determine whether default units have been set. If not, set them up with a default\r\n if (SHOW_STATS == 1) {\r\n if (sUnits == undefined) {\r\n sUnits = EmptyStringIfNull($.cookie(COOKIE_UNITS));\r\n\r\n if (!doSetOnly) {\r\n if (sUnits == \"\") {\r\n ToggleUnits(Consts.sUNIT_CODE_METRIC);\r\n } else {\r\n ToggleUnits(sUnits);\r\n };\r\n } else {\r\n if (sUnits == Consts.sUNIT_CODE_METRIC) {\r\n $('#unitsButton a').text(Consts.sUNIT_CODE_SWITCH_TO_IMPERIAL);\r\n }\r\n else {\r\n $('#unitsButton a').text(Consts.sUNIT_CODE_SWITCH_TO_METRIC);\r\n }\r\n }\r\n }\r\n }\r\n\r\n};\r\n\r\n// If the Units have changed the Y Axis \r\nfunction GetGraphImperialUnits(svrData) {\r\n // TODO: Create the modified Imperial dataset if it does not exist\r\n\r\n var theMetricMin = svrData.ticks.min;\r\n var theMetricMax = svrData.ticks.max;\r\n //var theMetricStepsize = svr.dataset.ticks.stepSize;\r\n\r\n // var theMin = (Math.floor(theMetricMin * Consts.MetricImpFactor)) - 1;\r\n // var theMax = (Math.floor(theMetricMax * Consts.MetricImpFactor)) + 1;\r\n\r\n var theMin = (Math.floor((theMetricMin * Consts.MetricImpFactor) / 2) * 2);\r\n var theMax = (Math.floor((theMetricMax * Consts.MetricImpFactor) / 2) * 2);\r\n\r\n var theStepSize = (theMax - theMin > 10) ? 2 : 1;\r\n svrData.ticks.min = theMin;\r\n svrData.ticks.max = theMax;\r\n svrData.stepSize = theStepSize;\r\n\r\n //{\r\n // \"ticks\": {\r\n // \"max\": 6, \"min\": -1, \"stepSize\":\r\n\r\n\r\n for (var i = 0; i < svrData.datasets.length; i++) {\r\n for (var j = 0; j < svrData.datasets[i].data.length; j++) {\r\n svrData.datasets[i].data[j] *= Consts.MetricImpFactor;\r\n }\r\n }\r\n //for (var eachSet of svrData.datasets) {\r\n // for (var level of eachSet) {\r\n\r\n // }\r\n //}\r\n\r\n}\r\n\r\nfunction SetGraphLegendClickHandler() {\r\n\r\n var cjsLegendClickHandler = function (e, legendItem) {\r\n var index = legendItem.datasetIndex;\r\n var cht = this.chart;\r\n var meta = cht.getDatasetMeta(index);\r\n\r\n // See controller.isDatasetVisible comment\r\n meta.hidden = meta.hidden === null ? !cht.data.datasets[index].hidden : null;\r\n\r\n console.log(\"Toggling \" + sReferenceData[iCurrentStatsEntity]['Name']);\r\n\r\n // We hid a dataset ... rerender the chart\r\n }\r\n\r\n}\r\n\r\n\r\n//*******************************************\r\n\r\n\r\nfunction SetGraphDefaults() {\r\n\r\n // Global Options:\r\n Chart.defaults.global.defaultFontColor = 'black';\r\n Chart.defaults.global.defaultFontSize = 16;\r\n //Chart.defaults.global.datasets.line.showLine = false;\r\n Chart.defaults.global.elements.line.borderWidth = 2;\r\n Chart.defaults.global.elements.line.fill = false;\r\n Chart.defaults.global.elements.line.tension = 0.1;\r\n Chart.defaults.global.elements.point.pointRadius = 10;\r\n Chart.defaults.global.elements.point.radius = 0;\r\n Chart.defaults.global.elements.point.pointHitRadius = 60;\r\n Chart.defaults.global.elements.point.pointBorderColor = \"black\";\r\n Chart.defaults.global.elements.point.pointBackgroundColor = \"white\";\r\n Chart.defaults.global.elements.point.pointBorderWidth = 1;\r\n Chart.defaults.global.elements.point.pointHoverRadius = 60;\r\n Chart.defaults.global.elements.point.pointHoverBackgroundColor = \"yellow\";\r\n Chart.defaults.global.elements.point.pointHoverBorderColor = \"blue\";\r\n Chart.defaults.global.elements.point.pointHoverBorderWidth = 1;\r\n\r\n Chart.defaults.global.hover.intersect = false;\r\n\r\n var defaultLegendClickHandler = Chart.defaults.global.legend.onClick;\r\n var newLegendClickHandler = function (e, legendItem) {\r\n var index = legendItem.datasetIndex;\r\n\r\n if (index > 1) {\r\n // Do the original logic\r\n defaultLegendClickHandler(e, legendItem);\r\n } else {\r\n var ci = this.chart;\r\n [\r\n ci.getDatasetMeta(0),\r\n ci.getDatasetMeta(1)\r\n ].forEach(function (meta) {\r\n meta.hidden = meta.hidden === null ? !ci.data.datasets[index].hidden : null;\r\n });\r\n ci.update();\r\n }\r\n };\r\n\r\n graphOptions = {\r\n //responsive: true,\r\n maintainAspectRatio: false,\r\n animation: {\r\n duration: '250'\r\n },\r\n legend: {\r\n display: true,\r\n text: 'Reading Locations',\r\n position: 'bottom',\r\n\r\n\r\n\r\n onClick: function () {\r\n Chart.defaults.global.legend.onClick.apply(this, arguments);\r\n console.log(\"Toggling \" + sReferenceData[iCurrentStatsEntity]['__Mne'] + arguments[1].text);\r\n var cookieName = GetEntityRSCookieName(sReferenceData[iCurrentStatsEntity]['__Mne'], arguments[1].text);\r\n var index = arguments[1].datasetIndex;\r\n var ci = this.chart;\r\n var meta = ci.getDatasetMeta(index);\r\n\r\n // See controller.isDatasetVisible comment\r\n // meta.hidden = meta.hidden === null ? !ci.data.datasets[index].hidden : null;\r\n //if (ci.data.datasets[index].hidden) {\r\n if (meta.hidden) {\r\n CookieAddValue(COOKIE_GL_OFF, EmptyStringIfNull($.cookie(COOKIE_GL_OFF)), cookieName);\r\n } else {\r\n CookieRemoveValue(COOKIE_GL_OFF, EmptyStringIfNull($.cookie(COOKIE_GL_OFF)), cookieName);\r\n };\r\n ci.update();\r\n },\r\n\r\n // onClick: cjsLegendClickHandler(),\r\n onHover: function (event, legendItem) {\r\n document.getElementById(\"chartCanvas\").style.cursor = 'pointer';\r\n //var ci = this.chart;\r\n //var meta = ci.getDatasetMeta(legendItem.datasetIndex);\r\n //meta.dataset._view.borderWidth = 6;\r\n //ci.update();\r\n\r\n },\r\n onLeave: function (event, legendItem) {\r\n document.getElementById(\"chartCanvas\").style.cursor = 'default';\r\n // var ci = this.chart;\r\n // var meta = ci.getDatasetMeta(legendItem.datasetIndex);\r\n //// meta.dataset._view.borderWidth = 2;\r\n // ci.update();\r\n }\r\n },\r\n\r\n title: {\r\n display: false,\r\n //text: 'TBSet'\r\n },\r\n plugins: {\r\n\r\n colorschemes: {\r\n\r\n scheme: 'brewer.Paired12'\r\n\r\n }\r\n\r\n },\r\n\r\n scales: {\r\n\r\n yAxes: [{\r\n ticks: {\r\n max: 5,\r\n min: 0,\r\n stepSize: 0.5\r\n },\r\n scaleLabel: {\r\n display: true,\r\n labelString: 'Metres',\r\n fontSize: 20\r\n }\r\n }],\r\n xAxes: [{\r\n type: 'time',\r\n distribution: 'linear',\r\n time: {\r\n unit: 'hour'\r\n }\r\n }]\r\n\r\n },\r\n tooltips: {\r\n callbacks: {\r\n label: function (tooltipItem, data) {\r\n var label;\r\n if (sUnits == Consts.sUNIT_CODE_METRIC) {\r\n // label = data.datasets[tooltipItem.datasetIndex].label || '';\r\n\r\n // if (label) {\r\n // label += ': ';\r\n // }\r\n label = (Math.round(tooltipItem.yLabel * 1000) / 1000) + \"m\";\r\n } else {\r\n label = ConvertToUnits(Math.round(tooltipItem.yLabel * 1000) / 1000,\r\n \"F\",\r\n \"F\",\r\n 8);\r\n\r\n }\r\n return data.datasets[tooltipItem.datasetIndex].label + ' ' + label;\r\n },\r\n title: function (tooltipItem, data) {\r\n return ToolTipDate(tooltipItem[0].xLabel);\r\n },\r\n labelColor: function (tooltipItem, chart) {\r\n var meta = chart.getDatasetMeta(tooltipItem.datasetIndex);\r\n console.log(\"Tis \" + meta.controller._config.backgroundColor.toString());\r\n return {\r\n //borderColor: 'rgb(255, 255, 0)',\r\n // backgroundColor: 'rgb(255, 0, 0)'\r\n backgroundColor: meta.controller._config.backgroundColor\r\n };\r\n }\r\n //labelTextColor: function (tooltipItem, chart) {\r\n // return '#543453';\r\n //}\r\n }\r\n }\r\n };\r\n\r\n}\r\n\r\n\r\nfunction DrawMHRLChart(svrData, GraphLink) {\r\n //var canvas = document.getElementById('chartCanvas');\r\n //var ctx = canvas.getContext('2d');\r\n\r\n\r\n //var data = {\r\n // //\"labels\": [\"2019-12-02 23:00:00\", \"2019-12-02 23:15:00\", \"2019-12-02 23:30:00\", \"2019-12-02 23:45:00\", \"2019-12-03 00:00:00\"],\r\n\r\n // \"labels\": [\"2019-12-02 20:00:00\", \"2019-12-02 20:15:00\", \"2019-12-02 20:30:00\", \"2019-12-02 20:45:00\", \"2019-12-02 21:00:00\", \"2019-12-02 21:15:00\", \"2019-12-02 21:30:00\", \"2019-12-02 21:45:00\", \"2019-12-02 22:00:00\", \"2019-12-02 22:15:00\", \"2019-12-02 22:30:00\", \"2019-12-02 22:45:00\", \"2019-12-02 23:00:00\", \"2019-12-02 23:15:00\", \"2019-12-02 23:30:00\", \"2019-12-02 23:45:00\", \"2019-12-03 00:00:00\"], \"datasets\": [{ \"label\": \"VYR\", \"data\": [0.373, 0.374, 0.374, 0.373, 0.375, 0.375, 0.373, 0.375, 0.375, 0.375, 0.374, 0.373, 0.373, 0.375, 0.373, 0.375, 0.374] }, { \"label\": \"PON\", \"data\": [0.419, 0.418, 0.419, 0.418, 0.419, 0.417, 0.419, 0.418, 0.417, 0.418, 0.417, 0.418, 0.417, 0.417, 0.417, 0.417, 0.417] }, { \"label\": \"MEI\", \"data\": [0.491, 0.491, 0.49, 0.493, 0.493, 0.491, 0.491, 0.489, 0.491, 0.493, 0.491, 0.489, 0.49, 0.492, 0.493, 0.49, 0.491] }, { \"label\": \"LLA\", \"data\": [0.885, 0.884, 0.883, 0.882, 0.882, 0.882, 0.882, 0.882, 0.882, 0.882, 0.882, 0.881, 0.88, 0.88, 0.879, 0.879, 0.879] }]\r\n //};\r\n\r\n // Notice the scaleLabel at the same level as Ticks\r\n\r\n // Chart declaration:\r\n //var myBarChart = new Chart(ctx, {\r\n // type: 'line',\r\n // data: svrData,\r\n // options: options\r\n //});\r\n //myBarChart.Line(svrData, options);\r\n //myBarChart.data = svrData;\r\n //myBarChart.options = options;po\r\n //myBarChart.update();\r\n\r\n //if (graphOptions === undefined) {\r\n // SetGraphDefaults();\r\n //};\r\n var cookieName;\r\n\r\n myBarChart.data.labels = svrData.labels;\r\n //TODO: Call SetGraphUnits here to return the modified Feet / Inches datatset \r\n myBarChart.options.scales.yAxes[0].scaleLabel.labelString = (sUnits == Consts.sUNIT_CODE_METRIC) ? \"Metres\" : \"Feet\";\r\n myBarChart.data.datasets = svrData.datasets;\r\n // Convert to imperial if needed;\r\n if (sUnits == Consts.sUNIT_CODE_IMPERIAL) {\r\n GetGraphImperialUnits(svrData);\r\n }\r\n var lineOffCookie = $.cookie(COOKIE_GL_OFF);\r\n for (var i = 0; i < (myBarChart.data.datasets.length); i++) {\r\n cfgName = GetEntityRSCookieName(sReferenceData[iCurrentStatsEntity]['__Mne'], myBarChart.data.datasets[i].label);\r\n if (StringContainsDelimitedValue(lineOffCookie, cfgName)) {\r\n myBarChart.data.datasets[i].hidden = true;\r\n }\r\n }\r\n // myBarChart.options = graphOptions;\r\n myBarChart.options.scales.yAxes[0].ticks = svrData.ticks;\r\n myBarChart.options.scales.yAxes[0].ticks.precision = 0;\r\n myBarChart.options.scales.yAxes[0].ticks.stepSize = undefined;\r\n\r\n myBarChart.options.scales.xAxes[0].time.unit = ((GraphLink == 1) ? \"hour\" : \"day\");\r\n myBarChart.update();\r\n\r\n}\r\n\r\n\r\n// $$\r\n\r\nfunction ShowGraph(GraphLink) {\r\n\r\n location.hash = window.pageYOffset;\r\n // location.reload(); \r\n // alert(location.hash);\r\n //TODO: $$$ Alternative Loading GIF\r\n // $(\"#stats_graph_img\").attr(\"src\", \"/loading.gif\").addClass('loading');\r\n console.log(\"Graph Click detected\");\r\n\r\n var folderName = \"Graphs_\" + $('#master_CPHbody_txtGraphFolderNo').val();\r\n\r\n // var mnemonic = $('#stats_Mnemonic').html();\r\n var mnemonic = StringExtractDelimitedSubstring($('#stats_Mnemonic').html(), '(', ')');\r\n var fileName = \"RefData/\" + folderName + \"/LatestReadings_\" + mnemonic;\r\n\r\n // toggle the highlight to the selected button and setup the image filename\r\n console.log(\"****** Graph link is \" + GraphLink);\r\n if (GraphLink == 1) {\r\n //if (sUnits == Consts.sUNIT_CODE_METRIC) {\r\n fileName += \"_Last24Hours.JSON\";\r\n //}\r\n //else {\r\n // fileName += \"_Last24HoursImp.JSON\";\r\n //}\r\n $('#G1').children(\"a:first\").addClass('highlight');\r\n $('#G2').children(\"a:first\").removeClass('highlight');\r\n //console.log (\"Showing last 24 hours \", fileName);\r\n } else if (GraphLink == 2) {\r\n //if (sUnits == Consts.sUNIT_CODE_METRIC) {\r\n fileName += \"_Last7Days.JSON\";\r\n //}\r\n //else {\r\n // fileName += \"_Last7DaysImp.JPEG\";\r\n //}\r\n $('#G1').children(\"a:first\").removeClass('highlight');\r\n $('#G2').children(\"a:first\").addClass('highlight');\r\n //console.log (\"Showing last 7 days \", fileName);\r\n }\r\n\r\n //console.log (fileName);\r\n //console.log (\"Current Graph is \", iCurrentGraph);\r\n if ((fileName !== currentChartFilename) || (currentGraphLink !== GraphLink) || (currentUnits !== sUnits)) {\r\n //TODO: $$$ Alternative Loading GIF\r\n\r\n $.getJSON(fileName,\r\n function (data) {\r\n DrawMHRLChart(data, GraphLink);\r\n })\r\n .done(function () { $('#stats_graph').show(); })\r\n .fail(function () { $('#stats_graph').hide(); });\r\n currentChartFilename = fileName;\r\n currentGraphLink = GraphLink;\r\n currentUnits = sUnits;\r\n\r\n }\r\n\r\n //$(\"#stats_graph_img\").attr(\"src\", fileName).removeClass('loading');\r\n\r\n}\r\n\r\nfunction ShowDefaultGraph() {\r\n\r\n var iGraph;\r\n console.log(\"ShowDefaultGraph called\");\r\n iGraph = ZeroIfNull($.cookie(COOKIE_DG));\r\n if (iGraph == 0) {\r\n iGraph = 1;\r\n }\r\n ShowGraph(iGraph);\r\n}\r\n\r\nfunction SetEntityListHighlight(EntityIndex, HighlightOn) {\r\n // Add or remove the 'highlight' class to/from the given EntityList item\r\n // and its associated List Item from the Favourites list if it exists\r\n\r\n console.log(TimedConsoleLog(\"SetEntityListHighlight \") + EntityIndex + \", \" + HighlightOn);\r\n var sRiverTag = Consts.sENTITY_TAG + EntityIndex;\r\n // var sFavRiverTag = Consts.sFAV_ENTITY_TAG + EntityIndex;\r\n if (HighlightOn == true) {\r\n $(sRiverTag).children(\"li:first\").addClass('highlight');\r\n $(sRiverTag).addClass('highlight');\r\n //$(sFavRiverTag).addClass('highlight');\r\n }\r\n else {\r\n $(sRiverTag).children(\"li:first\").removeClass('highlight');\r\n $(sRiverTag).removeClass('highlight');\r\n //$(sFavRiverTag).removeClass('highlight');\r\n }\r\n TimedConsoleLog(\"SetEntityListHighlight END\");\r\n}\r\n\r\nfunction TryThis(EntityIndex) {\r\n\r\n // console.log(\"Trying it for entity \" + EntityIndex.toString);\r\n\r\n if (GOOGLE_ON === 1) {\r\n mapCentre = map.getCenter();\r\n mapZoom = map.getZoom();\r\n lat = mapCentre.lat();\r\n lng = mapCentre.lng();\r\n }\r\n else if (OS_ON == 1) {\r\n mapCentre = map.getCenter();\r\n mapZoom = map.getZoom();\r\n lat = mapCentre.lat;\r\n lng = mapCentre.lon;\r\n }\r\n // alert(lat + \",\" + lng + \",\" + mapZoom);\r\n\r\n window.prompt(\"Copy to clipboard: Ctrl+C, Enter\",\r\n \"UPDATE Entity SET LocalMapLongitude = \" + lat + \", LocalMapLatitude = \" + lng + \", LocalMapZoomLevel = \" + mapZoom +\r\n \" WHERE Mnemonic = '\" + sReferenceData[iCurrentStatsEntity]['__Mne'] + \"';\");\r\n\r\n // window.prompt(\"Copy to clipboard: Ctrl+C, Enter\",\r\n // \"UPDATE Entity SET LocalMapLongitude = \" + lat + \", LocalMapLatitude = \" + lng + \", LocalMapZoomLevel = 3\" +\r\n // \" WHERE Mnemonic = '\" + sReferenceData[iCurrentStatsEntity]['__Mne'] + \"';\");\r\n\r\n // window.prompt(\"Copy to clipboard: Ctrl+C, Enter\",\r\n // \"UPDATE Entity SET LocalMapLongitude = \" + lat + \", LocalMapLatitude = \" + lng + \", LocalMapZoomLevel = \" + mapZoom +\r\n // \" WHERE Mnemonic = '\" + sReferenceData[iCurrentStatsEntity]['__Mne'] + \"';\");\r\n\r\n // window.prompt(\"Copy to clipboard: Ctrl+C, Enter\",\r\n // \"UPDATE Entity SET LocalMapLatitude = \" + lat + \", LocalMapLongitude = \" + lng + \", LocalMapZoomLevel = \" + mapZoom + mapCentre.lonlat + \r\n // \" WHERE Mnemonic = '\" + sReferenceData[EntityIndex]['__Mne'] + \"';\");\r\n\r\n}\r\n\r\nfunction TryThis2(EntityIndex) {\r\n\r\n // console.log(\"Trying it for entity \" + EntityIndex.toString);\r\n\r\n // ** Test for a polyline colour setting\r\n for (var i = 0, ilimit = arrPolyFeature[EntityIndex].length; i < ilimit; i++) {\r\n // Stempthing2 = VectorLayer.getFeaturesByAttribute('EntityID', parseInt(EntityIndex));\r\n // console.log(\"it is :\" + EntityIndex + \"_\" + i);\r\n polyFeature = VectorLayer.getFeaturesByAttribute('PolySeg', EntityIndex + \"_\" + i);\r\n // arrPolyFeature[EntityIndex][i].style.strokeColor = \"#FFFFFF\";\r\n polyFeature[0].style.strokeColor = \"#666666\";\r\n // VectorLayer.removeFeatures(VectorLayer.getFeaturesByAttribute('EntityID', parseInt(EntityIndex)));\r\n VectorLayer.redraw();\r\n }\r\n\r\n\r\n eFeature = EntityLayer.getFeaturesByAttribute('EntityID', EntityIndex);\r\n eFeature[0].renderIntent = \"select\";\r\n // eFeature[0].layer.drawFeature(eFeature);\r\n EntityLayer.redraw();\r\n // eFeature.layer.drawFeature(eFeature);\r\n\r\n\r\n}\r\n\r\nfunction MarkEntityElements(EntityIndex, HighlightOn, useZIndex) {\r\n // A Mouseover or Mouseout event has occurred on either an Entity List item, its associated polyline,\r\n // or associated marker.\r\n // Change the display characteristics of the Entity with the given EntityIndex depending on the \r\n // setting of the HighlightOn boolean\r\n // Set the associated Polyline segments to the Highlight colour or to the various colour depending on state\r\n // Set the associated Entity Marker image depending on highlight\r\n // Set the set of RS Markers as appropriate depending on highlight\r\n // Set both Entity and RS Markers with the given zIndex. An Entity losing focus should receive\r\n // zIndex 999 where as one gaining focus should receive zIndex 1000\r\n\r\n var objPolyColour = { strokeColor: \"#666666\" }; // Placeholder : Value will be changed as appropriate later\r\n var sRiverTag = Consts.sENTITY_TAG + EntityIndex;\r\n var thisPolyColourArray;\r\n var EntityImg;\r\n var objzIindex;\r\n\r\n console.log(TimedConsoleLog(\"MarkEntityElements called with : \"), EntityIndex, HighlightOn)\r\n //console.log (arrEntityMarker[EntityIndex]);\r\n\r\n if (HighlightOn == true) {\r\n // Highlight the EntityList item itself\r\n SetEntityListHighlight(EntityIndex, HighlightOn);\r\n\r\n if (MAPS_ON == 1) {\r\n if (GOOGLE_ON == 1) {\r\n EntityImg = arrEntityImages[EntityIndex]['ImgFocus'];\r\n console.log(\"Entity Highlight ON with image \", EntityImg);\r\n }\r\n else if (OS_ON == 1) {\r\n OSRenderIntent = \"select\";\r\n }\r\n }\r\n // Set appropriate zIndex\r\n // objzIndex = {zIndex:1000};\r\n }\r\n else {\r\n // $(sRiverTag).removeClass('highlight');\r\n if (MAPS_ON == 1) {\r\n if (GOOGLE_ON == 1) {\r\n EntityImg = arrEntityImages[EntityIndex]['ImgPlain'];\r\n console.log(\"Entity Highlight OFF with image \", EntityImg);\r\n }\r\n else if (OS_ON == 1) {\r\n OSRenderIntent = \"default\";\r\n }\r\n }\r\n // Set appropriate zIndex\r\n // objzIndex = {zIndex:55};\r\n }\r\n\r\n // Adjust the marker image to highlighted/non highlighted and make it visible\r\n\r\n if ((MAPS_ON == 1) && (sReferenceData[EntityIndex]['__MO'] == 1)) {\r\n // If this is a mouseover event, we are highlighting all polyline segments for this entity\r\n // with the same colour\r\n //+_+\r\n objPolyColour.strokeColor = Consts.sPOLY_COLOUR_WITH_FOCUS;\r\n thisPolyColourArray = sDynamicData[EntityIndex]['PolyColour'];\r\n\r\n if (GOOGLE_ON == 1) {\r\n if ((bLabellingAllRivers || bLabellingSelected)) {\r\n\r\n // ** Entity Marker\r\n arrEntityMarker[EntityIndex].setIcon(EntityImg);\r\n arrEntityMarker[EntityIndex].setVisible(true);\r\n }\r\n // arrEntityMarker[EntityIndex].setZIndex(objzIndex); // ^^ To sort out. This currently\r\n // produces a failure\r\n\r\n // ** Polylines\r\n\r\n // Note that there should always be one more PolyLine Section than there are Reading Stations and\r\n // hence RSData entries. This is because s ReadingStation StateColourVal is used to denote \r\n // the colour of the river from that Reading Station and upstream. Hence when you get to the last \r\n // Reading Station it is used to denote the state both above and below this Reading Station. Hence, \r\n // the need for a PolyColour array rather than using the StateColourVal in the RSData field.\r\n\r\n for (var i = 0, ilimit = thisPolyColourArray.length; i < ilimit; i++) {\r\n if (HighlightOn == false) {\r\n //+_+\r\n objPolyColour.strokeColor = ConvertColourNum(thisPolyColourArray[i]);\r\n }\r\n\r\n // Adjust all Polyline segments belonging to this Entity as appropriate\r\n if (MAPS_ON == 1) {\r\n //+_+\r\n arrPolyLines[EntityIndex][i].setOptions(objPolyColour);\r\n }\r\n //console.log(\"Setting Poly Segment for entity/segment to colour \", EntityIndex, i, objPolyColour.strokeColor);\r\n }\r\n }\r\n else if (OS_ON == 1) {\r\n if ((bLabellingAllRivers || bLabellingSelected)) {\r\n\r\n // ** Entity Marker\r\n TimedConsoleLog(\"Pre get attr by feature\");\r\n eFeature = EntityLayer.getFeaturesByAttribute('EntityID', parseInt(EntityIndex));\r\n TimedConsoleLog(\"Post get attr by feature\");\r\n eFeature[0].renderIntent = OSRenderIntent;\r\n // eFeature[0].layer.drawFeature(eFeature);\r\n TimedConsoleLog(\"Post render set\");\r\n EntityLayer.redraw();\r\n TimedConsoleLog(\"Post redraw\");\r\n\r\n // Add the current Entity to the layer selEntityLayer\r\n\r\n // selEntityLayer.addFeatures(new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(parseInt(sReferenceData[i]['Ent__EA']),\r\n // parseInt(sReferenceData[i]['Ent__NO'])),\r\n // { lbl: sReferenceData[i]['Name'], EntityID: i }));\r\n\r\n selEntityLayer.addFeatures(eFeature);\r\n if (bLabellingSelected) {\r\n selEntityLayer.redraw();\r\n }\r\n\r\n // arrEntityMarker[EntityIndex].setIcon(EntityImg);\r\n // arrEntityMarker[EntityIndex].setVisible(true);\r\n\r\n //$^$ TAKE A LOK AT ENABLING THESE AGAIN\r\n // arrEntityMarker[EntityIndex].setUrl(EntityImg);\r\n // arrEntityMarker[EntityIndex].display (true);\r\n //$^$ TAKE A LOK AT ENABLING THESE AGAIN\r\n\r\n }\r\n\r\n // ** Polylines\r\n\r\n // Note that there should always be one more PolyLine Section than there are Reading Stations and\r\n // hence RSData entries. This is because s ReadingStation StateColourVal is used to denote \r\n // the colour of the river from that Reading Station and upstream. Hence when you get to the last \r\n // Reading Station it is used to denote the state both above and below this Reading Station. Hence, \r\n // the need for a PolyColour array rather than using the StateColourVal in the RSData field.\r\n\r\n TimedConsoleLog(\"doing the poly colour array \");\r\n\r\n for (var i = 0, ilimit = thisPolyColourArray.length; i < ilimit; i++) {\r\n\r\n // Adjust all Polyline segments belonging to this Entity as appropriate\r\n if (MAPS_ON == 1) {\r\n\r\n if (HighlightOn == false) {\r\n //+_+\r\n objPolyColour.strokeColor = ConvertColourNum(thisPolyColourArray[i]);\r\n objPolyColour.strokeWidth = iDefaultStrokeWidth;\r\n }\r\n else {\r\n objPolyColour.strokeWidth = iDefaultStrokeWidth + 6;\r\n }\r\n\r\n console.log(TimedConsoleLog(\"get feature \"), i);\r\n polyFeature = VectorLayer.getFeaturesByAttribute('PolySeg', EntityIndex + \"_\" + i);\r\n console.log(TimedConsoleLog(\"stroke colour \"), i);\r\n polyFeature[0].style.strokeColor = objPolyColour.strokeColor;\r\n polyFeature[0].style.strokeWidth = objPolyColour.strokeWidth;\r\n //+_+\r\n }\r\n //console.log (\"Setting Poly Segment for entity/segment to colour \", EntityIndex, i, objPolyColour.strokeColor);\r\n }\r\n TimedConsoleLog(\"End of bits now the redraw\");\r\n console.log(TimedConsoleLog(\"redraw \"), i);\r\n VectorLayer.redraw();\r\n console.log(TimedConsoleLog(\"redraw end\"), i);\r\n TimedConsoleLog(\"doing the poly colour array done\");\r\n }\r\n }\r\n\r\n\r\n if ((MAPS_ON == 1) && (SHOW_MAP_RS == 1) && (sReferenceData[EntityIndex]['__MO'] == 1)) {\r\n //TimedConsoleLog(\"doing RS Images\");\r\n if (bLabellingAllRivers || bLabellingSelected) {\r\n // Mark all Reading Station markers as appropriate\r\n for (var i = 0, ilimit = arrEntityRSImages[EntityIndex].length; i < ilimit; i++) {\r\n // ^^ $$$ Change this to call HighlightRSMarker\r\n if (HighlightOn == true) {\r\n EntityImg = arrEntityRSImages[EntityIndex][i]['ImgFocus'];\r\n //console.log (\"RS Highlight ON entity/RS with image \", EntityIndex, i, EntityImg);\r\n }\r\n else {\r\n EntityImg = arrEntityRSImages[EntityIndex][i]['ImgPlain'];\r\n //console.log (\"RS Highlight OFF entity/RS with image \", EntityIndex, i, EntityImg);\r\n }\r\n // Adjust the RS Marker image to highlighted/non highlighted and make it visible\r\n //+_+\r\n if (MAPS_ON == 1) {\r\n if (GOOGLE_ON == 1) {\r\n // ** RS Marker\r\n arrRSMarker[EntityIndex][i].setIcon(EntityImg);\r\n arrRSMarker[EntityIndex][i].setVisible(true);\r\n }\r\n else if (OS_ON == 1) {\r\n\r\n // ** RS Marker\r\n /* \r\n rsFeature = EntityLayer.getFeaturesByAttribute('EntityID', parseInt(EntityIndex));\r\n rsFeature[0].renderIntent = OSRenderIntent;\r\n // eFeature[0].layer.drawFeature(eFeature);\r\n EntityLayer.redraw();\r\n */\r\n //console.log(TimedConsoleLog(\"Updating for \"), EntityIndex);\r\n //console.log(TimedConsoleLog(\"Image is \"), EntityImg);\r\n\r\n arrRSMarker[EntityIndex][i].setUrl(EntityImg);\r\n arrRSMarker[EntityIndex][i].display(true);\r\n\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n\r\n //TimedConsoleLog(\"Stats Entries\");\r\n // If highlighting is being removed, remove any highlight from the Stats Entries\r\n if (SHOW_STATS == 1) {\r\n if (HighlightOn == false) {\r\n $(\".stats_row_top\").removeClass('highlight');\r\n $(\".stats_row_bot\").removeClass('highlight');\r\n }\r\n\r\n // Update the stats panel with details of Reading Stations for the current Entity\r\n ShowEntityStats(EntityIndex);\r\n // Reset the \"previously selected Reading Station\" (since none are now highlighted)\r\n iPrevRSNum = Consts.NotDefined\r\n\r\n }\r\n\r\n if (HighlightOn == false)\r\n // If we were turning a highlight off, note that no timer is now running to restore Entity normal video\r\n {\r\n console.log(TimedConsoleLog(\"Highlight off ditching timer\"), iTimerEntityHighlight);\r\n iTimerEntityHighlight = Consts.NotDefined;\r\n }\r\n\r\n //console.log(TimedConsoleLog(\"MarkEntityElements END\"), iTimerEntityHighlight);\r\n};\r\n\r\nfunction ShowHideEntityRSMarkers(EntityIndex, ShowMarkers) {\r\n // Show or hide the RS Markers of the given EntityIndex\r\n if ((MAPS_ON == 1) && (SHOW_MAP_RS == 1) && (sReferenceData[EntityIndex]['__MO'] == 1)) {\r\n if (GOOGLE_ON == 1) {\r\n for (var i = 0, ilimit = arrEntityRSImages[EntityIndex].length; i < ilimit; i++) {\r\n //+_+\r\n arrRSMarker[EntityIndex][i].setVisible(ShowMarkers);\r\n }\r\n }\r\n else if (OS_ON == 1) {\r\n\r\n for (var i = 0, ilimit = arrEntityRSImages[EntityIndex].length; i < ilimit; i++) {\r\n //+_+\r\n arrRSMarker[EntityIndex][i].display(ShowMarkers);\r\n }\r\n }\r\n }\r\n}\r\n\r\nfunction HideMarkers(EntityIndex) {\r\n // Hide the Entity Markers and all RS Markers for the given Entity\r\n\r\n //console.log(TimedConsoleLog(\"HideMarkers called with : \"), EntityIndex)\r\n\r\n if ((MAPS_ON == 1) && (sReferenceData[EntityIndex]['__MO'] == 1)) {\r\n // Hide the Entity Marker unless the user has selected to label all rivers\r\n if (!bLabellingAllRivers) {\r\n //+_+\r\n if (GOOGLE_ON == 1) {\r\n arrEntityMarker[EntityIndex].setVisible(false);\r\n }\r\n }\r\n\r\n if (SHOW_MAP_RS == 1) {\r\n ShowHideEntityRSMarkers(EntityIndex, false);\r\n }\r\n if (OS_ON == 1) {\r\n EntityLayer.redraw();\r\n selEntityLayer.removeAllFeatures();\r\n }\r\n }\r\n //TimedConsoleLog(\"HideMarkers END \")\r\n};\r\n\r\nfunction ShowHideEntities(ShowHideAll, ShowHideSelected) {\r\n // Show/Hide the Entity Markers of all entities, and of the selected entity respectively\r\n\r\n //console.log(LogTime() + \" ShowHideEntities called with : \", ShowHideAll, ShowHideSelected)\r\n if (MAPS_ON == 1) {\r\n if (GOOGLE_ON == 1) {\r\n for (var i = 0, ilimit = arrEntityMarker.length; i < ilimit; i++) {\r\n\r\n // Hide or display all but the currently selected marker which should stay as it is\r\n //+_+\r\n if (sReferenceData[i]['__MO'] == 1) {\r\n arrEntityMarker[i].setVisible(ShowHideAll);\r\n }\r\n }\r\n\r\n //+_+\r\n arrEntityMarker[iCurrentStatsEntity].setVisible(ShowHideSelected);\r\n }\r\n else if (OS_ON == 1) {\r\n EntityLayer.setVisibility(ShowHideAll);\r\n selEntityLayer.setVisibility(ShowHideSelected);\r\n // EntityLayer.redraw();\r\n }\r\n ShowHideEntityRSMarkers(iCurrentStatsEntity, ShowHideSelected);\r\n }\r\n bLabellingAllRivers = ShowHideAll;\r\n bLabellingSelected = ShowHideSelected;\r\n}\r\n\r\n\r\nfunction HighlightRSMarker(EntityIndex, RSIndex, HighlightOn) {\r\n // Set the given individual RS Marker to its plain or focus image\r\n var EntityImg;\r\n\r\n //console.log(\"************ HighlightRSMarker called \", EntityIndex, RSIndex, HighlightOn);\r\n if (HighlightOn == true) {\r\n EntityImg = arrEntityRSImages[EntityIndex][RSIndex]['ImgFocus'];\r\n //console.log (\"RS Highlight ON entity/RS with image \", EntityIndex, RSIndex, EntityImg);\r\n }\r\n else {\r\n EntityImg = arrEntityRSImages[EntityIndex][RSIndex]['ImgPlain'];\r\n //console.log (\"RS Highlight OFF entity/RS with image \", EntityIndex, RSIndex, EntityImg);\r\n }\r\n // Adjust the RS Marker image to highlighted/non highlighted\r\n if ((MAPS_ON == 1) && (sReferenceData[EntityIndex]['__MO'] == 1)) {\r\n if (GOOGLE_ON == 1) {\r\n //+_+\r\n arrRSMarker[EntityIndex][RSIndex].setIcon(EntityImg);\r\n }\r\n else if (OS_ON == 1) {\r\n arrRSMarker[EntityIndex][RSIndex].setUrl(EntityImg);\r\n }\r\n }\r\n if (HighlightOn == false)\r\n // If we were turning a highlight off, note that no timer is now running to restore Entity normal video\r\n {\r\n iTimerRSHighlight = Consts.NotDefined;\r\n }\r\n\r\n}\r\n\r\nfunction ForceEntityResetTimeout(iTimerID, EntityNum) {\r\n // Cancel the existing timer with the given ID and call MarkEntityElements immediately\r\n // with the given EntityNum to turn highlighting off.\r\n // i.e. force the timer to expire in effect.\r\n\r\n //console.log (\"FOrceEntityReset called with : \", iTimerID, EntityNum);\r\n clearTimeout(iTimerID);\r\n // Mark the timer ID as undefined again\r\n iTimerEntityHighlight = Consts.NotDefined;\r\n\r\n MarkEntityElements(EntityNum, false);\r\n}\r\n\r\nfunction ForceRSResetTimeout(iTimerID, EntityIndex, RSIndex) {\r\n // Cancel the existing timer with the given ID and call HighlightRSMarker immediately\r\n // with the given RSIndex to turn highlighting off.\r\n // i.e. force the timer to expire in effect.\r\n\r\n clearTimeout(iTimerID);\r\n // Mark the timer ID as undefined again\r\n iTimerRSHighlight = Consts.NotDefined;\r\n\r\n HighlightRSMarker(EntityIndex, RSIndex, false);\r\n}\r\n\r\nfunction EntityMouseover(EntityNum) {\r\n // A Mouseover of either an Entity List item, its associated polyline or associated marker.\r\n // has taken place. \r\n // If another entity was previously highlighted, hide those elements first (however if all\r\n // Entity Markers are currently being displayed, leave the previous entity marker visible\r\n // Then highlight the new entity objects.\r\n // Calls MarkEntityElements to do the work, passing the given Element number and Highlight parameter\r\n // Set the \"Last Selected Entity\" Cookie value\r\n\r\n //console.log(TimedConsoleLog(\"EntityMouseover called for \"), EntityNum);\r\n\r\n if ((iPrevEntityNum == EntityNum) && (iTimerEntityHighlight != Consts.NotDefined))\r\n // If the same Entity as was previously highlighted is being highlighted again\r\n // and the timer request to return it to normal video is still running, cancel and restart it\r\n {\r\n //console.log(TimedConsoleLog(\"Same mouseover as before\"), iPrevEntityNum);\r\n clearTimeout(iTimerEntityHighlight);\r\n //+_+\r\n iTimerEntityHighlight = setTimeout(function () { MarkEntityElements(EntityNum, false); }, Consts.sENTITY_HIGHLIGHT_TIME_MS);\r\n return;\r\n };\r\n\r\n if (iPrevEntityNum != EntityNum)\r\n // Otherwise, if a different return the previous entity to normal state\r\n {\r\n if ((iTimerEntityHighlight != Consts.NotDefined) && (iPrevEntityNum != Consts.NotDefined)) {\r\n console.log(TimedConsoleLog(\"EM ForceEReset\"), iTimerEntityHighlight);\r\n ForceEntityResetTimeout(iTimerEntityHighlight, iPrevEntityNum)\r\n };\r\n\r\n if (iPrevEntityNum != Consts.NotDefined) {\r\n // Now hide the Entity and RS Markers\r\n TimedConsoleLog(\"EM Hiding markers\");\r\n HideMarkers(iPrevEntityNum);\r\n // including the EntityList item itself\r\n SetEntityListHighlight(iPrevEntityNum, false);\r\n }\r\n\r\n }\r\n\r\n //TimedConsoleLog(\"Pre Mark Ent Els 123\");\r\n // Now highlight the current Entity and set the reset timer again\r\n MarkEntityElements(EntityNum, true);\r\n //TimedConsoleLog(\"Post Mark Ent Els\");\r\n //+_+\r\n iTimerEntityHighlight = setTimeout(function () { MarkEntityElements(EntityNum, false); }, Consts.sENTITY_HIGHLIGHT_TIME_MS);\r\n //console.log(TimedConsoleLog(\"Timer entry id is \"), iTimerEntityHighlight);\r\n //console.log(iTimerEntityHighlight);\r\n iPrevEntityNum = EntityNum;\r\n // Set a cookie to denote the number of the Entity just selected\r\n\r\n //TimedConsoleLog(\"Cookie set\");\r\n $.cookie(COOKIE_ENTITY_LAST_SELECT, EntityNum.toString(), COOKIE_DO_NOT_EXPIRE);\r\n\r\n //TimedConsoleLog(\"EntityMouseover ended for \");\r\n}\r\n\r\nfunction ShowCookieNote() {\r\n\r\n try {\r\n if ($.cookie(COOKIE_WE_USE_COOKIES_NOTE) == null) {\r\n console.log(\"Showing Cookie Help\");\r\n $('div#pop-upCookies').show();\r\n\r\n var date = new Date();\r\n date.setTime(date.getTime() + (7 * 24 * 60 * 60 * 1000));\r\n $.cookie(\"example\", \"foo\", { expires: date });\r\n $.cookie(COOKIE_WE_USE_COOKIES_NOTE, \"Y\", { expires: date });\r\n }\r\n // else {\r\n // console.log(\"Not Showing Cookie Help\");\r\n // }\r\n }\r\n catch (cookieErr) {\r\n }\r\n}\r\n\r\n\r\nfunction SetPolyWidths(useWidth) {\r\n if (OS_ON == 1) {\r\n for (var i = 0; i < VectorLayer.features.length; i++) {\r\n VectorLayer.features[i].style.strokeWidth = useWidth;\r\n }\r\n iDefaultStrokeWidth = useWidth;\r\n }\r\n}\r\n\r\nfunction ShowHelp() {\r\n // If the general note from the server is not the emptry string and there's no cookie\r\n // to denote that it has been recently seen, then display it.\r\n // alert($('#pop-upHelpContent').html().length);\r\n // alert($.cookie(COOKIE_GENERAL_NOTE));\r\n // alert(\"[\" + $('#pop-upHelpContent').html() + \"]\");\r\n // alert(\"[\" + $('#pop-upHelpContent').html().trim() + \"]\");\r\n if (($('#pop-upHelpContent').html().trim().length != 0) && ($.cookie(COOKIE_GENERAL_NOTE)) == null)\r\n if (($('#pop-upHelpContent').html().length != 0)) {\r\n console.log(\"Showing Help\");\r\n $('div#pop-upHelp').show();\r\n $.cookie(COOKIE_GENERAL_NOTE, \"Y\", { expiresAt: new Date(new Date().getTime() + 24 * 60 * 60 * 1000) });\r\n }\r\n else {\r\n //console.log(\"Not Showing Help\");\r\n // alert(\"Leaving ShowHelp\");\r\n }\r\n}\r\n\r\nfunction updateTwitterValues(share_url, title) {\r\n // clear out the tag that's currently there...probably don't really need this since you're replacing whatever is in there already.\r\n $('#twitter-share-section').html(' ');\r\n $('#twitter-share-section').html('Tweet');\r\n //$('#twitter-share-section').html('Tweet');\r\n twttr.widgets.load();\r\n}\r\n\r\nfunction setTitleAndLinks() {\r\n var thisName = sReferenceData[iCurrentStatsEntity]['Name'];\r\n\r\n var LocTitle = \"\";\r\n var LocPage = \"\";\r\n\r\n // if (!typeof sReferenceData[iCurrentStatsEntity]['Loc'] == 'undefined') {\r\n if (!sReferenceData[iCurrentStatsEntity]['Loc'] == '') {\r\n LocTitle = \" (\" + sReferenceData[iCurrentStatsEntity]['Loc'] + \")\";\r\n LocPage = \"/\" + sReferenceData[iCurrentStatsEntity]['Loc'];\r\n }\r\n document.title = \"River \" + thisName + LocTitle + \" Levels, Map & Graphs\";\r\n\r\n $('meta[name=description]').attr('content', 'River ' + thisName + LocTitle + ' Levels, Map & Graphs, River Level Graphs (Last 24 Hours, Last 2 Weeks) & Trends');\r\n\r\n // Request.QueryString[\"River\"] + \" River Levels, Map & Graphs\";\r\n // Resintate if Twitter and FaceBook context needs to be maintained\r\n //TODO: $$$ Uncomment if Twitter and Facebook come back in\r\n //updateTwitterValues(\"http://www.rivermonitor.co.uk/\" + thisName + LocPage, document.title);\r\n\r\n //setFBUrl(\"http://www.rivermonitor.co.uk/\" + thisName + LocPage);\r\n\r\n}\r\n\r\n\r\nfunction setFBUrl(url) {\r\n\r\n sUrl = url;\r\n\r\n // url = \"http://www.facebook.com/plugins/like.php?href=\" + sUrl + \"&layout=button&action=like&show_faces=false&share=true&height=35\";\r\n // url = \"http://www.facebook.com/plugins/like.php?href=\" + sUrl + \"&layout=button_count&show_faces=false&width=400&action=like&font=arial&colorscheme=light\";\r\n document.getElementById('faceLike').setAttribute('src', url);\r\n //alert(\"url : \"+url);\r\n\r\n $('#socmed1').html(' ');\r\n $('#socmed1').html('');\r\n // $('#socmed1').html('');\r\n\r\n}\r\n\r\nfunction LLtoNE(lat, lon) {\r\n // From http://www.dorcus.co.uk/carabus/ll_ngr.html\r\n var deg2rad = Math.PI / 180;\r\n var rad2deg = 180.0 / Math.PI;\r\n var phi = lat * deg2rad; // convert latitude to radians\r\n var lam = lon * deg2rad; // convert longitude to radians\r\n a = 6377563.396; // OSGB semi-major axis\r\n b = 6356256.91; // OSGB semi-minor axis\r\n e0 = 400000; // OSGB easting of false origin\r\n n0 = -100000; // OSGB northing of false origin\r\n f0 = 0.9996012717; // OSGB scale factor on central meridian\r\n e2 = 0.0066705397616; // OSGB eccentricity squared\r\n lam0 = -0.034906585039886591; // OSGB false east\r\n phi0 = 0.85521133347722145; // OSGB false north\r\n var af0 = a * f0;\r\n var bf0 = b * f0;\r\n // easting\r\n var slat2 = Math.sin(phi) * Math.sin(phi);\r\n var nu = af0 / (Math.sqrt(1 - (e2 * (slat2))));\r\n var rho = (nu * (1 - e2)) / (1 - (e2 * slat2));\r\n var eta2 = (nu / rho) - 1;\r\n var p = lam - lam0;\r\n var IV = nu * Math.cos(phi);\r\n var clat3 = Math.pow(Math.cos(phi), 3);\r\n var tlat2 = Math.tan(phi) * Math.tan(phi);\r\n var V = (nu / 6) * clat3 * ((nu / rho) - tlat2);\r\n var clat5 = Math.pow(Math.cos(phi), 5);\r\n var tlat4 = Math.pow(Math.tan(phi), 4);\r\n var VI = (nu / 120) * clat5 * ((5 - (18 * tlat2)) + tlat4 + (14 * eta2) - (58 * tlat2 * eta2));\r\n east = e0 + (p * IV) + (Math.pow(p, 3) * V) + (Math.pow(p, 5) * VI);\r\n // northing\r\n var n = (af0 - bf0) / (af0 + bf0);\r\n var M = Marc(bf0, n, phi0, phi);\r\n var I = M + (n0);\r\n var II = (nu / 2) * Math.sin(phi) * Math.cos(phi);\r\n var III = ((nu / 24) * Math.sin(phi) * Math.pow(Math.cos(phi), 3)) * (5 - Math.pow(Math.tan(phi), 2) + (9 * eta2));\r\n var IIIA = ((nu / 720) * Math.sin(phi) * clat5) * (61 - (58 * tlat2) + tlat4);\r\n north = I + ((p * p) * II) + (Math.pow(p, 4) * III) + (Math.pow(p, 6) * IIIA);\r\n east = Math.round(east); // round to whole number\r\n north = Math.round(north); // round to whole number\r\n nstr = String(north); // convert to string\r\n estr = String(east); // ditto\r\n}\r\n\r\n\r\nfunction ConvertToUnits(sSourceLevel,\r\n sFromUnitCode,\r\n sToUnitCode,\r\n LCD) {\r\n\r\n var sReturnString = '';\r\n var bReadingPunctuation = true;\r\n var sFEET_SINGLE_INDICATOR_WORDS = \" foot\";\r\n var sINCHES_SINGLE_INDICATOR_WORDS = \" inch\";\r\n var sFEET_PLURAL_INDICATOR_WORDS = \" feet\";\r\n var sINCHES_PLURAL_INDICATOR_WORDS = \" inches\";\r\n var sFEET_SINGLE_INDICATOR_SYMBOLS = \"'\";\r\n var sINCHES_SINGLE_INDICATOR_SYMBOLS = \"\\\\\\\"\";\r\n var sFEET_PLURAL_INDICATOR_SYMBOLS = \"'\";\r\n var sINCHES_PLURAL_INDICATOR_SYMBOLS = \"\\\\\\\"\";\r\n\r\n // If the passed value is not a valid floating number, return \"-\"\r\n try {\r\n // Convert the value as necessary\r\n //if (sFromUnitCode == sToUnitCode) {\r\n // sReturnString += sSourceLevel;\r\n //}\r\n //else\r\n if ((sFromUnitCode != \"F\") || ((sToUnitCode != \"F\") && (sToUnitCode != \"I\"))) {\r\n sReturnString += sSourceLevel + \"!\";\r\n }\r\n else {\r\n var fToValue = sSourceLevel * 12;\r\n var sInches, sInchesFraction, sInchesFractionFinal;\r\n var sFEET_SINGLE_INDICATOR, sFEET_PLURAL_INDICATOR, sINCHES_SINGLE_INDICATOR, sINCHES_PLURAL_INDICATOR;\r\n var iVal, iVal2, iFeet, iValNumerator, iValDenominator;\r\n var bContinue;\r\n\r\n // Determine which units markers should be used\r\n if (bReadingPunctuation) {\r\n sFEET_SINGLE_INDICATOR = sFEET_SINGLE_INDICATOR_WORDS;\r\n sFEET_PLURAL_INDICATOR = sFEET_PLURAL_INDICATOR_WORDS;\r\n sINCHES_SINGLE_INDICATOR = sINCHES_SINGLE_INDICATOR_WORDS;\r\n sINCHES_PLURAL_INDICATOR = sINCHES_PLURAL_INDICATOR_WORDS;\r\n }\r\n else {\r\n sFEET_SINGLE_INDICATOR = sFEET_SINGLE_INDICATOR_SYMBOLS;\r\n sFEET_PLURAL_INDICATOR = sFEET_PLURAL_INDICATOR_SYMBOLS;\r\n sINCHES_SINGLE_INDICATOR = sINCHES_SINGLE_INDICATOR_SYMBOLS;\r\n sINCHES_PLURAL_INDICATOR = sINCHES_PLURAL_INDICATOR_SYMBOLS;\r\n }\r\n\r\n // Note: This routine was originally converted from javascript and used Javascript prototypes\r\n // in order to convert between any units as set up in the following data structures\r\n\r\n //var LengthOb = ({inch:12, inches:12, foot:1, feet:1, yard:0.3333333333333333, mile:0.00018938676565281618, miles:0.00018938676565281618, fathom:0.16666666666666666, nauticalMiles:0.868421, nanometre:30479999.02464003, micron:304799.9902464003, micrometre:304799.9902464003, millimetre:304.7999902464003, centimetre:30.47999902464003, metre:0.3047999902464003, kilometre:0.0003047999902464003})\r\n //Number.prototype.weight=function (s, e) {return (this * WeightOb[s]) / WeightOb[e];}\r\n //Number.prototype.distance = function (s, e) {return (this * LengthOb[e]) / LengthOb[s];}\r\n\r\n //fToValue = fValue.distance(\"metre\",\"inch\");\r\n\r\n // $^^ This C# routine currently only supports meters to inches hence the above\r\n // still needs to be implemented if other alternatives are required\r\n\r\n // The value is already in Feet (decimal)\r\n\r\n // fToValue = fValue * 12 / 0.3047999902464003;\r\n\r\n // Work out the number of feet. \r\n iFeet = Math.floor(fToValue / 12);\r\n iVal = iFeet;\r\n\r\n // reduce it to the remaining inches in decimal\r\n fToValue -= (iVal * 12);\r\n\r\n // Work out the ROUNDED number of inches in terms of its lowest common denominator. e.g. 5.5 expressed in\r\n // halves would be 11.04 i.e. 5.52 x 2\r\n iVal = Math.floor(Math.round(fToValue * LCD));\r\n // Work out full inches \r\n iVal2 = Math.floor(iVal / LCD);\r\n\r\n // $^^ If number of inches is 12, increment the number of feet and set inches to zero\r\n if (iVal2 == 12) {\r\n iFeet++;\r\n iVal2 = 0;\r\n iVal = 0;\r\n }\r\n\r\n // Even if it's zero, always say it\r\n if (iFeet == 1) {\r\n sReturnString += iFeet + sFEET_SINGLE_INDICATOR;\r\n }\r\n else {\r\n sReturnString += iFeet + sFEET_PLURAL_INDICATOR;\r\n }\r\n\r\n // If there are no full inches, only give the fractional amont\r\n // e.g. 1 1/2 and 0 3/4 should display as \"1 1/2 inches\" and \"3/4 inch\"\r\n if (iVal2 == 0) {\r\n sInches = '';\r\n }\r\n else {\r\n sInches = iVal2 + '';\r\n }\r\n // and remaining whole number which is the fraction we're after expressed as a number of LCDs\r\n iValNumerator = Math.floor(iVal) - (iVal2 * LCD);\r\n\r\n\r\n // If there's any fractional part left, reduce the fraction to its simplest form\r\n sInchesFractionFinal = '';\r\n\r\n if (iValNumerator == 0) {\r\n sInchesFraction = '';\r\n }\r\n else {\r\n // otherwise there's a fractional part left. Reduce the fraction to its simplest form\r\n bContinue = true;\r\n iValDenominator = LCD;\r\n while (bContinue == true) {\r\n iVal = Math.floor(iValNumerator / 2);\r\n iVal2 = Math.floor(iValDenominator / 2);\r\n // if ((iVal != Math.Floor((double)iVal)) || (iVal2 != Math.Floor((double)iVal2))) {\r\n if (((iVal * 2) != iValNumerator) || ((iVal2 * 2) != iValDenominator)) {\r\n bContinue = false;\r\n } else {\r\n iValNumerator = iVal;\r\n iValDenominator = iVal2;\r\n }\r\n }\r\n // Create the strings\r\n if (sInches == '') {\r\n // if (bReadingPunctuation) {\r\n // sInchesFraction += \"and \";\r\n // } else {\r\n // sInchesFraction += \" \";\r\n // }\r\n sInchesFraction = iValNumerator + \"/\" + iValDenominator;\r\n } else {\r\n sInchesFraction = iValNumerator + \"/\" + iValDenominator;\r\n }\r\n // Enclose the fraction in a span to allow a smaller font to be rendered via CSS\r\n sInchesFractionFinal = \" \" + sInchesFraction;\r\n }\r\n // Add the inches to the final return string\r\n if ((sInches != '') || (sInchesFraction != '')) {\r\n // Add the value\r\n if (bReadingPunctuation) {\r\n sReturnString += \",\";\r\n }\r\n // Add them separately to avoide a double space in certain circmstances\r\n if (sInches != '') {\r\n sReturnString += \" \" + sInches;\r\n }\r\n // If there's a fractional part, add the fraction together within a classed HTML SPAN \r\n // element to enable CSS styling on the fraction.\r\n if (sInchesFraction != '') {\r\n sReturnString += \" \" + sInchesFractionFinal;\r\n }\r\n\r\n // Decide whether it's singular or plural inches\r\n if ((sInches == '') || ((sInches == \"1\") && (sInchesFraction == ''))) {\r\n sReturnString += sINCHES_SINGLE_INDICATOR;\r\n } else {\r\n sReturnString += sINCHES_PLURAL_INDICATOR;\r\n }\r\n }\r\n }\r\n\r\n // Return the result\r\n return sReturnString;\r\n }\r\n catch (err) {\r\n return \"-\" + err.message;\r\n }\r\n\r\n}\r\n\r\nfunction ToolTipDate(dateString) {\r\n\r\n var day = '';\r\n var theDate = new Date(Date.parse(dateString));\r\n switch (theDate.getDay()) {\r\n case 0:\r\n day = \"Sun\";\r\n break;\r\n case 1:\r\n day = \"Mon\";\r\n break;\r\n case 2:\r\n day = \"Tue\";\r\n break;\r\n case 3:\r\n day = \"Wed\";\r\n break;\r\n case 4:\r\n day = \"Thu\";\r\n break;\r\n case 5:\r\n day = \"Fri\";\r\n break;\r\n case 6:\r\n day = \"Sat\";\r\n }\r\n\r\n day +=\r\n ' ' +\r\n dateString.substr(8, 2) +\r\n '/' +\r\n dateString.substr(5, 2) +\r\n '/' +\r\n dateString.substr(0, 4) +\r\n ' @ ' +\r\n dateString.substr(11, 5);\r\n return day;\r\n}","// ***********************************************************\r\n// * MHRL Project : Javascript Timing Routines *\r\n// ***********************************************************\r\n\r\n\r\n// timeAgo('2011-09-13T11:28:19+0000');\r\n\r\nfunction timeAgo(date_time, reference_date) { \r\n //to get unix timestamp\r\n// var currentDate = Math.round(+new Date()/1000);\r\n var tweetDate = Math.round(+new Date(date_time)/1000); \r\n //alert(tweetDate);\r\n var diffTime = reference_date - tweetDate;\r\n //alert(diffTime);\r\n if (diffTime < 59) return 'less than a minute ago';\r\n else if(diffTime > 59 && diffTime < 120) return 'about a minute ago';\r\n else if(diffTime >= 121 && diffTime <= 3600) return (parseInt(diffTime / 60)).toString() + ' minutes ago';\r\n else if(diffTime > 3600 && diffTime < 7200) return '1 hour ago';\r\n else if(diffTime > 7200 && diffTime < 86400) return (parseInt(diffTime / 3600)).toString() + ' hours ago';\r\n else if(diffTime > 86400 && diffTime < 172800) return '1 day ago';\r\n else if(diffTime > 172800 && diffTime < 604800) return (parseInt(diffTime / 86400)).toString() + ' days ago';\r\n else if(diffTime > 604800 && diffTime < 12089600) return '1 week ago';\r\n else if(diffTime > 12089600 && diffTime < 2630880) return (parseInt(diffTime / 604800)).toString() + ' weeks ago';\r\n else if(diffTime > 2630880 && diffTime < 5261760) return '1 month ago';\r\n else if(diffTime > 5261760 && diffTime < 31570560) return (parseInt(diffTime / 2630880)).toString() + ' months ago';\r\n else if(diffTime > 31570560 && diffTime < 63141120) return '1 year ago';\r\n else return (parseInt(diffTime / 31570560)).toString() + ' years ago';\r\n }\r\n","$(document).ready(function () {\r\n\r\n // var iCurrentStatsEntity;\r\n // var bLabellingAllRivers = false;\r\n // var bLabellingSelected = true;\r\n\r\n String.prototype.trim = function () { return this.replace(/^\\s+|\\s+$/g, ''); };\r\n //alert(\"TRIM IMPLEMENTED\");\r\n\r\n window.scrollTo(0, location.hash);\r\n // alert (\"Scrolling to \" + location.hash);\r\n jQuery(\"abbr.timeago\").timeago();\r\n $.cookie();\r\n\r\n // *******************************************************************\r\n // ***** River Entry Favourite/Unfavourite IMAGE Click Function ****** \r\n // *******************************************************************\r\n $(document).on('mousedown', '.river_entry img', function () {\r\n var thisElement = $(this);\r\n\r\n console.log(\"'.river_entry img').on('click'\", thisElement);\r\n console.log(\"Got Here\");\r\n //console.log (\" Parents 2 is \",$(this).parents().eq(2).attr('tagName'));\r\n // console.log (this);\r\n // console.log ($(this));\r\n // console.log (\"this.tagName \", this.tagName);\r\n // console.log (\"$(this).tagName \", $(this).get().tagName);\r\n\r\n // Extract the bracketed Entity Mnemonic from the previous () sibling\r\n // Note this will only work if the click item is the FavouriteMe or UnFavouriteMe image\r\n // but we call it here as we only want to call the routine once.\r\n // Try/Catch logic handles any failure\r\n\r\n // var thisMnemonic = StringExtractDelimitedSubstring(thisElement.prev().text(), ANGLE_BRACKET_LEFT, ANGLE_BRACKET_RIGHT);\r\n //$(this).parent().next().children('.entry_name').text()\r\n\r\n var entryDiv = thisElement.parent().next().children('.entry_name');\r\n var thisMnemonic = entryDiv.text();\r\n console.log(\"*************** Extracted \", thisMnemonic);\r\n //var thisLocation;\r\n //var locationDiv = entryDiv.next().children().children('.location_name');\r\n //var locDiv2 = thisElement.parent().next().children().next().children().children('.location_name');\r\n //var thisLoc2 = locDiv2.text();\r\n var thisLocation = $(this).parent().next().children('.entry_name').next().children().children('.location_name').text()\r\n if (!thisLocation) {\r\n thisLocation = '';\r\n }\r\n console.log(\"*************** Extracted \", thisLocation);\r\n\r\n if (thisElement.hasClass(\"FavouriteMe\"))\r\n // * Normal entry \"FavouriteMe\" image has been clicked\r\n {\r\n //console.log (\"FavouriteMe image clicked >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\");\r\n //console.log (\"*************** Previous sibling is \", $(this).prev().text());\r\n\r\n thisElement.addClass(\"UnFavouriteMe\");\r\n thisElement.removeClass(\"FavouriteMe\");\r\n thisElement.attr('src', 'images/UFM.png');\r\n\r\n\r\n // Add the Entity to the EntityFavourite Cookie value\r\n sEntityFave = CookieAddValue(COOKIE_ENTITY_FAVE, sEntityFave, thisMnemonic + \"$\" + thisLocation);\r\n\r\n }\r\n else if (thisElement.hasClass(\"UnFavouriteMe\"))\r\n // * Favourite entry \"UnFavouriteMe\" image has been clicked\r\n {\r\n thisElement.addClass(\"FavouriteMe\");\r\n thisElement.removeClass(\"UnFavouriteMe\");\r\n thisElement.attr('src', 'images/FM.png');\r\n\r\n // Remove the Entity from the EntityFavourite Cookie value\r\n sEntityFave = CookieRemoveValue(COOKIE_ENTITY_FAVE, sEntityFave, thisMnemonic + \"$\" + thisLocation);\r\n }\r\n\r\n SetFavouritesButtonVisibility();\r\n\r\n FavouritesSetupAndChange();\r\n // Prevent event bubbling\r\n return false;\r\n\r\n });\r\n\r\n // *******************************************************************\r\n // ***** River Entry Link Click Function ****** \r\n // *******************************************************************\r\n $(document).on('mousedown', '.river_entry_link', function () {\r\n var thisName;\r\n var thisElement = $(this);\r\n console.log(\"River Entry Link click\", thisElement);\r\n\r\n //Get the ID of the clicked item\r\n var $liItemIDAttr = thisElement.attr('id');\r\n //console.log (\"River Entry Link clicked ID attribute is \", $liItemIDAttr);\r\n // Extract the Entity number from the end of the IDe.g. from <. . . . \"id=\"fav_rli109\" or \"id=\"rli45\">\r\n var $liItemIDIndexStart = $liItemIDAttr.indexOf('rli');\r\n var $liItemID = $liItemIDAttr.substr($liItemIDIndexStart + 3);\r\n\r\n //console.log (\"Clicked ID is\", $liItemID);\r\n EntityMouseover($liItemID);\r\n // Display the default graph type 1\r\n if (SHOW_STATS == 1) {\r\n ShowDefaultGraph();\r\n }\r\n if (AUTO_MAP == 1) {\r\n SetLocalMapCentreAndZoom($liItemID);\r\n }\r\n iCurrentStatsEntity = $liItemID;\r\n $.cookie(COOKIE_ENTITY_LAST_SELECT, iCurrentStatsEntity.toString(), COOKIE_DO_NOT_EXPIRE);\r\n\r\n setTitleAndLinks();\r\n // setFBUrl(\"http://www.rivermonitor.co.uk/help.aspx\");\r\n\r\n // thisName = sReferenceData[iCurrentStatsEntity]['Name'];\r\n // document.title = thisName + \" River Levels\";\r\n\r\n // updateTwitterValues(\"http://www.rivermonitor.co.uk/\" + thisName, document.title)\r\n // //updateTwitterValues(share_url, title)\r\n\r\n //$('#twitter-share-button').attr(\"data-url\", \"http://www.rivermonitor.co.uk/\" + thisName);\r\n\r\n $('#RListDiv').hide();\r\n $('#inputSearch').val('');\r\n\r\n return false;\r\n });\r\n\r\n\r\n // $('#unitsButton').bind('click', function () {\r\n $(document).on('click', '#unitsButton', function () {\r\n var thisElement = $(this);\r\n console.log(\"Units Button click\", thisElement);\r\n console.log(\"UnitsBUtton clicked with current graph = \", iCurrentGraph);\r\n ToggleUnits();\r\n ShowEntityStats(iCurrentStatsEntity, true);\r\n\r\n console.log(\"UnitsBUtton clicked and graph just displayed with graph = \", iCurrentGraph);\r\n return false;\r\n });\r\n\r\n //\r\n // TODO: Add generic mouseover logic for Stats Entry to highlight RS Marker\r\n //\r\n\r\n // $('[id^=\"stats_row\"]').live('mouseover', function () {\r\n $(document).on('mouseover', '[id^=\"stats_row\"]', function () {\r\n var thisElement = $(this);\r\n console.log(\"RS Stats entry mouseover\", thisElement);\r\n\r\n //Get the ID of the clicked item\r\n var $trItemIDAttr = thisElement.attr('id');\r\n //console.log (\"Stats Entry Link clicked ID attribute is \", $trItemIDAttr);\r\n // Extract the RS number from the end of the IDe.g. from <. . . . \"id=\"stats_row_bot__3\" or \"id=\"stats_row_bot__12\">\r\n var $trItemIDIndexStart = $trItemIDAttr.indexOf('__');\r\n var $trItemID = $trItemIDAttr.substr($trItemIDIndexStart + 2);\r\n\r\n //console.log (\"Clicked Stats Row ID is\", $trItemID);\r\n RSFocus(iCurrentStatsEntity, $trItemID, true);\r\n });\r\n\r\n // ***************************************************************\r\n // ***** Show Favourites Only / Show All link Click Function ***** \r\n // ***************************************************************\r\n // $(\"#FavouritesOnly\").bind('click', function () {\r\n //TODO:$$$ DELETE this event - now based on the Search Input box\r\n //$(document).on('click', \"#FavouritesOnly\", function () {\r\n // ToggleFavourite($(this));\r\n //});\r\n\r\n\r\n // $(\"#QFavouritesOnly\").bind('click', function () {\r\n $(document).on('click', \"#QFavouritesOnly\", function () {\r\n var thisElement = $(this);\r\n console.log(\"Favourites Only click\", thisElement);\r\n\r\n if (thisElement.hasClass(\"ShowAll\")) {\r\n console.log(\"Doing Show All\");\r\n // Currently showing Favourites only, now Show All\r\n $(thisElement).removeClass(\"FavouritesOnly\");\r\n $('#RList a').slideDown(\"slow\");\r\n $('#FavouritesOnly').text('Favourites');\r\n $('#FavouritesOnly').removeClass('ShowAll');\r\n $('#FavouritesOnly').addClass('FavesOnly');\r\n }\r\n else {\r\n // Currently showing all, now Show Favourites only\r\n console.log(\"Doing Faves Only\");\r\n $(thisElement).addClass(\"FavouritesOnly\");\r\n $('#FavouritesOnly').text('Show All');\r\n $('#FavouritesOnly').removeClass('FavesOnly');\r\n $('#FavouritesOnly').addClass('ShowAll');\r\n console.log(\"The parent is \", $('#RList a img.FavouriteMe').parents().eq(2));\r\n // $('#RList a img.FavouriteMe').parents().eq(2).slideUp();\r\n $('#RList a img.FavouriteMe').each(function () {\r\n $(this).parents().eq(2).slideUp(\"slow\");\r\n });\r\n // $('#FavouritesOnly a').text('Show All Rivers\\\"\"');\r\n }\r\n return false;\r\n });\r\n\r\n\r\n // Create new Entity List Dropdown of Entities containing the given search string\r\n function FilterEntities(useSearch) {\r\n var newDropdownHTML = \"\";\r\n var addDiv = true;\r\n var divOffset, entityStartOffset, entityEndOffset, nextDiv, thisEntity, searchTitle, isAFavourite;\r\n\r\n upTo = 0;\r\n divOffset = 0;\r\n nextDiv = 0;\r\n console.log(\"Starting\");\r\n var search = $('#inputSearch').val().trim().toUpperCase();\r\n nextDiv = 0;\r\n console.log(\"Searching [\" + search + \"]\");\r\n\r\n nextDiv = 0;\r\n if (useSearch && (search.length <= 1)) {\r\n // $('#RList').html(fullEntityList);\r\n // $('#RListDropdown').html(fullEntityList);\r\n // $('#RListHeadCont').html(fullEntityList);\r\n $('#RListDiv').hide();\r\n } else {\r\n if (useSearch) {\r\n\r\n // ***********************\r\n if (workerSearch != undefined) {\r\n //workerFave.terminate();\r\n }\r\n else {\r\n workerSearch = new Worker('..\\\\js\\\\workerSearch.js');\r\n workerSearch.addEventListener('message',\r\n function (event) {\r\n TimedConsoleLog(\"Back with that Search \" + event.data.length);\r\n searchTitle = (event.data.length == 0 ? \"No Matches\" : \"Search Matches\");\r\n $('#RListHeadCont').html(event.data);\r\n });\r\n workerSearch.addEventListener('error', function (event) {\r\n TimedConsoleLog(\"*************** FAILED with those Searches\");\r\n console.error('error received from workerSearch => ', event);\r\n });\r\n }\r\n TimedConsoleLog(\"Posting to worker\");\r\n workerSearch.postMessage({ entityList: fullEntityList, entitySearch: search, entityCookie: $.cookie(COOKIE_ENTITY_FAVE) });\r\n TimedConsoleLog(\"Back from posting\");\r\n\r\n\r\n // ******************************\r\n\r\n\r\n // Fill the dropdown list based on Entity search criteria\r\n // CODE WOZ ERE\r\n\r\n }\r\n else {\r\n // Fill the dropdown with Favourites\r\n searchTitle = \"Favourites\";\r\n $('#RListHeadCont').html(FavouritesHTML);\r\n $('#inputSearch').val('');\r\n }\r\n\r\n $('#RListHead').html(searchTitle);\r\n\r\n // $('#RList').html(newDropdownHTML);\r\n // $('#RListDropdown').html(newDropdownHTML);\r\n $('#RListDiv').show();\r\n }\r\n\r\n console.log(\"Ending\");\r\n }\r\n\r\n function SearchSetupAndChange() {\r\n\r\n\r\n }\r\n\r\n function FavouritesSetupAndChange() {\r\n if (workerFave != undefined) {\r\n //workerFave.terminate();\r\n }\r\n else {\r\n workerFave = new Worker('..\\\\js\\\\workerFavourites.js');\r\n workerFave.addEventListener('message',\r\n function (event) {\r\n TimedConsoleLog(\"Back with those Favourites\");\r\n FavouritesHTML = event.data;\r\n });\r\n workerFave.addEventListener('error', function (event) {\r\n TimedConsoleLog(\"*************** FAILED with those Favourites\");\r\n console.error('error received from workerFave => ', event);\r\n });\r\n }\r\n TimedConsoleLog(\"Posting to worker\");\r\n workerFave.postMessage({ entityList: fullEntityList, entityCookie: $.cookie(COOKIE_ENTITY_FAVE) });\r\n TimedConsoleLog(\"Back from posting\");\r\n }\r\n\r\n function SetFavouritesButtonVisibility() {\r\n let cookieFave = $.cookie(COOKIE_ENTITY_FAVE);\r\n if ((cookieFave != null) && (cookieFave.length > 0)) {\r\n $('#btnFavourites').prop('disabled', false);\r\n }\r\n else {\r\n $('#btnFavourites').prop('disabled', true);\r\n }\r\n }\r\n\r\n\r\n //*******************************************\r\n\r\n function DrawSampleChart() {\r\n console.log(\"*********************** DRAWING THE GRAPH\");\r\n var ctx = document.getElementById('chartCanvas');\r\n var myChart = new Chart(ctx, {\r\n type: 'bar',\r\n data: {\r\n labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],\r\n datasets: [{\r\n label: '# of Votes',\r\n data: [12, 19, 3, 5, 2, 3],\r\n backgroundColor: [\r\n 'rgba(255, 99, 132, 0.2)',\r\n 'rgba(54, 162, 235, 0.2)',\r\n 'rgba(255, 206, 86, 0.2)',\r\n 'rgba(75, 192, 192, 0.2)',\r\n 'rgba(153, 102, 255, 0.2)',\r\n 'rgba(255, 159, 64, 0.2)'\r\n ],\r\n borderColor: [\r\n 'rgba(255, 99, 132, 1)',\r\n 'rgba(54, 162, 235, 1)',\r\n 'rgba(255, 206, 86, 1)',\r\n 'rgba(75, 192, 192, 1)',\r\n 'rgba(153, 102, 255, 1)',\r\n 'rgba(255, 159, 64, 1)'\r\n ],\r\n borderWidth: 1\r\n }]\r\n },\r\n options: {\r\n scales: {\r\n yAxes: [{\r\n ticks: {\r\n beginAtZero: true\r\n }\r\n }]\r\n }\r\n }\r\n });\r\n console.log(\"*********************** DONE DRAWIN\");\r\n\r\n }\r\n\r\n // ***************************************************************\r\n // ***** Show Favourites Only / Show All link Click Function ***** \r\n // ***************************************************************\r\n // $(\"#RunTest\").bind('click', function () {\r\n $(document).on('click', \"#RunTest\", function () {\r\n // Show all Entity and RS markers\r\n TryThis(42);\r\n });\r\n\r\n // $(\"#MarkersAll\").bind('click', function () {\r\n $(document).on('click', \"#MarkersAll\", function () {\r\n // Show all Entity and RS markers\r\n ShowHideEntities(true, true);\r\n return false;\r\n });\r\n\r\n // $(\"#MarkersNone\").bind('click', function () {\r\n $(document).on('click', \"#MarkersNone\", function () {\r\n // Show all Entity and RS markers\r\n ShowHideEntities(false, false);\r\n return false;\r\n });\r\n\r\n // $(\"#MarkersSelected\").bind('click', function () {\r\n $(document).on('click', \"#MarkersSelected\", function () {\r\n // Show all Entity and RS markers\r\n ShowHideEntities(false, true);\r\n return false;\r\n });\r\n\r\n // ^^ Delete the below once done\r\n // $(\"#MarkersToggle\").bind('click', function () {\r\n $(document).on('click', \"#MarkersToggle\", function () {\r\n var thisElement = $(this);\r\n\r\n if (thisElement.hasClass(\"LabelAll\")) {\r\n console.log(\"Doing Show All\");\r\n // Currently showing only the Entity with the focus, now Show All\r\n ShowHideEntities(true);\r\n //$('#MarkersToggle a').text('Label Selected River');\r\n $(thisElement).removeClass('LabelAll');\r\n }\r\n else {\r\n // Currently showing all, now Show Favourites only\r\n console.log(\"Doing Faves Only\");\r\n ShowHideEntities(false);\r\n //$('#MarkersToggle a').text('Label All Rivers');\r\n $(thisElement).addClass('LabelAll');\r\n }\r\n return false;\r\n });\r\n\r\n // ***** Set Default Map Position\r\n // $(\"#SetDefaultMap\").bind('click', function () {\r\n $(document).on('click', \"#SetDefaultMap\", function () {\r\n SaveMapCentreAndZoom();\r\n });\r\n\r\n // ***** Show Default Map Position\r\n // $(\"#ShowDefaultMap\").bind('click', function () {\r\n $(document).on('click', \"#ShowDefaultMap\", function () {\r\n SetMapCentreAndZoomToDefault(false);\r\n });\r\n\r\n $(\"#menu li\").hover(function () {\r\n console.log(\"menu_li hover\");\r\n $(this).find(\"ul\").show(\"fast\");\r\n }, function () {\r\n $(this).find(\"ul\").hide(\"fast\");\r\n });\r\n\r\n // $(\".mapButton\").bind('click', function () {\r\n $(document).on('click', \".mapButton\", function () {\r\n\r\n var iGraphType;\r\n console.log(\"mapButton live click\");\r\n var thisElement = $(this);\r\n\r\n if (thisElement.attr(\"id\") == \"G1\") { iGraphType = 1; }\r\n else if (thisElement.attr(\"id\") == \"G2\") { iGraphType = 2; }\r\n\r\n // This routine appears to be triggered when the Favourites / Show All button is hit\r\n // and therefore tries to redisplay the current graph but $(this) is not the G1/G2 Span element\r\n // hence iGraphType remains undefined. The Graph fails to display and no image is then displayed\r\n if (iGraphType != undefined) {\r\n // Display the graph\r\n ShowGraph(iGraphType);\r\n\r\n // Update the cookie\r\n $.cookie(COOKIE_DG, iGraphType.toString(), COOKIE_DO_NOT_EXPIRE);\r\n }\r\n return false;\r\n });\r\n\r\n SetFavouritesButtonVisibility();\r\n\r\n SetGraphLegendClickHandler();\r\n\r\n $(document).on('click', \"#btnFavourites\", function () {\r\n if ($('#RListDiv').is(':visible')) {\r\n $('#RListDiv').hide();\r\n } else {\r\n FilterEntities(false);\r\n }\r\n });\r\n\r\n $(document).on('keyup', \"#inputSearch\", function () {\r\n\r\n clearTimeout(searchTimer);\r\n searchTimer = setTimeout(function () { FilterEntities(true); }, Consts.sENTITY_SEARCH_START_MS);\r\n });\r\n\r\n\r\n $(document).on('blur', \"#inputSearch\", function () {\r\n $('#inputSearch').val('');\r\n FilterEntities(true);\r\n });\r\n\r\n $(document).on('blur', \"#btnFavourites\", function () {\r\n $('#inputSearch').val('');\r\n FilterEntities(true);\r\n });\r\n\r\n // ******************************************\r\n // ************ Main Entry Point ************\r\n // ******************************************\r\n\r\n console.log(\"Into the code\");\r\n\r\n //var fullEntityList = $(\"#RList\").val();\r\n var fullEntityList = $(\"#master_CPHbody_txtRiverList\").val();\r\n\r\n // Highlight the host page in the navigation menu\r\n //TODO:$$$ To remove?\r\n $(\"#navRiverMap\").addClass('menu_highlight');\r\n\r\n $(\".RiversAdImg1 img\").attr(\"src\", $('#master_CPHbody_txtGRP1DataFile').val());\r\n $(\".RiversAdImg2 img\").attr(\"src\", $('#master_CPHbody_txtGRP2DataFile').val());\r\n\r\n // $(\"a#popupClose\").live('click', function() {\r\n $(document).on('click', \"a#popupClose\", function () {\r\n $('div#pop-upHelp').hide();\r\n });\r\n // $(\"a#popupCloseCookies\").live('click', function() {\r\n $(document).on('click', \"a#popupCloseCookies\", function () {\r\n $('div#pop-upCookies').hide();\r\n });\r\n\r\n //TODO:Take me out\r\n //FilterEntities();\r\n //DrawSampleChart();\r\n //DrawMHRLChart();\r\n //myBarChart = new Chart(ctx, {\r\n // type: 'line',\r\n // data: svrData,\r\n // options: options\r\n //});\r\n\r\n var canvas = document.getElementById('chartCanvas');\r\n var ctx = canvas.getContext('2d');\r\n SetGraphDefaults();\r\n myBarChart = new Chart(ctx,\r\n {\r\n type: 'line',\r\n options: graphOptions\r\n });\r\n\r\n\r\n var dialogOpts = {\r\n autoopen: true,\r\n modal: true\r\n };\r\n\r\n // $('#dlgCookies').dialog(dialogOpts);\r\n\r\n if (MAPS_ON == 1) {\r\n //+_+\r\n if (GOOGLE_ON == 1) {\r\n mapLatlng = new google.maps.LatLng(52.696361078274485, -2.757568359375); // Shrewsbury, England\r\n mapOptions = {\r\n \"streetViewControl\": false,\r\n \"scrollwheel\": false,\r\n \"zoom\": 5,\r\n \"center\": mapLatlng,\r\n \"mapTypeId\": google.maps.MapTypeId.HYBRID\r\n };\r\n }\r\n //+_+\r\n else if (OS_ON == 1) {\r\n //+_+\r\n\r\n //+_+\r\n console.log(\"Var Mapping\");\r\n\r\n layerListeners = {\r\n featureclick: function (e) {\r\n OSlogit(e.object.name + \" layerlisterner says individually: \" + e.feature.id + \" clicked.\");\r\n return false;\r\n },\r\n nofeatureclick: function (e) {\r\n OSlogit(e.object.name + \" layerlisterner says individually: No feature clicked.\");\r\n }\r\n };\r\n\r\n Entitystyle = new OpenLayers.StyleMap({\r\n 'default': OpenLayers.Util.applyDefaults(\r\n { \"label\": \"${lbl}\", \"pointRadius\": 10 },\r\n OpenLayers.Feature.Vector.style[\"default\"]),\r\n 'select': OpenLayers.Util.applyDefaults(\r\n { \"pointRadius\": 15 },\r\n OpenLayers.Feature.Vector.style.select)\r\n });\r\n RSstyle = new OpenLayers.StyleMap({\r\n 'default': OpenLayers.Util.applyDefaults(\r\n { \"label\": \"${lbl}\", \"pointRadius\": 30 },\r\n OpenLayers.Feature.Vector.style[\"default\"]),\r\n 'select': OpenLayers.Util.applyDefaults(\r\n { \"pointRadius\": 50 },\r\n OpenLayers.Feature.Vector.style.select)\r\n });\r\n Polystyle = new OpenLayers.StyleMap({\r\n 'select': OpenLayers.Util.applyDefaults(\r\n { \"pointRadius\": 50 },\r\n OpenLayers.Feature.Vector.style.select)\r\n });\r\n\r\n EntityLayer = new OpenLayers.Layer.Vector(\"River Mkrs\", {\r\n \"styleMap\": Entitystyle,\r\n \"visibility\": false,\r\n \"eventListeners\": layerListeners\r\n });\r\n\r\n //$^$ Check whether the separate layer is needed?\r\n selEntityLayer = new OpenLayers.Layer.Vector(\"Selected River Mkr\", {\r\n \"styleMap\": Entitystyle,\r\n \"visibility\": true,\r\n \"eventListeners\": layerListeners\r\n });\r\n\r\n RSLayer = new OpenLayers.Layer.Markers(\"Gauge Mkrs\", {});\r\n\r\n // styleMap: RSstyle,\r\n // eventListeners: layerListeners\r\n // });\r\n\r\n VectorLayer = new OpenLayers.Layer.Vector(\"River Courses\", {\r\n \"styleMap\": Polystyle,\r\n \"eventListeners\": layerListeners\r\n });\r\n\r\n function log(msg) {\r\n console.log(msg);\r\n }\r\n\r\n console.log(\"Mapping mappoint\");\r\n // mapLatlng = new OpenLayers.LonLat(290293, 751020); // Aberfeldy\r\n console.log(\"Mapping options\");\r\n mapOptionsOld = { \"resolutions\": [2500, 1000, 500, 200, 100, 50, 25, 10, 5, 4, 2.5, 2, 1] };\r\n // mapOptions = { resolutions: [5, 4, 2.5, 2, 1] };\r\n /* console.log(\"Mapping layer\");\r\n vectorLayer = new OpenLayers.Layer.Vector(\"Vector Layer\");\r\n markerLayer = new OpenLayers.Layer.Markers(\"Marker Layer\"); */\r\n //markerLayer = OpenLayers.Layer.Markers(); // +__+\r\n\r\n //+_+\r\n\r\n }\r\n }\r\n\r\n console.log(\"River map created\");\r\n console.log (ConvertToUnits(.334,\r\n \"M\",\r\n \"F\",\r\n 8));\r\n\r\n var objzIndex = { zIndex: 0 };\r\n var iNextInt = 10000;\r\n objzIndex.zIndex = iNextInt;\r\n\r\n //ShowCookieNote();\r\n ShowHelp();\r\n\r\n if (MAPS_ON == 1) {\r\n if (GOOGLE_ON == 1) {\r\n map = new google.maps.Map(document.getElementById(\"map_canvas\"), mapOptions);\r\n }\r\n //+_+\r\n else if (OS_ON == 1) {\r\n\r\n //+_+\r\n\r\n console.log(\"Map being created\");\r\n\r\n // var map, layer,\r\n key = \"E59F31060C673345E0430B6CA40A0D79\",\r\n OSHQ = {\r\n WGS84: [50.936715, -1.4701989],\r\n OSGB: [437324, 115386]\r\n },\r\n zoom = 5;\r\n\r\n /* $$$ */\r\n // map = new OpenLayers.Map('map_canvas');\r\n\r\n layer = new OpenLayers.Layer.OSOpenSpace(\"OS Openspace\", key, {});\r\n\r\n // map.addLayer(layer);\r\n\r\n // map.setCenter(new OpenLayers.LonLat(OSHQ.OSGB), zoom);\r\n // map.addControl(new OpenLayers.Control.LayerSwitcher());\r\n /* $$$ */\r\n\r\n\r\n\r\n map = new OpenLayers.Map(\"map_canvas\", {\r\n \"resolutions\": [2500, 1000, 500, 200, 100, 50, 25, 10, 5, 4, 2.5, 2, 1],\r\n \"div\": \"map\",\r\n \"allOverlays\": true,\r\n \"layers\": [layer, EntityLayer, RSLayer, VectorLayer],\r\n \"zoom\": 2,\r\n \"center\": new OpenLayers.LonLat(OSHQ.OSGB),\r\n \"eventListeners\": {\r\n \"featureover\": function (e) {\r\n console.log(\"Entered FIRED\");\r\n // alert(\"Entered \" + e.feature.geometry.attributes.EntityID);\r\n e.feature.renderIntent = \"select\";\r\n e.feature.layer.drawFeature(e.feature);\r\n OSlogit(\"Map says: Pointer entered \" + e.feature.id + \" on \" + e.feature.layer[\"name\"]);\r\n EntityMouseover(e.feature.attributes[\"EntityID\"]);\r\n // Display the default graph type 1\r\n if (SHOW_STATS == 1) {\r\n ShowDefaultGraph();\r\n }\r\n },\r\n \"featureout\": function (e) {\r\n console.log(\"Out FIRED\");\r\n // alert(\"Out \" + e.feature.geometry.attributes.EntityID);\r\n e.feature.renderIntent = \"default\";\r\n e.feature.layer.drawFeature(e.feature);\r\n OSlogit(\"Map says: Pointer left \" + e.feature.id + \" on \" + e.feature.layer[\"name\"]);\r\n },\r\n \"featureclick\": function (e) {\r\n console.log(\"Click FIRED\");\r\n // alert(\"Clicked \" + e.feature.geometry.attributes.EntityID);\r\n console.log(\"Click FIRED\");\r\n OSlogit(\"Map says: \" + e.feature.id + \" clicked on \" + e.feature.layer[\"name\"]);\r\n }\r\n }\r\n });\r\n\r\n\r\n\r\n function OSlogit(msg) {\r\n console.log(msg);\r\n }\r\n console.log(\"Setting centre\");\r\n // map.setCenter(new OpenLayers.LonLat(mapLatlng), 1);\r\n // map.addLayer(VectorLayer);\r\n console.log(\"Layer adding\");\r\n // map.addLayer(EntityLayer);\r\n map.addLayer(layer);\r\n //map.addControl(new OpenLayers.Control.LayerSwitcher());\r\n // map.addControl(new OpenLayers.Control.LayerSwitcher());\r\n //+_+\r\n\r\n map.events.register('zoomend', this, function (event) {\r\n var zoom = map.getZoom();\r\n console.log(\"Detected Zoom change \" + zoom);\r\n if (zoom > 5) {\r\n SetPolyWidths(10);\r\n }\r\n else if (zoom > 3) {\r\n SetPolyWidths(8);\r\n }\r\n else if (zoom > 2) {\r\n SetPolyWidths(6);\r\n }\r\n else {\r\n SetPolyWidths(2);\r\n // VectorLayer.styleMap.styles.select.defaultStyle.strokeWidth = 2; // \r\n // VectorLayer.styleMap.styles.default.defaultStyle.strokeWidth = 2; // \r\n }\r\n VectorLayer.redraw();\r\n });\r\n\r\n }\r\n SetMapCentreAndZoomToDefault(false);\r\n }\r\n try {\r\n console.log(\"Getting Ref Data\");\r\n //alert(\"Getting Ref Data\");\r\n console.log(\"TestButtonCheck\");\r\n\r\n if ($.cookie(\"MHRLTestButton\") != \"ON\") {\r\n $('#RunTest').hide();\r\n }\r\n\r\n console.log(\"Determine Ref Filename\");\r\n var filenameRef = $('#master_CPHbody_txtJSONRefFile').val();\r\n console.log(filenameRef);\r\n\r\n // Load in and assign the Reference Data JSON string \r\n //$.getJSON('RefData/RLReferenceData_111.json?c=1', function (data) {\r\n $.getJSON(filenameRef, function (data) {\r\n console.log(\"Ref Data here\");\r\n //alert(\"Ref Data here\");\r\n sReferenceData = data;\r\n\r\n var favTrigger = new Object();\r\n var iDefaultEntry = -1; // Default Entry to display stats for\r\n var bRiverLocationMatch = false;\r\n var bRiverMatch = false;\r\n var DfltMne = $('#master_CPHbody_txtDfltMne').val().toUpperCase();\r\n var DfltLoc = $('#master_CPHbody_txtDfltLoc').val().toUpperCase();\r\n console.log(\"************** Dflt Mne \", DfltMne);\r\n\r\n // Create the entity list with appropriate graphics and populate the Favourites\r\n // section based on the contents of the cookie\r\n $.each(data, function (entryIndex, entry) {\r\n // Check whether the Entity Mnemonic exists within the EntityFave Cookie string.\r\n // If so, trigger the \"FavouriteMe\" click event \r\n //^^ CHECK THIS! Should just change the image\r\n if (CookieContainsDelimitedValue(COOKIE_ENTITY_FAVE, entry['Name'])) {\r\n favTrigger[entry['Name']] = '#rli' + entryIndex + ' .FavouriteMe';\r\n // //console.log (\"Added \", favTrigger[entry['__Mne']]);\r\n }\r\n // console.log (\"Made it to the end of Entity List $.each loop\");\r\n\r\n //console.log (\"!!!! Dflt test \", DfltMne, \" : \", entry['Name']);\r\n\r\n\r\n //console.log(\"Dfltmne/Loc is [\" + DfltMne + \"/\" + DfltLoc + \"] this name is [\" + entry['Name'] + \"/\" + entry['Loc']);\r\n //console.log(\"bRiverLocationMatch / bRiverMatch is [\" + bRiverLocationMatch.toString() + \"/\" + bRiverMatch);\r\n if (!bRiverLocationMatch) {\r\n try {\r\n if ((DfltMne == entry['Name'].toUpperCase()) && (DfltLoc == entry['Loc'].toUpperCase())) {\r\n iDefaultEntry = entryIndex;\r\n bRiverLocationMatch = true;\r\n }\r\n }\r\n catch (RLerr) { }\r\n\r\n if ((!bRiverMatch) && (!bRiverLocationMatch) && (DfltMne == entry['Name'].toUpperCase())) {\r\n iDefaultEntry = entryIndex;\r\n bRiverMatch = true;\r\n }\r\n }\r\n });\r\n\r\n console.log(\"Getting Static Data\");\r\n\r\n var filenameDyn = $('#master_CPHbody_txtJSONDynFile').val();\r\n // Load in and process the Dynamic Data JSON string \r\n //$.getJSON('RefData/RLDynamicData_111.json?c=1', function (data) {\r\n $.getJSON(filenameDyn, function (data) {\r\n var html, sFaveWorkList, sNextFave;\r\n var thisColourVal;\r\n console.log(\"About to parse\");\r\n\r\n sDynamicData = data;\r\n // Create the Entity Markers, RS Markers and Polylines on the Map canvas\r\n DisplayPolyLines();\r\n\r\n console.log(\"About to retrieve the Fave coookie\");\r\n // Retrieve the various cookie values : list of favourites, last selected entity,\r\n // Default Units\r\n sEntityFave = EmptyStringIfNull($.cookie(COOKIE_ENTITY_FAVE));\r\n iEntityLastSelect = ZeroIfNull($.cookie(COOKIE_ENTITY_LAST_SELECT));\r\n iCurrentGraph = ZeroIfNull($.cookie(COOKIE_DG));\r\n\r\n SetUnits(true);\r\n\r\n // ^^ Original locatin of favourite settings from cookie using entry['__Mne']\r\n\r\n\r\n console.log(\"favtrigger start\");\r\n sFaveWorkList = sEntityFave;\r\n\r\n while (sFaveWorkList != \"\") {\r\n sNextFave = GetNextDelimitedValue(sFaveWorkList, Consts.sDELIMITER_BAR);\r\n console.log(\"Next Fave is \", sNextFave);\r\n\r\n MarkFavourite(favTrigger[sNextFave]);\r\n // $(favTrigger[sNextFave]).trigger('click');\r\n sFaveWorkList = sFaveWorkList.substr(sNextFave.length + 1);\r\n // If the default entry to display hasn't yet been set, set it.\r\n // This will therefore be the top entry in the Favourites list\r\n if ((iDefaultEntry == -1) && (bFavouritesOn == true)) {\r\n // Extract the number from the ID / Imagename combo. e.g. \"#rli4 .FavouriteMe\"\r\n // iDefaultEntry = favTrigger[sNextFave].substr (\"#rli\".length, \r\n // favTrigger[sNextFave].indexOf (Consts.sSPACE));\r\n\r\n // try {\r\n // iDefaultEntry = favTrigger[sNextFave].substr(Consts.iRIVER_LINK_LEN,\r\n // favTrigger[sNextFave].indexOf(Consts.sSPACE) - Consts.iRIVER_LINK_LEN);\r\n // console.log (\"Default ENtry SET AT ____________________ \", iDefaultEntry);\r\n // }\r\n // catch (exception) {\r\n // }\r\n }\r\n }\r\n\r\n // If the default entry to display hasn't yet been set (i.e. there\r\n // are no favourites), set it to the last river selected, or if that isn't\r\n // defined, to the first Entry in the list\r\n // ^^ Alternatively, the \"River of the Day\" - future enhancement maybe\r\n if (iDefaultEntry == -1) {\r\n if (iEntityLastSelect != null) {\r\n iDefaultEntry = iEntityLastSelect;\r\n console.log(\"Default ENtry DEFAULTS TO LAST SELeCTED +++++++++++++ \", iEntityLastSelect);\r\n }\r\n else {\r\n // No favourite or link set-up so default to the first in the list\r\n iDefaultEntry = 0;\r\n console.log(\"Default ENtry DEFAULTS TO ____________________ 0\");\r\n }\r\n }\r\n\r\n SetLocalMapCentreAndZoom(iDefaultEntry)\r\n\r\n\r\n // And now trigger a mouseover to display stats for the default entry and display the default graph\r\n EntityMouseover(iDefaultEntry);\r\n\r\n if (SHOW_STATS == 1) {\r\n ShowDefaultGraph();\r\n }\r\n\r\n iCurrentStatsEntity = iDefaultEntry;\r\n setTitleAndLinks();\r\n\r\n //TODO: ^^^ This can run earlier\r\n FavouritesSetupAndChange();\r\n\r\n });\r\n console.log(\"Completed inner\");\r\n });\r\n console.log(\"Completed outer\");\r\n }\r\n catch (exception) {\r\n //alert(exception.description)\r\n }\r\n finally {\r\n\r\n try {\r\n // $(\"#RiverSection\").niceScroll(\"#RList\", { autohidemode: false, cursorcolor: \"#00FF00\" });\r\n //TODO:$$$ Reinstate?\r\n // $(\"#specific_stats\").niceScroll({ autohidemode: false, cursorcolor: \"#00FF00\" });\r\n }\r\n catch (err4) { }\r\n\r\n bStartupComplete = true;\r\n }\r\n\r\n});\r\n\r\nfunction DoSaveMapCentreAndZoom() {\r\n SaveMapCentreAndZoom(map);\r\n}\r\n\r\nvar debugging = true; // or true\r\nif (typeof console == \"undefined\") var console = { log: function () { } };\r\nelse if (!debugging || typeof console.log == \"undefined\") console.log = function () { };\r\n\r\n//