76 | Chapter 6 Using Buzzsaw with Autodesk MapGuide Viewer
+ selStringPARAM);
// visible layers
var layers = map.getMapLayersEx();
var visibleLayersCookie = "";
for (var i = 0; i < layers.size(); i++) {
if (layers.item(i).getVisibility()) {
visibleLayersCookie = visibleLayersCookie
+ escape(layers.item(i).getName()) + ";";
}
}
document.cookie = cookieNameMapStateLayers + "="
+ escape(visibleLayersCookie);
// visible groups
var groups = map.getMapLayerGroups();
var visibleGroupsCookie = "";
for (var i = 0; i < groups.size(); i++) {
if (groups.item(i).getVisibility()) {
visibleGroupsCookie = visibleGroupsCookie
+ escape(groups.item(i).getName()) + ";";
}
}
document.cookie = cookieNameMapStateGroups + "="
+ escape(visibleGroupsCookie);
}
}
// This function makes sure that when we get the parameters that we
// get an empty string instead of null.
function getMapStatePARAM() {
var v = getCookie(cookieNameMapStateURLParam);
if (v == null) return "";
else return v;
}
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!--
// Functions for handling cookies.
/* This code is Copyright (c) 1996 Nick Heinle and Athenia Associates,
* all rights reserved. In order to receive the right to license this
* code for use on your site the original code must be copied from the
* Web site webreference.com/javascript/. License is granted to user to
* reuse this code on their own Web site if and only if this entire copyright
* notice is included. Code written by Nick Heinle of webreference.com.
*/
function getCookie (name) {
var dcookie = document.cookie;
var cname = name + "=";
var clen = dcookie.length;
var cbegin = 0;
while (cbegin < clen) {
var vbegin = cbegin + cname.length;