s
//
Connect.layout_div = Connect_Window.document.getElementById('layout_div');
Connect.toolbar_div = Connect_Window.document.getElementById('toolbar_div');
Connect.presentation_div = Connect_Window.document.getElementById('presentation_div');
Connect.container_div = Connect_Window.document.getElementById('container_div');
Connect.menu_backdrop = Connect_Window.document.getElementById('menu_backdrop');
Connect.menu_frame_div = Connect_Window.document.getElementById('menu_frame');
Connect.page_div = Connect_Window.document.getElementById('page_div');
Connect.page_iframe = Connect_Window.document.getElementById('page_iframe');
Connect.panels_div = Connect_Window.document.getElementById('panels');
Connect.nav_buttons_div = Connect_Window.document.getElementById('nav_buttons_div');
Connect.toc_div = Connect_Window.document.getElementById('toc');
Connect.toc_content_div = Connect_Window.document.getElementById('toc_content');
Connect.index_div = Connect_Window.document.getElementById('index');
Connect.index_content_div = Connect_Window.document.getElementById('index_content');
Connect.search_div = Connect_Window.document.getElementById('search_div');
Connect.search_content_div = Connect_Window.document.getElementById('search_content');
Connect.search_iframe = Connect_Window.document.getElementById('search_iframe');
Connect.search_input = Connect_Window.document.getElementById('search_input');
Connect.header_div = Connect_Window.document.getElementById('header_div');
Connect.footer_div = Connect_Window.document.getElementById('footer_div');
Connect.page_loading_div = Connect_Window.document.getElementById("page_loading");
// Menu
//
Connect.Menu = new Menu_Object(Connect_Window, Connect);
Connect.sidebar_behavior = undefined;
if (Connect.menu_backdrop) {
Connect.menu_backdrop.onclick = Connect.Menu.Hide;
}
// Search Scope
//
Connect.scope_enabled = typeof Scope !== 'undefined';
if (Connect.scope_enabled) {
Connect.search_scope_selector = document.getElementById('search_scope');
Connect.search_scope_selector.onclick = Scope.ToggleDropDown;
}
// Progressive Search
//
Connect.search_input.oninput = function () {
Connect.search_query = Connect.search_input.value;
if (Connect.progressive_search_enabled) {
if (Connect.search_query.length >= Connect.search_query_minimum_length ||
(Connect.search_query.length === 0 && Connect.SearchEnabled())) {
Navigation.HandleSearchURL();
}
}
};
// Set up search reporting for Analytics
//
if (Connect.google_analytics_enabled) {
Connect.search_input.onblur = function () {
var search_input_value;
search_input_value = Connect.search_input.value;
if (search_input_value.length >= Connect.search_query_minimum_length &&
search_input_value !== Connect.last_logged_search_term) {
Connect.last_logged_search_term = search_input_value;
Connect.ProcessAnalyticsEvent('search');
}
};
}
// Scroll Events
//
Connect.container_div.onscroll = function () {
Connect.Menu.CalculateMenuSize();
Connect.HandleScrollForBackToTop();
};
// Determine scrolling support
//
Connect.scrolling_supported = Browser.ScrollingSupported();
if (Connect.scrolling_supported) {
Connect_Window.document.body.className = Browser.AddClass(Connect_Window.document.body.className, 'scrolling_supported');
}
// Size content
//
Connect_Window.onresize = Connect.OnResize;
if (Connect_Window.addEventListener !== undefined) {
Connect_Window.addEventListener('orientationchange', Connect.OnResize, false);
}
// Lightbox
//
Connect.Lightbox = new Lightbox_Object(Connect);
// Touch enabled?
//
if (Browser.TouchEnabled(Connect_Window)) {
// Adjust CSS rules for touch devices
//
Browser.DisableCSSHoverSelectors(Connect_Window);
}
// Hook up back to top
//
Connect.back_to_top_element = Connect_Window.document.getElementById('back_to_top');
if (Connect.back_to_top_element !== null) {
Connect.back_to_top_element.onclick = Connect.BackToTop;
back_to_top_link = Browser.FirstChildElementWithTagName(Connect.back_to_top_element, 'a');
if (back_to_top_link !== null && Browser.ContainsClass(back_to_top_link.className, 'ww_behavior_back_to_top')) {
back_to_top_link.onclick = Connect.BackToTopLink;
}
}
// Setup for listening
//
Connect.dispatch_listen = undefined;
Message.Listen(Connect_Window, Connect.Listen);
// Search
//
if (Connect.search_iframe) {
Connect.search_iframe.onload = Connect.LoadSearch;
}
// Page
//
if (Connect.page_iframe) {
Connect.page_iframe.onload = Connect.LoadPage;
}
// Load Toolbar
//
Connect.LoadToolbar();
// Load parcels
//
Parcels.Load();
};
Connect.OnLoad = function () {
if (!Browser.BrowserSupported()) {
Connect.DisplayUnsupportedBrowserView();
return;
}
if (!Connect.loading) {
Connect.loading = true;
Connect.OnLoadAction();
}
};
Connect.CalculateLayoutWide = function () {
var result, browser_widthheight;
browser_widthheight = Browser.GetBrowserWidthHeight(Connect_Window);
result = browser_widthheight.width >= Connect.navigation_minimum_page_width;
return result;
};
Connect.CalculateLayoutTall = function () {
var result, browser_widthheight;
browser_widthheight = Browser.GetBrowserWidthHeight(Connect_Window);
result = (browser_widthheight.height >= Connect.minimum_page_height) || (browser_widthheight.height > browser_widthheight.width);
return result;
};
Connect.AdjustLayoutForBrowserSize = function () {
var previous_layout_wide, previous_layout_tall, layout_changed,
toolbar_buttons, left_button, right_button, index,
toolbar_button;
// Adjust navigation based on available space
//
previous_layout_wide = Connect.layout_wide;
previous_layout_tall = Connect.layout_tall;
Connect.layout_wide = Connect.CalculateLayoutWide();
Connect.layout_tall = !Connect.layout_wide && Connect.CalculateLayoutTall();
layout_changed = !Connect.layout_initialized || Connect.layout_wide !== previous_layout_wide || Connect.layout_tall !== previous_layout_tall;
// If calc() not supported fallback to mobile narrow mode.
//
if (!Browser.CalcSupported()) {
Connect.layout_wide = false;
Connect.layout_tall = true;
}
// Layout changed?
//
if (layout_changed) {
if (Connect.layout_wide) {
// Layout
//
Connect.layout_div.className = 'layout_wide';
} else {
if (Connect.layout_tall) {
// Layout
//
Connect.layout_div.className = 'layout_narrow layout_tall';
} else {
// Layout
//
Connect.layout_div.className = 'layout_narrow';
}
}
}
// Update toolbar buttons
//
toolbar_buttons = Connect.toolbar_div.getElementsByTagName('span');
for (index = 0; index < toolbar_buttons.length; index += 1) {
toolbar_button = toolbar_buttons[index];
if (Browser.ContainsClass(toolbar_button.className, 'ww_skin_toolbar_button_left') ||
Browser.ContainsClass(toolbar_button.className, 'ww_skin_toolbar_button_center') ||
Browser.ContainsClass(toolbar_button.className, 'ww_skin_toolbar_button_right')) {
if (left_button === undefined) {
left_button = toolbar_button;
}
right_button = toolbar_button;
}
}
if (left_button !== undefined) {
if (Connect.layout_wide) {
left_button.className = Browser.AddClass(left_button.className, 'ww_skin_toolbar_left_background');
} else {
left_button.className = Browser.RemoveClass(left_button.className, 'ww_skin_toolbar_left_background');
}
}
if (right_button !== undefined) {
if (Connect.layout_wide) {
right_button.className = Browser.AddClass(right_button.className, 'ww_skin_toolbar_right_background');
} else {
right_button.className = Browser.RemoveClass(right_button.className, 'ww_skin_toolbar_right_background');
}
}
if (Connect.sidebar_behavior !== undefined) {
Connect.button_behaviors[Connect.sidebar_behavior]();
}
// Initialized layout
//
Connect.layout_initialized = true;
};
Connect.LoadPage = function () {
var data;
data = {
'action': 'page_load'
};
Message.Post(Connect.page_iframe.contentWindow, data, Connect_Window);
};
Connect.LoadSearch = function () {
var data;
data = {
'action': 'search_load'
};
Message.Post(Connect.search_iframe.contentWindow, data, Connect_Window);
};
Connect.LoadToolbar = function () {
var buttons_to_remove, button_to_remove, ie_match;
// Intercept toolbar links
//
buttons_to_remove = [];
Browser.ApplyToElementsWithQuerySelector(
'body a[class*=ww_behavior]',
function (param_link) {
var match, button_key, button_span, keep;
param_link.onclick = Connect.ToolbarLink;
// Track buttons
//
match = param_link.className.match(Connect.button_behavior_expression);
if (match !== null) {
button_key = match[0];
button_span = Browser.FindParentWithTagName(param_link, 'span');
if (button_span !== null) {
// Keep button?
//
keep = true;
if (Connect_Window.document.location.protocol === 'file:') {
if (button_key === 'ww_behavior_globe') {
keep = false;
}
}
// Process button
//
if (keep) {
Connect.buttons[button_key] = button_span;
// Initialize sidebar behavior
//
if ((Connect.sidebar_behavior === undefined) && ((button_key === 'ww_behavior_toc') ||
(button_key === 'ww_behavior_index'))) {
Connect.sidebar_behavior = button_key;
}
} else {
buttons_to_remove[buttons_to_remove.length] = button_span;
}
}
}
}
);
// Remove buttons
//
while (buttons_to_remove.length > 0) {
button_to_remove = buttons_to_remove.shift();
if (button_to_remove.parentNode !== undefined && button_to_remove.parentNode !== null) {
button_to_remove.parentNode.removeChild(button_to_remove);
}
}
// Handle toolbar search
//
ie_match = Connect_Window.navigator.userAgent.match(/MSIE (\d+)\.\d+;/);
if (ie_match === null || ie_match.length > 1 && parseInt(ie_match[1], 10) > 7) {
// Use toolbar search form
//
Browser.ApplyToChildElementsWithTagName(
Connect.toolbar_div,
'form',
function (param_form) {
if (Browser.ContainsClass(param_form.className, 'ww_skin_search_form')) {
param_form.onsubmit = function () {
if (Connect.search_input.value !== Connect.last_logged_search_term) {
Connect.last_logged_search_term = Connect.search_input.value;
Connect.ProcessAnalyticsEvent('search');
}
if (Connect.SearchEnabled()) {
Connect.HandleSearch();
}
else {
Connect.Button_Search();
}
return false;
};
}
}
);
Browser.ApplyToChildElementsWithTagName(
Connect.toolbar_div,
'input',
function (param_input) {
if (Browser.ContainsClass(param_input.className, 'ww_skin_search_input')) {
Connect.search_input = param_input;
}
}
);
} else {
// Eliminate toolbar search form for IE
//
Browser.ApplyToChildElementsWithTagName(
Connect.toolbar_div,
'form',
function (param_form) {
var parent_element, button_span;
// Promote button to form peer
//
parent_element = param_form.parentNode;
button_span = Connect.buttons['ww_behavior_search'];
if (button_span !== undefined) {
parent_element.insertBefore(button_span, param_form);
}
// Remove search form
//
parent_element.removeChild(param_form);
}
);
Browser.ApplyToChildElementsWithTagName(
Connect.toolbar_div,
'input',
function (param_input) {
var parent_element;
parent_element = param_input.parentNode;
parent_element.removeChild(param_input);
}
);
}
};
Connect.HandleToolbarButtonForBrowserSize = function (param_index, param_show) {
var done, button_behavior, toolbar_button, browser_widthheight,
toolbar_table_element, toolbar_table_widthheight;
done = false;
// Possible button to show/hide
//
button_behavior = Connect.button_degradation_order[param_index];
toolbar_button = Connect.buttons[button_behavior];
if (toolbar_button !== undefined) {
// Show/hide
//
if (param_show) {
toolbar_button.style.display = 'inline-block';
} else {
toolbar_button.style.display = 'none';
}
// Keep change?
//
browser_widthheight = Browser.GetBrowserWidthHeight(Connect_Window);
toolbar_table_element = Browser.FirstChildElementWithTagName(Connect.toolbar_div, 'table');
toolbar_table_widthheight = Browser.GetElementWidthHeight(toolbar_table_element);
if (param_show) {
if (toolbar_table_widthheight.width > browser_widthheight.width + 1) {
// Revert change
//
toolbar_button.style.display = 'none';
done = true;
}
} else {
if (toolbar_table_widthheight.width <= browser_widthheight.width + 1) {
// Met the goal size
//
done = true;
}
}
}
return done;
};
Connect.AdjustToolbarForBrowserSize = function () {
var browser_widthheight, toolbar_table_element,
toolbar_table_widthheight, show, index, done;
// Show/hide non-critical toolbar buttons based on available space
//
browser_widthheight = Browser.GetBrowserWidthHeight(Connect_Window);
toolbar_table_element = Browser.FirstChildElementWithTagName(Connect.toolbar_div, 'table');
toolbar_table_widthheight = Browser.GetElementWidthHeight(toolbar_table_element);
show = (toolbar_table_widthheight.width <= browser_widthheight.width + 1);
if (show) {
// Show buttons in reverse order
//
for (index = Connect.button_degradation_order.length - 1; index >= 0; index -= 1) {
done = Connect.HandleToolbarButtonForBrowserSize(index, show);
if (done) {
break;
}
}
} else {
// Hide buttons in default order
//
for (index = 0; index < Connect.button_degradation_order.length; index += 1) {
done = Connect.HandleToolbarButtonForBrowserSize(index, show);
if (done) {
break;
}
}
}
};
Connect.ResizePage = function () {
if (Navigation.page_info && Navigation.page_info.dimensions && Navigation.page_info.dimensions.height) {
var height = String(Navigation.page_info.dimensions.height) + 'px';
if (Connect.page_div.style.height !== height) {
Connect.page_div.style.height = height;
}
}
Connect.OnResize();
};
Connect.OnResize = function () {
if (Connect.SearchEnabled()) {
Connect.AdjustForSearchContentSize();
}
Connect.AdjustLayoutForBrowserSize();
Connect.AdjustToolbarForBrowserSize();
Connect.Menu.CalculateMenuSize();
};
Connect.Index_Load = function () {
var index, parcel_id, parcel_entry_placeholder_div;
// All parcels loaded?
//
if (!Parcels.loaded_all) {
// Wait for all parcel data to be loaded
//
Connect_Window.setTimeout(Connect.Index_Load, 100);
return;
}
Connect.index_objects = {};
Connect.index_entries_loaded = 0;
// Prepare index for data load
//
for (index = 0; index < Parcels.ids.length; index += 1) {
parcel_id = Parcels.ids[index];
// Emit index placeholders
//
parcel_entry_placeholder_div = Connect_Window.document.createElement('div');
parcel_entry_placeholder_div.id = 'parcel_index:' + parcel_id;
parcel_entry_placeholder_div.className = 'ww_skin_index_title';
parcel_entry_placeholder_div.innerHTML = Parcels.title[parcel_id];
Connect.index_content_div.appendChild(parcel_entry_placeholder_div);
}
for (var i = 0; i < Parcels.index.length; i++) {
var index_entry = Parcels.index[i];
var index_object = new Index_Object(
// param_entry
index_entry,
// param_load
function () {
this.iframe_container = document.createElement('div');
this.iframe_container.id = 'ajax_iframe_container_' + this.id;
this.iframe_container.style.visibility = 'hidden';
document.body.appendChild(this.iframe_container);
this.iframe_container.innerHTML = '';
},
// param_done
function () {
document.body.removeChild(this.iframe_container);
Connect.Index_AddData(this.entry, this.content);
this.loaded = true;
Connect.index_entries_loaded = Connect.index_entries_loaded + 1;
if (Connect.index_entries_loaded === Parcels.index.length) {
this.complete();
}
},
// param_complete
function () {
var button_span;
// Parcel indexes loaded!
//
Parcels.index_loaded = true;
// Intercept all clicks
//
Browser.ApplyToChildElementsWithTagName(
Connect.index_div,
'a',
function (param_link) {
param_link.onclick = Connect.IndexLink;
}
);
// Done!
//
button_span = Connect.buttons['ww_behavior_index'];
// Menu currently displayed?
//
if (button_span && Connect.Menu.menu_mode_visible === 'index') {
// On stage!
//
Connect.Menu.menu_content.appendChild(Connect.index_div);
}
}
);
Connect.index_objects[index_object.id] = index_object;
index_object.load();
}
};
Connect.Index_AddData = function (param_entry, param_content) {
var parcel_data, parcel_entry_div_id, parcel_entry_div,
parcel_index_div_id, parcel_index_div;
// Access parcel data
//
parcel_data = Connect_Window.document.createElement('div');
parcel_data.style.visibility = 'hidden';
parcel_data.innerHTML = param_content;
Connect_Window.document.body.appendChild(parcel_data);
// Index
//
parcel_entry_div_id = 'parcel_index:' + param_entry.id;
parcel_entry_div = Connect_Window.document.getElementById(parcel_entry_div_id);
if (parcel_entry_div !== null) {
parcel_index_div_id = 'index:' + param_entry.id;
parcel_index_div = Connect_Window.document.getElementById(parcel_index_div_id);
if ((parcel_index_div !== null) && (parcel_index_div.innerHTML.length > 0)) {
if (parcel_entry_div.nextSibling !== null) {
Connect.index_content_div.insertBefore(parcel_index_div, parcel_entry_div.nextSibling);
} else {
Connect.index_content_div.appendChild(parcel_index_div);
}
} else {
Connect.index_content_div.removeChild(parcel_entry_div);
}
}
// Remove parcel data
//
Connect_Window.document.body.removeChild(parcel_data);
};
//TODO: move to Navigation
Connect.IndexLink = function (param_event) {
var result, event, hash_index, see_also_id, index_entry;
result = false;
// Access event
//
event = param_event || window.event;
// Cancel event bubbling
//
event.cancelBubble = true;
if (event.stopPropagation) {
event.stopPropagation();
} else {
event.cancelBubble = true;
}
Connect.ProcessAnalyticsEvent('menu_click_index');
// See/See Also link?
//
if (this.rel.toLowerCase() === 'see') {
hash_index = this.href.indexOf('#');
if (hash_index >= 0) {
see_also_id = this.href.substring(hash_index + 1);
index_entry = Connect_Window.document.getElementById(see_also_id);
if (index_entry !== null) {
// Scroll to Index position
//
Connect.ScrollToMenuElement(index_entry);
}
}
result = false;
} else {
// Document link
//
result = Navigation.InterceptLink(this, true);
}
return result;
};
Connect.DisplayIndex = function () {
// #index/
// Index enabled?
//
if (Connect.index_div !== null) {
// Display index
//
Connect.Menu.Show();
if (Connect.sidebar_behavior !== 'ww_behavior_index') {
Connect.sidebar_behavior = 'ww_behavior_index';
Connect.Button_Index();
}
}
};
Connect.LocateTOCEntry = function () {
var result, page_id, possible_toc_entry_id, possible_toc_link, toc_page_element;
result = null;
// See if page exists in TOC
//
if (Navigation.page_info) {
page_id = Navigation.page_info.id;
// Page ID defined?
//
if (typeof page_id === 'string' && page_id.length > 0) {
// Try instant lookup with document hash
//
if (Navigation.page_info.hash.length > 1 && Navigation.page_info.hash.charAt(0) === '#') {
possible_toc_entry_id = page_id + ':' + Navigation.page_info.hash.substring(1);
possible_toc_link = Connect_Window.document.getElementById(possible_toc_entry_id);
if (possible_toc_link !== null) {
// TOC link located!
//
result = Browser.FindParentWithTagName(possible_toc_link, 'li');
}
}
// Result found?
//
if (result === null) {
// Check for page ID in TOC
//
toc_page_element = Connect_Window.document.getElementById(page_id);
if (toc_page_element !== null) {
// Found page!
//
result = Browser.FindParentWithTagName(toc_page_element, 'li');
}
}
}
}
return result;
};
Connect.DetermineTOCLevel = function (param_container_element, param_ul) {
var level, current_node;
// Determine initial level
//
level = 0;
if (param_ul !== param_container_element) {
level = 1;
}
// Determine level
//
current_node = param_ul.parentNode;
while (current_node !== param_container_element) {
if (current_node.nodeName.toLowerCase() === 'ul') {
level += 1;
}
current_node = current_node.parentNode;
}
return level;
};
Connect.ConfigureTOCLevels = function (param_container_element, param_level_offset) {
var toc_layout_div;
// Configure TOC levels
//
Browser.ApplyToChildElementsWithTagName(
param_container_element,
'ul',
function (param_ul) {
var level, class_name;
// Determine level
//
level = param_level_offset + Connect.DetermineTOCLevel(param_container_element, param_ul);
// Initialize open/close
//
class_name = 'ww_skin_toc_level ww_skin_toc_level_' + level;
if ((level === 1) || (Browser.ContainsClass(param_ul.className, 'ww_skin_toc_container_open'))) {
class_name += ' ww_skin_toc_container_open';
} else {
class_name += ' ww_skin_toc_container_closed';
}
// Update class name
//
param_ul.className = class_name;
});
// Initialize open or closed based on entry state
//
toc_layout_div = Browser.FirstChildElementWithTagName(param_container_element, 'div');
if (toc_layout_div !== null) {
if (Connect.TOCFolder_IsOpen(toc_layout_div)) {
Connect.TOCFolder_Open(toc_layout_div);
} else {
Connect.TOCFolder_Close(toc_layout_div);
}
}
// Track folder clicks
//
Browser.ApplyToChildElementsWithTagName(
param_container_element,
'div',
function (param_div) {
if (Browser.ContainsClass(param_div.className, 'ww_skin_toc_entry')) {
param_div.onclick = Connect.TOCEntryClickHandler;
Browser.ApplyToChildElementsWithTagName(
param_div,
'span',
function (param_span) {
if (Browser.ContainsClass(param_span.className, 'ww_skin_toc_dropdown')) {
param_span.onclick = Connect.TOCDropdownClickHandler;
}
});
}
});
};
Connect.ConfigureTabs = function (param_container_element) {
Browser.ApplyToElementsWithQuerySelector(
'div[class*=ww_skin_toolbar_tab]',
function (param_tab) {
var group_title = param_tab.firstElementChild.innerHTML;
if (Parcels.current_parcels[group_title] || Parcels.current_parcels['_all_']) {
// Tab title matches group title of a current parcel or all parcels are allowed.
//
} else if (Parcels.all_parcels.indexOf(group_title) === -1) {
// This Tab is not from a parcel, must be custom tab.
//
}
else {
param_tab.style.display = 'none';
}
// Track tab clicks
//
param_tab.onclick = Connect.TabClickHandler;
}
);
};
Connect.TabClickHandler = function (param_event) {
var event, parent_div, result;
// Access event
//
event = param_event || window.event;
// Cancel event bubbling
//
event.cancelBubble = true;
if (event.stopPropagation) {
event.stopPropagation();
} else {
event.cancelBubble = true;
}
Connect.ProcessAnalyticsEvent('toolbar_tab_click');
// Process event
//
result = Connect.TabLinkProcessor(param_event);
return result;
};
Connect.TabLinkProcessor = function (param_event) {
var tabs, current_tab, updated_className, result;
// Gather all of the tabs
//
tabs = [];
Browser.ApplyToElementsWithQuerySelector(
'div[class*=ww_skin_toolbar_tab]',
function (param_tab) {
tabs.push(param_tab);
}
);
// Set 'selected' Tab to this tab and make all other tabs not 'selected'
// This is only necessary if the page is not part of the help page_urls
//
while (tabs.length > 0) {
current_tab = tabs.shift();
if (current_tab == param_event.currentTarget) {
// Make this tab the 'selected' tab
//
updated_className = Browser.AddClass(current_tab.className, 'ww_skin_toolbar_tab_selected');
}
else {
// Make sure this tab is not the 'selected' tab
//
updated_className = Browser.RemoveClass(current_tab.className, 'ww_skin_toolbar_tab_selected');
}
current_tab.className = updated_className;
}
// Navigate to the link
//
result = Navigation.InterceptLink(param_event.target, true);
return result;
};
Connect.TabUpdateSelected = function() {
Browser.ApplyToElementsWithQuerySelector(
'div[class*=ww_skin_toolbar_tab]',
function (param_tab) {
var child_link, url, updated_className;
child_link = Browser.FirstChildElementWithTagName(param_tab, 'a');
if (child_link.href) {
if (!child_link.target || child_link.target === 'connect_page') {
url = Navigation.GetDocumentHrefFromURL(child_link.href);
if (Browser.SameDocument(url, Navigation.page_info.href)) {
updated_className = Browser.AddClass(param_tab.className, 'ww_skin_toolbar_tab_selected');
}
else {
updated_className = Browser.RemoveClass(param_tab.className, 'ww_skin_toolbar_tab_selected');
}
param_tab.className = updated_className;
}
}
}
);
};
Connect.UpdateBackToTop = function (param_top) {
if (Connect.back_to_top_element !== null) {
if (param_top > 80) {
Connect.back_to_top_element.className = Browser.AddClass(Connect.back_to_top_element.className, 'back_to_top_show');
} else {
Connect.back_to_top_element.className = Browser.RemoveClass(Connect.back_to_top_element.className, 'back_to_top_show');
}
}
};
Connect.HandleScrollForBackToTop = function () {
var scroll_position;
if (Connect.page_first_scroll) {
Connect.page_first_scroll = false;
Connect.ProcessAnalyticsEvent('page_first_scroll');
}
scroll_position = parseFloat(Connect.container_div.scrollTop);
Connect.UpdateBackToTop(scroll_position);
};
Connect.BackToTop = function () {
// Report click event
//
Connect.ProcessAnalyticsEvent('page_button_back_to_top_click');
// Scroll page to desired position
//
Connect.ScrollTo(0, 0);
};
Connect.BackToTopLink = function (param_event) {
var event, result;
// Access event
//
event = param_event || window.event;
// Cancel event bubbling
//
event.cancelBubble = true;
if (event.stopPropagation) {
event.stopPropagation();
} else {
event.cancelBubble = true;
}
// Back to top
//
Connect.BackToTop();
// Prevent default link behavior
//
result = false;
return result;
};
Connect.ToolbarLink = function (param_event) {
var event, result;
// Access event
//
event = param_event || window.event;
// Cancel event bubbling
//
event.cancelBubble = true;
if (event.stopPropagation) {
event.stopPropagation();
} else {
event.cancelBubble = true;
}
if (Connect.scope_enabled) {
Scope.CloseDropDown();
}
// Process event
//
result = Connect.HandleToolbarLink(this);
return result;
};
Connect.TOCFindFirstValidLinkElement = function (param_li_element) {
var valid_link_element, div_element, link_element, ul_element, li_element;
// Initialize return value
//
valid_link_element = null;
// Check existing entry
//
div_element = Browser.FirstChildElementWithTagName(param_li_element, 'div');
if (div_element !== null) {
link_element = Browser.FirstChildElementWithTagName(div_element, 'a');
if ((link_element !== null) && (link_element.href !== '')) {
valid_link_element = link_element;
}
}
// Anything found?
//
if (valid_link_element === null) {
// Check nested list
//
ul_element = Browser.FirstChildElementWithTagName(param_li_element, 'ul');
if (ul_element !== null) {
li_element = Browser.FirstChildElementWithTagName(ul_element, 'li');
if (li_element !== null) {
valid_link_element = Connect.TOCFindFirstValidLinkElement(li_element);
}
// Try next entry?
//
if (valid_link_element === null) {
li_element = Browser.NextSiblingElementWithTagName(li_element, 'li');
while ((valid_link_element === null) && (li_element !== null)) {
valid_link_element = Connect.TOCFindFirstValidLinkElement(li_element);
li_element = Browser.NextSiblingElementWithTagName(li_element, 'li');
}
}
}
}
return valid_link_element;
};
Connect.TOCLinkProcessor = function (param_link) {
var result;
result = true;
// Process link
//
if (param_link !== null && param_link.href !== '') {
if (param_link.className.length === 0 &&
Browser.ContainsClass(param_link.parentNode.className, 'ww_skin_toc_folder')) {
// Unloaded parcel TOC link
//
result = false;
} else {
result = Navigation.InterceptLink(param_link, true);
if (result === false) {
// Clean up folders?
//
if (Connect.layout_wide) {
// Keep the menu active!
//
Connect.toc_cleanup_folders = false;
}
}
}
}
return result;
};
Connect.TOCEntryClickHandler = function (param_event) {
var result, event, child_link, toc_li_element;
result = true;
// Access event
//
event = param_event || window.event;
// Cancel event bubbling
//
event.cancelBubble = true;
if (event.stopPropagation) {
event.stopPropagation();
} else {
event.cancelBubble = true;
}
// Clicked folder?
//
child_link = null;
if (Browser.ContainsClass(this.className, 'ww_skin_toc_folder')) {
// Toggle open/closed
//
Connect.TOCFolder_Toggle(this);
// Opened folder?
//
if (Connect.TOCFolder_IsOpen(this)) {
// Locate valid child link?
//
toc_li_element = Browser.FindParentWithTagName(this, 'li');
if (toc_li_element !== null) {
child_link = Connect.TOCFindFirstValidLinkElement(toc_li_element);
}
}
result = false;
} else {
// Access child link
//
child_link = Browser.FirstChildElementWithTagName(this, 'a');
}
Connect.ProcessAnalyticsEvent('menu_click_toc');
// Process child link
//
result = Connect.TOCLinkProcessor(child_link);
return result;
};
Connect.TOCDropdownClickHandler = function (param_event) {
var result, event, parent_div;
result = true;
// Access event
//
event = param_event || window.event;
// Cancel event bubbling
//
event.cancelBubble = true;
if (event.stopPropagation) {
event.stopPropagation();
} else {
event.cancelBubble = true;
}
// Clicked folder?
//
parent_div = Browser.FirstAncestorElementContainingClass(this, 'ww_skin_toc_folder');
if (parent_div !== null) {
// Toggle open/closed
//
Connect.TOCFolder_Toggle(parent_div);
result = false;
}
return result;
};
Connect.TOCLinkClickHandler = function (param_event) {
var event, parent_div, result;
// Access event
//
event = param_event || window.event;
// Cancel event bubbling
//
event.cancelBubble = true;
if (event.stopPropagation) {
event.stopPropagation();
} else {
event.cancelBubble = true;
}
// Expand if closed folder
//
parent_div = Browser.FindParentWithTagName(this, 'div');
if ((parent_div !== null) && (Browser.ContainsClass(parent_div.className, 'ww_skin_toc_folder'))) {
Connect.TOCFolder_Open(parent_div);
}
Connect.ProcessAnalyticsEvent('menu_click_toc');
// Process event
//
result = Connect.TOCLinkProcessor(this);
return result;
};
Connect.DisplayTOC = function () {
// #toc/
// TOC enabled?
//
if (Connect.toc_div !== null) {
// Display TOC
//
Connect.Menu.Show();
if (Connect.sidebar_behavior !== 'ww_behavior_toc') {
Connect.sidebar_behavior = 'ww_behavior_toc';
Connect.Button_TOC();
}
}
};
Connect.TOC_ElementKey = function (param_element) {
var element_key, element_in_path, position, sibling;
// Build key
//
element_key = '';
element_in_path = param_element;
while ((element_in_path !== undefined) && (element_in_path !== null) && ((typeof element_in_path.id !== 'string') || (element_in_path.id.length === 0))) {
position = 0;
sibling = element_in_path;
while (sibling !== null) {
position += 1;
sibling = sibling.previousSibling;
}
element_key = element_in_path.nodeName + ':' + position + ':' + element_key;
element_in_path = element_in_path.parentNode;
}
if ((element_in_path !== undefined) && (element_in_path !== null)) {
element_key = element_in_path.id + ':' + element_key;
}
return element_key;
};
Connect.TOC_RecordClassState = function (param_element) {
var element_key;
// Track original class info if enabled
//
if (Connect.toc_class_states !== null) {
// Build key
//
element_key = Connect.TOC_ElementKey(param_element);
// Already tracking?
//
if (typeof Connect.toc_class_states[element_key] !== 'object') {
Connect.toc_class_states[element_key] = { 'element': param_element, 'className': param_element.className };
}
}
};
Connect.TOC_RestoreClassStates = function (param_folder_exceptions) {
var element_key, preserved_toc_class_states, entry_state;
if (Connect.toc_class_states !== null) {
preserved_toc_class_states = {};
for (element_key in Connect.toc_class_states) {
if (typeof Connect.toc_class_states[element_key] === 'object') {
entry_state = Connect.toc_class_states[element_key];
entry_state.element.className = entry_state.className;
// Keep folder open?
//
if (Browser.ContainsClass(entry_state.className, 'ww_skin_toc_folder')) {
if ((param_folder_exceptions !== undefined) && (typeof param_folder_exceptions[element_key] === 'boolean')) {
// Keep folder open
//
preserved_toc_class_states[element_key] = entry_state;
} else {
// Collapse folder
//
Connect.TOCFolder_Close(entry_state.element);
}
}
}
}
// Reset tracked states
//
Connect.toc_class_states = preserved_toc_class_states;
}
};
Connect.TOCFolder_IsOpen = function (param_entry_div) {
var result, child_span;
// Initialize return value
//
result = false;
if (Browser.ContainsClass(param_entry_div.className, 'ww_skin_toc_folder')) {
child_span = param_entry_div.querySelector('span.ww_skin_toc_dropdown_open');
if (child_span !== null) {
result = true;
}
}
return result;
};
Connect.TOCFolder_Open = function (param_entry_div) {
var child_span, sibling_ul;
if (Browser.ContainsClass(param_entry_div.className, 'ww_skin_toc_folder')) {
Connect.TOC_RecordClassState(param_entry_div);
child_span = param_entry_div.querySelector('span.ww_skin_toc_dropdown_closed');
if (child_span !== null) {
child_span.className = Browser.ReplaceClass(child_span.className, 'ww_skin_toc_dropdown_closed', 'ww_skin_toc_dropdown_open');
}
sibling_ul = Browser.NextSiblingElementWithTagName(param_entry_div, 'ul');
if (sibling_ul !== null) {
sibling_ul.className = Browser.ReplaceClass(sibling_ul.className, 'ww_skin_toc_container_closed', 'ww_skin_toc_container_open');
}
}
};
Connect.TOCFolder_Close = function (param_entry_div) {
var child_span, sibling_ul;
if (Browser.ContainsClass(param_entry_div.className, 'ww_skin_toc_folder')) {
Connect.TOC_RecordClassState(param_entry_div);
child_span = param_entry_div.querySelector('span.ww_skin_toc_dropdown_open');
if (child_span !== null) {
child_span.className = Browser.ReplaceClass(child_span.className, 'ww_skin_toc_dropdown_open', 'ww_skin_toc_dropdown_closed');
}
sibling_ul = Browser.NextSiblingElementWithTagName(param_entry_div, 'ul');
if (sibling_ul !== null) {
sibling_ul.className = Browser.ReplaceClass(sibling_ul.className, 'ww_skin_toc_container_open', 'ww_skin_toc_container_closed');
}
}
};
Connect.TOCFolder_Toggle = function (param_entry_div) {
if (Browser.ContainsClass(param_entry_div.className, 'ww_skin_toc_folder')) {
if (Connect.TOCFolder_IsOpen(param_entry_div)) {
Connect.TOCFolder_Close(param_entry_div);
} else {
Connect.TOCFolder_Open(param_entry_div);
}
Connect.Menu.CalculateMenuSize();
}
};
Connect.HandleToolbarLink = function (param_link) {
var result, behavior;
result = true;
if (typeof param_link.className === 'string') {
// Determine handlers for button
//
for (behavior in Connect.button_behaviors) {
if (typeof Connect.button_behaviors[behavior] === 'function') {
if (Browser.ContainsClass(param_link.className, behavior)) {
Connect.button_behaviors[behavior](param_link);
result = false;
break;
}
}
}
}
return result;
};
Connect.AnalyticsEnabled = function () {
var analytics_enabled, location_host, default_url, trimmed_default_url, regexRemoveProtocol, regexRemovePath;
analytics_enabled = false;
if (typeof Analytics !== 'undefined') {
location_host = Connect_Window.location.host;
default_url = Browser.DecodeURIComponent(Analytics.ga_default_url);
regexRemoveProtocol = RegExp(/(\w+:)(\/\/|\\\\)/);
regexRemovePath = RegExp(/\/.*$/);
trimmed_default_url = default_url.replace(regexRemoveProtocol, '');
trimmed_default_url = trimmed_default_url.replace(regexRemovePath, '');
if (default_url === '') {
analytics_enabled = true;
} else {
analytics_enabled = (location_host.indexOf(trimmed_default_url) === -1) ? false : true;
}
}
return analytics_enabled;
};
Connect.ProcessAnalyticsEventTopic = function (param_context, param_topic) {
if (Connect.google_analytics_enabled) {
try {
Connect.PreLoadDataForAnalyticsTopic(param_context, param_topic);
Analytics.CaptureEvent();
}
catch (ignore) {
//do nothing
}
}
};
Connect.ProcessAnalyticsEvent = function (param_event_type) {
if (Connect.google_analytics_enabled) {
try {
Connect.PreLoadDataForAnalytics(param_event_type);
Analytics.CaptureEvent();
}
catch (ignore) {
//do nothing
}
}
};
Connect.PreLoadDataForAnalyticsTopic = function (param_context, param_topic) {
var page_location, page_path, page_title;
page_location = document.location.href;
page_path = document.location.pathname + document.location.search + '#context/' + param_context + '/' + param_topic;
page_title = Navigation.page_info.title;
Analytics.event_type = 'topic_lookup';
Analytics.event_data['title'] = page_title;
Analytics.event_data['context'] = param_context;
Analytics.event_data['topic'] = param_topic;
Analytics.event_data['location'] = page_location;
Analytics.event_data['path'] = page_path;
};
Connect.PreLoadDataForAnalytics = function (param_event_type) {
var page_title, page_location, page_hash, page_path, search_query, url_handler_page_hash;
Analytics.event_type = param_event_type;
// Get window location hash if not on a content page
//
url_handler_page_hash = Navigation.url_handler_object['page'];
if (url_handler_page_hash === undefined) {
page_hash = Connect_Window.location.hash;
} else {
page_hash = Browser.DecodeURIComponent('#page/' + url_handler_page_hash);
}
page_location = document.location.href;
page_path = document.location.pathname + document.location.search + page_hash;
page_title = Navigation.page_info.title;
if (Connect.page_cargo.search_query !== undefined) { // Search from result page
search_query = Connect.page_cargo.search_query;
} else if (Connect.search_input.value !== undefined) { // Search from toolbar
search_query = Connect.search_input.value;
}
Analytics.event_data['title'] = page_title;
Analytics.event_data['location'] = page_location;
Analytics.event_data['path'] = page_path;
Analytics.event_data['query'] = search_query;
};
Connect.Socialize = function () {
var data;
// Socialize
//
data = {
'action': 'page_socialize',
'disqus_id': Connect.disqus_id
};
Message.Post(Connect.page_iframe.contentWindow, data, Connect_Window);
};
Connect.Globalize = function () {
var data;
// Google Translation
//
if (Connect.globe_enabled) {
data = {
'action': 'page_globalize'
};
Message.Post(Connect.page_iframe.contentWindow, data, Connect_Window);
}
};
Connect.SearchQueryHighlight = function () {
var data;
data = {
'action': 'page_search_query_highlight',
'search_query': Connect.page_cargo.search_query,
'search_synonyms': Connect.page_cargo.search_synonyms,
'search_minimum_word_length': Connect.page_cargo.search_minimum_word_length,
'search_stop_words': Connect.page_cargo.search_stop_words
};
Message.Post(Connect.page_iframe.contentWindow, data, Connect_Window);
};
Connect.AdjustForSearchContentSize = function () {
var data;
data = {
'action': 'search_get_page_size',
'stage': 'height'
};
Message.Post(Connect.search_iframe.contentWindow, data, Connect_Window);
};
Connect.EnableDisableButton = function (param_button_behavior, param_ccs_class_prefix, param_enable) {
var button_span, updated_className;
button_span = Connect.buttons[param_button_behavior];
if (button_span !== undefined) {
// Update class name
//
updated_className = button_span.className;
updated_className = Browser.RemoveClass(updated_className, 'ww_skin_toolbar_button_enabled');
updated_className = Browser.RemoveClass(updated_className, 'ww_skin_toolbar_button_disabled');
if (param_enable) {
// Enable
//
updated_className = Browser.AddClass(updated_className, 'ww_skin_toolbar_button_enabled');
} else {
// Disable
//
updated_className = Browser.AddClass(updated_className, 'ww_skin_toolbar_button_disabled');
}
button_span.className = updated_className;
}
};
Connect.Listen = function (param_event) {
// Initialize listen dispatcher
//
if (Connect.dispatch_listen === undefined) {
Connect.dispatch_listen = {
'page_load_data': function (param_data) {
Navigation.page_info = param_data;
delete Navigation.page_info['action'];
Connect.OnDocumentLoad();
var data = {
action: 'page_load_data_complete'
};
Message.Post(Connect.page_iframe.contentWindow, data, Connect_Window);
},
'page_load_scroll': function (param_data) {
var top, data;
top = param_data.top;
Connect.ScrollTo(0, top);
data = {
'action': 'page_load_scroll_complete'
};
Message.Post(Connect.page_iframe.contentWindow, data, Connect_Window);
},
'page_load_complete': function (param_data) {
if (!Connect.first_page_loaded) {
var body_className;
// loaded our first page
// we can take off the 'preload' class
// so we can get CSS transitions
body_className = Browser.RemoveClass(Connect_Window.document.body.className, 'preload');
Connect_Window.document.body.className = body_className;
Connect.first_page_loaded = true;
}
Connect.TabUpdateSelected();
},
'page_unload': function (param_data) {
Navigation.page_info = null;
Connect.OnDocumentUnload();
},
'page_bookkeeping': function (param_data) {
// Document bookkeeping
//
if (param_data.href !== undefined) {
Navigation.page_info.href = param_data.href;
}
if (param_data.hash !== undefined) {
Navigation.page_info.hash = param_data.hash;
}
Navigation.DocumentBookkeeping(true);
},
'page_scroll_view': function (param_data) {
var top, browser_widthheight;
// Determine final scroll position and scroll
//
top = param_data.top;
Connect.ScrollTo(0, top);
},
'page_size': function (param_data) {
if (Navigation.page_info) {
var has_dimensions, dimensions_changed;
has_dimensions = !!Navigation.page_info.dimensions;
if (has_dimensions) {
dimensions_changed =
Navigation.page_info.dimensions.height !== param_data.dimensions.height ||
Navigation.page_info.dimensions.width !== param_data.dimensions.width;
if (dimensions_changed) {
Navigation.page_info.dimensions = param_data.dimensions;
Connect.ResizePage();
}
}
}
},
'page_report_pdf_click': function (param_data) {
// Report click event
//
Connect.ProcessAnalyticsEvent('page_button_pdf_click');
},
'back_to_top': function (param_data) {
Connect.BackToTop();
},
'handle_toolbar_link': function (param_data) {
// Invoke toolbar link
//
Connect.button_behaviors[param_data.behavior]();
},
'display_link': function (param_data) {
var href, target, is_connect_navigation;
href = param_data.href;
target = param_data.target;
is_connect_navigation = !target || target === '_self' || target === 'connect_page';
if (is_connect_navigation) {
href = Navigation.NormalizeURL(href);
Navigation.Navigate(href, false);
} else {
Connect_Window.open(href, target);
}
},
'display_image': function (param_data) {
Connect.DisplayFullsizeImage(param_data);
},
'search_page_load_data': function (param_data) {
var data;
// Record page info
//
Connect.search_page_info = param_data;
delete Connect.search_page_info['action'];
data = {
'action': 'search_connect_info',
'target': Connect_Window.name,
'base_url': Navigation.base_url,
'parcel_prefixes': Parcels.prefixes,
'parcel_sx': Parcels.search,
'query': Connect.search_query
};
if (Connect.scope_enabled) {
var search_scope_selection_titles_string;
search_scope_selection_titles_string = Scope.GetSearchScopeSelectionTitlesString();
data['search_scopes'] = Scope.search_scopes;
data['search_scope_map'] = Scope.search_scope_map;
data['search_scope_selections'] = Scope.search_scope_selections;
data['search_scope_selection_titles'] = search_scope_selection_titles_string;
}
// Send search file list
//
Message.Post(Connect.search_iframe.contentWindow, data, Connect_Window);
},
'search_ready': function (param_data) {
var data;
// Search panel displayed?
//
if (Connect.search_div.parentNode !== Connect.panels_div) {
// Execute search
//
data = {
'action': 'search_execute',
'query': Connect.search_query
};
Message.Post(Connect.search_iframe.contentWindow, data, Connect_Window);
}
},
'search_complete': function (param_data) {
// Update dimensions
//
Connect.search_page_info.dimensions = param_data.dimensions;
// Adjust layout for search content
//
Connect.AdjustForSearchContentSize();
},
'search_page_size': function (param_data) {
var data;
if (Connect.search_page_info) {
var has_dimensions, dimensions_changed;
has_dimensions = !!Connect.search_page_info.dimensions;
if (has_dimensions) {
// Update dimensions
//
Connect.search_page_info.dimensions = param_data.dimensions;
// Set content height
//
Connect.search_div.style.height = String(Connect.search_page_info.dimensions.height) + 'px';
// Workaround Google Chrome refresh issue
//
Connect.search_iframe.style.height = '';
Connect.search_iframe.style.height = Connect.search_page_info.dimensions.height;
Connect.Menu.CalculateMenuSize();
}
}
},
'search_display_link': function (param_data) {
// Track search words
//
Connect.page_cargo.search_href = param_data.href;
Connect.page_cargo.search_title = param_data.title;
Connect.page_cargo.search_query = Connect.search_query;
Connect.page_cargo.search_synonyms = Connect.search_synonyms;
Connect.page_cargo.search_minimum_word_length = param_data.minimum_word_length;
Connect.page_cargo.search_stop_words = param_data.stop_words;
// add page_cargo.pathname
// Display specified page
//
if (param_data.href !== undefined) {
var href = Navigation.NormalizeURL(param_data.href);
Navigation.Navigate(href, true);
}
},
'page_clicked': function (param_data) {
if (Connect.scope_enabled) {
Scope.CloseDropDown();
}
Connect.ProcessAnalyticsEvent('page_click');
},
'search_page_clicked': function (param_data) {
if (Connect.scope_enabled) {
Scope.CloseDropDown();
}
},
'page_helpful_button_click': function (param_data) {
switch (param_data.helpful) {
case 'yes':
Connect.ProcessAnalyticsEvent('page_helpful_button_click_yes');
break;
case 'no':
Connect.ProcessAnalyticsEvent('page_helpful_button_click_no');
break;
}
},
'search_helpful_button_click': function (param_data) {
switch (param_data.helpful) {
case 'yes':
Connect.ProcessAnalyticsEvent('search_helpful_button_click_yes');
break;
case 'no':
Connect.ProcessAnalyticsEvent('search_helpful_button_click_no');
break;
}
},
'parcel_load': function (param_data) {
var parcel = Parcels.entries[param_data.id];
if (parcel) {
parcel.content = param_data.content;
parcel.done();
}
},
'index_load': function (param_data) {
var index_object = Connect.index_objects[param_data.id];
if (index_object) {
index_object.content = param_data.content;
index_object.done();
}
}
};
}
// Dispatch event
//
try {
Connect.dispatch_listen[param_event.data.action](param_event.data);
} catch (ignore) {
// Keep on rolling
//
}
};
Connect.UpdateTitle = function () {
var title, page_document;
// Determine title
//
title = '';
if (Connect.SearchEnabled()) {
// Make the search title custom from a Target Setting
//
title = Connect.search_title;
if (Connect.search_query !== undefined && Connect.search_query.length > 0) {
title += ': ' + Connect.search_query;
}
} else if (Navigation.page_info) {
title = Navigation.page_info.title;
} else {
page_document = Browser.GetDocument(Connect.page_iframe);
if (page_document !== undefined) {
title = page_document.title;
}
}
// Set title
//
Connect.SetTitle(title);
};
Connect.SetTitle = function (param_title) {
// Update window title
//
Connect_Window.document.title = param_title;
};
Connect.OnDocumentLoad = function () {
var enable_button;
// Document bookkeeping
//
Navigation.DocumentBookkeeping(false);
// Update title
//
Connect.UpdateTitle();
// Update home
//
enable_button = !Navigation.page_info || !Browser.SameDocument(Navigation.default_page_url, Navigation.page_info.href) || Connect.SearchEnabled();
Connect.EnableDisableButton('ww_behavior_home', 'ww_skin_home', enable_button);
// Update prev/next
//
Navigation.UpdatePrevNext();
// Socialize and Globalize
//
Connect.Socialize();
Connect.Globalize();
// if we have document dimensions, resize
//
if (Navigation.page_info && Navigation.page_info.dimensions) {
Connect.ResizePage();
}
};
Connect.OnDocumentUnload = function () {
Connect.page_first_scroll = true;
Connect.UpdateTitle();
};
Connect.DisplayFullsizeImage = function (param_image_data) {
var display_in_lightbox, browser_widthheight, fullsize_image;
// Always display images in lightbox?
//
display_in_lightbox = Connect.lightbox_large_images;
if (!display_in_lightbox) {
// Retrieve width/height info
//
browser_widthheight = Browser.GetBrowserWidthHeight(Connect_Window);
// Enough room for lightbox?
//
if (((param_image_data.width + Connect.lightbox_min_pixel_margin) < browser_widthheight.width) && ((param_image_data.height + Connect.lightbox_min_pixel_margin) < browser_widthheight.height)) {
display_in_lightbox = true;
}
}
// Display in lightbox?
//
if (display_in_lightbox) {
// Create image to display
//
fullsize_image = Connect_Window.document.createElement('img');
Browser.SetAttribute(fullsize_image, 'src', param_image_data.src);
fullsize_image.onclick = function (e) {
// Prevent the lightbox from closing if the image is clicked
//
e.stopPropagation();
};
// Display lightbox
//
Connect.Lightbox.Display(
function (param_lightbox_frame, param_lightbox_content) {
param_lightbox_content.innerHTML = '';
param_lightbox_content.appendChild(fullsize_image);
},
function (param_lightbox_frame, param_lightbox_content) {
param_lightbox_content.removeChild(fullsize_image);
}
);
} else {
// Replace displayed document
//
var href = Navigation.NormalizeURL(param_image_data.href);
Navigation.Navigate(href, false);
}
};
Connect.ScrollToMenuElement = function (param_element) {
var browser_widthheight, menu_height, element_scroll_position,
menu_75_height, menu_50_height, target_scroll_top,
menu_frame_scroll_position, index_active, toc_active, menu_scroll_element;
index_active = document.querySelector("#menu_content #index_content") !== null;
toc_active = document.querySelector("#menu_content #toc_content") !== null;
if (index_active) {
menu_scroll_element = Connect.index_content_div;
} else if (toc_active) {
menu_scroll_element = Connect.toc_content_div;
}
if (menu_scroll_element !== undefined) {
// Narrow or wide layout?
//
if ((Connect.layout_wide) || (Connect.layout_tall)) {
// Scroll to element position
//
browser_widthheight = Browser.GetBrowserWidthHeight(Connect_Window);
menu_height = browser_widthheight.height;
element_scroll_position = Browser.GetElementScrollPosition(param_element, menu_scroll_element);
menu_75_height = Math.floor(menu_height * 0.75);
menu_50_height = Math.floor(menu_height * 0.5);
if ((element_scroll_position.top >= menu_scroll_element.scrollTop) &&
(element_scroll_position.top <= (menu_scroll_element.scrollTop + menu_75_height))) {
// Do nothing
//
target_scroll_top = menu_scroll_element.scrollTop;
} else {
if (element_scroll_position.top < menu_75_height) {
target_scroll_top = 0;
} else {
target_scroll_top = element_scroll_position.top - menu_50_height;
}
}
menu_scroll_element.scrollTop = target_scroll_top;
} else {
menu_frame_scroll_position = Browser.GetElementScrollPosition(menu_scroll_element);
element_scroll_position = Browser.GetElementScrollPosition(param_element);
Connect.ScrollTo(
menu_frame_scroll_position.left + element_scroll_position.left,
menu_frame_scroll_position.top + element_scroll_position.top
);
}
}
};
Connect.SyncTOC = function (param_cleanup_folders) {
var entry_state, toc_entry, entry_div, folder_exceptions,
parent_ul, parent_entry_div, button_span, is_entry_first_child, ul_previous_sibling;
// Clear highlight
//
if (Connect.toc_selected_entry_key !== undefined) {
entry_state = Connect.toc_class_states[Connect.toc_selected_entry_key];
if (entry_state !== undefined) {
entry_state.element.className = entry_state.className;
}
Connect.toc_selected_entry_key = undefined;
}
// Locate TOC entry
//
toc_entry = Connect.LocateTOCEntry();
// Expand TOC for context
//
if (toc_entry !== null) {
// Highlight entry
//
entry_div = Browser.FirstChildElementWithTagName(toc_entry, 'div');
if (entry_div !== null) {
// Clean up folders?
//
if (param_cleanup_folders) {
folder_exceptions = {};
if (Browser.ContainsClass(entry_div.className, 'ww_skin_toc_folder')) {
folder_exceptions[Connect.TOC_ElementKey(entry_div)] = true;
}
parent_ul = Browser.FindParentWithTagName(entry_div, 'ul');
while (parent_ul !== null) {
parent_entry_div = Browser.PreviousSiblingElementWithTagName(parent_ul, 'div');
if (parent_entry_div !== null) {
if (Browser.ContainsClass(parent_entry_div.className, 'ww_skin_toc_folder')) {
folder_exceptions[Connect.TOC_ElementKey(parent_entry_div)] = true;
}
}
parent_ul = Browser.FindParentWithTagName(parent_ul, 'ul');
}
Connect.TOC_RestoreClassStates(folder_exceptions);
}
// Highlight
//
// Is the TOC entry hidden?
//
if (Browser.ContainsClass(toc_entry.className, 'ww_skin_toc_entry_hidden')) {
// Attempt to highlight parent TOC entry
//
parent_ul = Browser.FindParentWithTagName(toc_entry, 'ul');
is_entry_first_child = parent_ul.firstChild === toc_entry;
if (is_entry_first_child) {
ul_previous_sibling = parent_ul.previousElementSibling;
// Is the previous sibling a TOC entry?
if (Browser.ContainsClass(ul_previous_sibling.className, 'ww_skin_toc_entry')) {
Connect.TOC_RecordClassState(ul_previous_sibling);
ul_previous_sibling.className = Browser.AddClass(ul_previous_sibling.className, 'ww_skin_toc_entry_selected');
Connect.toc_selected_entry_key = Connect.TOC_ElementKey(ul_previous_sibling);
}
}
} else {
Connect.TOC_RecordClassState(entry_div);
entry_div.className = Browser.AddClass(entry_div.className, 'ww_skin_toc_entry_selected');
Connect.toc_selected_entry_key = Connect.TOC_ElementKey(entry_div);
}
// Expand entry and parents
//
Connect.TOCFolder_Open(entry_div);
parent_ul = Browser.FindParentWithTagName(entry_div, 'ul');
while (parent_ul !== null) {
parent_entry_div = Browser.PreviousSiblingElementWithTagName(parent_ul, 'div');
if (parent_entry_div !== null) {
Connect.TOCFolder_Open(parent_entry_div);
}
parent_ul = Browser.FindParentWithTagName(parent_ul, 'ul');
}
// Scroll to TOC position if TOC displayed
//
button_span = Connect.buttons['ww_behavior_toc'];
if (button_span && Connect.Menu.menu_mode_visible === 'toc') {
Connect.ScrollToMenuElement(toc_entry);
}
}
}
};
Connect.Button_Home = function () {
if (!Connect.ButtonDisabled(Connect.buttons['ww_behavior_home'])) {
// Go to default page
//
var href = Navigation.NormalizeURL(Navigation.default_page_url);
Navigation.Navigate(href, true);
Connect.ProcessAnalyticsEvent('toolbar_button_home_click');
}
};
Connect.Button_External = function (param_link) {
if (param_link !== null) {
var link_href;
link_href = param_link.href;
// Follow Link
//
if (link_href !== undefined && link_href !== '#') {
window.open(link_href, '_blank');
}
}
};
Connect.Button_TOC = function () {
var toc_button_span;
toc_button_span = Connect.buttons['ww_behavior_toc'];
if (Connect.Menu.Enabled && Connect.Menu.menu_mode_visible !== 'toc') {
var index_button_span;
index_button_span = Connect.buttons['ww_behavior_index'];
// Move the Index back to the panels div
//
Connect.panels_div.appendChild(Connect.index_div);
if (index_button_span !== undefined) {
index_button_span.className = Browser.RemoveClass(index_button_span.className, 'ww_skin_menu_nav_selected');
}
// Show
//
Connect.Menu.Display(
function (param_window, param_menu_content) {
// Highlight toolbar button
//
if (toc_button_span !== undefined) {
toc_button_span.className = Browser.AddClass(toc_button_span.className, 'ww_skin_menu_nav_selected');
}
// Sync TOC
//
Connect.SyncTOC(Connect.toc_cleanup_folders);
// On Stage
//
if (Connect.buttons['ww_behavior_toc'] !== undefined && Connect.buttons['ww_behavior_index']) {
param_menu_content.appendChild(Connect.nav_buttons_div);
}
param_menu_content.appendChild(Connect.toc_div);
// Retry Sync TOC if necessary
// (come back to this... do we need?)
//
Connect_Window.setTimeout(function () {
Connect.SyncTOC(Connect.toc_cleanup_folders);
}, 10);
},
function (param_window, param_menu_content) {
// Backstage
//
Connect.panels_div.appendChild(Connect.toc_div);
// Update title
//
Connect.UpdateTitle();
// Restore class info
//
Connect.TOC_RestoreClassStates();
// Highlight toolbar button
//
if (button_span !== undefined) {
button_span.className = Browser.ReplaceClass(button_span.className, 'ww_skin_toolbar_background_selected', 'ww_skin_toolbar_background_default');
}
});
Connect.sidebar_behavior = 'ww_behavior_toc';
Connect.Menu.menu_mode_visible = 'toc';
} else {
// Do nothing
//
}
};
Connect.Button_Index = function () {
var index_button_span;
index_button_span = Connect.buttons['ww_behavior_index'];
if (Connect.Menu.Enabled && Connect.Menu.menu_mode_visible !== 'index') {
var toc_button_span;
toc_button_span = Connect.buttons['ww_behavior_toc'];
// Move the TOC back to the panels div
//
Connect.panels_div.appendChild(Connect.toc_div);
if (toc_button_span !== undefined) {
toc_button_span.className = Browser.RemoveClass(toc_button_span.className, 'ww_skin_menu_nav_selected');
}
// Show
//
Connect.Menu.Display(
function (param_window, param_menu_content) {
// Highlight toolbar button
//
if (index_button_span !== undefined) {
index_button_span.className = Browser.AddClass(index_button_span.className, 'ww_skin_menu_nav_selected');
}
if (Connect.buttons['ww_behavior_toc'] !== undefined && Connect.buttons['ww_behavior_index']) {
param_menu_content.appendChild(Connect.nav_buttons_div);
}
// On Stage
//
if (!Parcels.index_loaded) {
if (!Parcels.index_loading) {
// Initiate index load
//
Parcels.index_loading = true;
Connect.index_content_div.innerHTML = '';
Connect_Window.setTimeout(Connect.Index_Load);
}
} else {
// Show index
//
param_menu_content.appendChild(Connect.index_div);
}
},
function (param_window, param_menu_content) {
// Backstage
//
Connect.panels_div.appendChild(Connect.index_div);
// Update title
//
Connect.UpdateTitle();
// Highlight toolbar button
//
if (button_span !== undefined) {
button_span.className = Browser.ReplaceClass(button_span.className, 'ww_skin_toolbar_background_selected', 'ww_skin_toolbar_background_default');
}
});
Connect.sidebar_behavior = 'ww_behavior_index';
Connect.Menu.menu_mode_visible = 'index';
} else {
// Do nothing
//
}
};
Connect.Button_Search = function () {
var search_enabled;
search_enabled = Connect.SearchEnabled();
if (!search_enabled) {
// Do the search
//
Navigation.HandleSearchURL();
Connect.ShowSearchPage();
Connect.ProcessAnalyticsEvent('toolbar_button_search_click');
} else {
// Go back to the content page
//
Navigation.BackToCurrentPage();
Connect.HideSearchPage();
Connect.ProcessAnalyticsEvent('toolbar_button_search_cancel_click');
}
};
Connect.Button_Globe = function () {
var button_span, page_document;
// Menu visible in mobile?
//
if (Connect.Menu.Enabled && Connect.Menu.Visible() && !Connect.layout_wide) {
// Hide
//
Connect.Menu.Hide();
}
// Enabled?
//
button_span = Connect.buttons['ww_behavior_globe'];
if (!Connect.globe_enabled) {
// Highlight toolbar button
//
if (button_span !== undefined) {
button_span.className = Browser.ReplaceClass(button_span.className, 'ww_skin_toolbar_background_default', 'ww_skin_toolbar_background_selected');
}
// Globalize
//
Connect.globe_enabled = true;
Connect_Window.setTimeout(Connect.Globalize);
} else {
// Disable globalization
//
Connect.globe_enabled = false;
page_document = Browser.GetDocument(Connect.page_iframe);
if (page_document !== undefined) {
Connect_Window.setTimeout(function () {
page_document.location.reload();
});
}
// Highlight toolbar button
//
if (button_span !== undefined) {
button_span.className = Browser.ReplaceClass(button_span.className, 'ww_skin_toolbar_background_selected', 'ww_skin_toolbar_background_default');
}
}
Connect.ProcessAnalyticsEvent('toolbar_button_translate_click');
};
Connect.Button_Menu_Toggle = function () {
var menu_opened, menu_closed, menu_initial, layout_narrow;
menu_opened = Browser.ContainsClass(Connect.presentation_div.className, 'menu_open');
menu_closed = Browser.ContainsClass(Connect.presentation_div.className, 'menu_closed');
menu_initial = Browser.ContainsClass(Connect.presentation_div.className, 'menu_initial');
layout_narrow = Browser.ContainsClass(Connect.layout_div.className, 'layout_narrow');
menu_opened = menu_opened && !(menu_initial && layout_narrow);
if (menu_opened) {
Connect.Menu.Hide();
}
else if (menu_closed) {
Connect.Menu.Show();
}
else {
Connect.Menu.Show();
}
Connect.ProcessAnalyticsEvent('toolbar_button_menu_click');
};
Connect.Button_Previous = function () {
if (!Connect.ButtonDisabled(Connect.buttons['ww_behavior_prev'])) {
// Menu visible in mobile?
//
if (Connect.Menu.Enabled && Connect.Menu.Visible() && !Connect.layout_wide) {
// Hide
//
Connect.Menu.Hide();
}
Navigation.GotoPrevNext('Prev');
Connect.ProcessAnalyticsEvent('toolbar_button_prev_click');
}
};
Connect.Button_Next = function () {
if (!Connect.ButtonDisabled(Connect.buttons['ww_behavior_next'])) {
// Menu visible in mobile?
//
if (Connect.Menu.Enabled && Connect.Menu.Visible() && !Connect.layout_wide) {
// Hide
//
Connect.Menu.Hide();
}
Navigation.GotoPrevNext('Next');
Connect.ProcessAnalyticsEvent('toolbar_button_next_click');
}
};
Connect.Button_Email = function () {
var message, mailto;
// Menu visible in mobile?
//
if (Connect.Menu.Enabled && Connect.Menu.Visible() && !Connect.layout_wide) {
// Hide
//
Connect.Menu.Hide();
}
if ((Connect.email.length > 0) && (Connect.email_message.length > 0)) {
message = Connect.email_message.replace('$Location;', Connect_Window.location.href);
if (Connect_Window.navigator.userAgent.indexOf('MSIE') !== -1) {
message = message.replace('#', '%23');
}
mailto =
'mailto:' +
Connect.email +
'?subject=' +
Browser.EncodeURIComponentIfNotEncoded(message) +
'&body=' +
Browser.EncodeURIComponentIfNotEncoded(message);
Connect_Window.open(mailto, '_blank');
}
};
Connect.Button_Print = function () {
var page_window, data;
// Report click event
//
Connect.ProcessAnalyticsEvent('page_button_print_click');
// Try direct method
//
try {
page_window = Connect.page_iframe.contentWindow || Connect_Window.frames['connect_page'];
if ((page_window !== undefined) && (page_window !== null)) {
page_window.print();
}
} catch (ignore) {
// Try page action
//
data = {
'action': 'ww_behavior_print'
};
Message.Post(Connect.page_iframe.contentWindow, data, Connect_Window);
}
};
Connect.Button_PDF = function () {
var data;
// Try page action
//
data = {
'action': 'ww_behavior_pdf'
};
Message.Post(Connect.page_iframe.contentWindow, data, Connect_Window);
};
Connect.ScrollTo = function (x, y) {
Connect.container_div.scrollLeft = x;
Connect.container_div.scrollTop = y;
};
Connect.SearchEnabled = function () {
var search_enabled;
search_enabled = Browser.ContainsClass(presentation_div.className, 'search_enabled');
return search_enabled;
};
Connect.ShowSearchPage = function () {
Connect.presentation_div.className = Browser.AddClass(Connect.presentation_div.className, 'search_enabled');
Connect.EnableDisableButton('ww_behavior_prev', 'ww_skin_prev', false);
Connect.EnableDisableButton('ww_behavior_next', 'ww_skin_next', false);
Connect.EnableDisableButton('ww_behavior_home', 'ww_skin_home', true);
Connect.Menu.CalculateMenuSize();
};
Connect.HideSearchPage = function () {
Connect.presentation_div.className = Browser.RemoveClass(Connect.presentation_div.className, 'search_enabled');
Navigation.UpdatePrevNext();
Connect.Menu.CalculateMenuSize();
};
Connect.HandleSearch = function () {
if (Connect.search_query !== undefined) {
var data, search_query, search_enabled;
search_query = Connect.search_query;
search_enabled = Connect.SearchEnabled();
if (search_query.length > 0 && !search_enabled) {
// Show the page if not visible.
Connect.ShowSearchPage();
}
Connect.search_query = search_query;
data = {
'action': 'search_connect_info',
'target': Connect_Window.name,
'base_url': Navigation.base_url,
'parcel_prefixes': Parcels.prefixes,
'parcel_sx': Parcels.search,
'query': Connect.search_query
};
if (Connect.scope_enabled) {
var search_scope_selection_titles_string;
search_scope_selection_titles_string = Scope.GetSearchScopeSelectionTitlesString();
data['search_scopes'] = Scope.search_scopes;
data['search_scope_map'] = Scope.search_scope_map;
data['search_scope_selections'] = Scope.search_scope_selections;
data['search_scope_selection_titles'] = search_scope_selection_titles_string;
}
Message.Post(Connect.search_iframe.contentWindow, data, Connect_Window);
}
Connect.UpdateTitle();
};
Connect.ButtonDisabled = function (param_button) {
var is_disabled;
// Be permissive with this one because we only want to stop certain behavior
//
is_disabled = false;
if (param_button && typeof param_button === 'object') {
is_disabled = Browser.ContainsClass(param_button.className, 'ww_skin_toolbar_button_disabled');
}
return is_disabled;
};
Connect.DisplayUnsupportedBrowserView = function () {
var body, unsupported_browser_element;
body = document.body;
unsupported_browser_element = document.getElementById('unsupported_browser').outerHTML;
body.innerHTML = unsupported_browser_element;
};
Connect.ShowPageLoading = function () {
if (Connect.page_loading_div) {
Connect.page_loading_div.style.display = 'flex';
}
};
Connect.HidePageLoading = function () {
if (Connect.page_loading_div) {
Connect.page_loading_div.style.display = 'none';
}
};
window.onclick = function (param_event) {
if (Connect.scope_enabled) {
var is_child_of_options, is_child_of_selector;
is_child_of_selector = Browser.IsChildOfNode(param_event.target, document.getElementById('search_scope'));
is_child_of_options = Browser.IsChildOfNode(param_event.target, document.getElementById('search_scope_options'));
if (!is_child_of_selector && !is_child_of_options) {
Scope.CloseDropDown();
}
}
};
// Start running as soon as possible
//
if (window.addEventListener !== undefined) {
window.document.addEventListener('DOMContentLoaded', Connect.OnLoad, false);
}