<% ' ASP Functions to manipulate media types ' see original post for description: ' http://mezzoblue.com/archives/2008/03/18/mediatyping ' this function takes two arguments: an array of user agents, and a specific user agent ' it will then try to see if the specific user agent exists within the array ' if so, it will return true, otherwise it returns false. Function checkMediaType(uaList, uaKnown) ' check user agent string against array, return true if found, or false if not found ' checking method changed by Karen, since it did not work :) checkMediaType = false For Each ua in uaList if (not Trim(ua) = "") then pos = Instr(LCASE("$" & uaKnown), LCASE(ua)) If pos <> 0 Then checkMediaType = true End If End If Next End Function ' this function takes one argument: a string value that specifies a media profile ' it will then set a cookie in the browser ' it returns the media profile value, to be used as a variable later in the page Function selectMedia(media) Response.Cookies("media")=media Response.Cookies("login").Expires=DateAdd("S", "31536000", Date) selectMedia = media End Function ' ============================== ' media check Dim userAgentsMobile(18) userAgentsMobile(0) = "Blazer" userAgentsMobile(1) = "Palm" userAgentsMobile(2) = "Handspring" userAgentsMobile(3) = "Nokia" userAgentsMobile(4) = "Kyocera" userAgentsMobile(5) = "Samsung" userAgentsMobile(6) = "Motorola" userAgentsMobile(7) = "Smartphone" userAgentsMobile(8) = "Windows CE" userAgentsMobile(9) = "Blackberry" userAgentsMobile(10) = "WAP" userAgentsMobile(11) = "Smartphone" userAgentsMobile(12) = "SonyEricsson" userAgentsMobile(13) = "PlayStation Portable" userAgentsMobile(14) = "LG" userAgentsMobile(15) = "MMP" userAgentsMobile(16) = "OPWV" userAgentsMobile(17) = "Symbian" userAgentsMobile(18) = "EPOC" ' array of tv devices Dim userAgentsTv(3) userAgentsTv(0) = "Nintendo Wii" userAgentsTv(1) = "Playstation 3" userAgentsTv(2) = "WebTV" ' show standard version by default Dim mediaVersion mediaVersion = "screen" ' toggle media version if cookie is set If (Not IsNull(Request.Cookies("media")) and Not(Trim(Request.Cookies("media")) = "")) then if (Request.Cookies("media") = "mobile") then mediaVersion = selectMedia("mobile") elseif (Request.Cookies("media") = "screen") then mediaVersion = selectMedia("screen") end if Else ' if no cookie found, sniff media type then set cookie knownUserAgent = false ' compare the device arrays against the user agent mediaTypeMobile = checkMediaType(userAgentsMobile, Request.ServerVariables("HTTP_USER_AGENT")) ' if media version is found, set a media type cookie, otherwise flag this browser as screen to save time on future loads if mediaTypeMobile = true then mediaVersion = selectMedia("mobile") else mediaVersion = selectMedia("screen") end if End If ' override media version and set a new cookie if they have selected a "show {media} site" link If Not isnull(Request.QueryString("media")) AND trim(Request.QueryString("media")) <> "" then if (Request.QueryString("media") = "mobile") then mediaVersion = selectMedia("mobile") else mediaVersion = selectMedia("screen") end if End If %> <% templatePath = "../../../../" %> nacshutown | City of Nanaimo <% if (mediaVersion = "mobile") then Response.Write("") Response.Write("") Response.Write("") Response.Write("") else %> <% end if %>

Stylesheets: <% if (mediaVersion = "mobile") then Response.Write("Screen version | Mobile") else %> Screen version | Mobile <% end if %>

Nanaimo Aquatic Centre Annual Maintenance Shutdown

Aug 24, 2009

Nanaimo Aquatic Centre Annual Maintenance Shutdown from Friday, August 31 to Sunday, September 20 (opening, Monday, September 21). Click here for the Beban Park Pool Interim Schedule.

Minor Navigation

<% if (mediaVersion = "screen") then %> <% end if %>
<% if (mediaVersion = "screen") then %> <% end if %>