/**
* @fileoverview JavaScript file for offsite navbar access.
*/
/** Global var that holds the navbar HTML */
var sbNavbar = '
';
/** Global var that holds the usertools HTML */
var sbUserTools = '';
/** Global var that holds the lower partner ads HTML */
var sbPartner = '';
/** Global var that holds the footer HTML */
var sbFooter = '';
/**
Highlight map based on URL.
*/
var highlight_map = {
'http://topics.sacbee.com/arnold(\\+| |%20)schwarzenegger':
[
'#nav-capital', 'Arnold'
],
'http://www.sacbee.com/garage-sales-kit':
[
'#nav-classified', 'Garage'
],
'http://www.sacbee.com/vendor_zv':
[
'#nav-entertainment', 'Calendar'
],
'http://www.sacbee.com/static/sacautoshow':
[
'#nav-cars', ''
],
'http://':
[
'#nav-news', ''
]
};
/**
* Shows the navbar.
* @param {String} [element] an optional DOM element ID to fill with the navbar data
*/
function show_vendor_navbar (element) {
if (element) {
jQuery("#" + element).html(sbNavbar);
} else {
document.write(sbNavbar);
}
Sacbee.enable_navbar('main-navbar', 'nav-news', '');
// Set the highlight too
for (var link in highlight_map) {
var link_regex = new RegExp(link, "i");
if (String(document.location).match(link_regex)) {
set_nav_subnav(highlight_map[link][0], highlight_map[link][1]);
break;
}
}
}
/**
* Shows the user tools.
* @param {String} [element] an optional DOM element ID to fill with the navbar data
*/
function show_vendor_usertools (element) {
if (element) {
jQuery("#" + element).html(sbUserTools);
} else {
document.write(sbUserTools);
}
Sacbee.enable_readerservices_menus();
}
/**
* Shows the user tools.
* @param {String} [element] an optional DOM element ID to fill with the navbar data
*/
function show_partner_ads (element) {
if (element) {
jQuery("#" + element).html(sbPartner);
} else {
document.write(sbPartner);
}
}
/**
* Shows the user tools.
* @param {String} [element] an optional DOM element ID to fill with the navbar data
*/
function show_vendor_footer (element) {
if (element) {
jQuery("#" + element).html(sbFooter);
} else {
document.write(sbFooter);
}
}