var onInputField = false; var shiftStatus = false; var ctrlStatus = false; var altStatus = false; var gStatus = false; var filenameLimit = 80; var filenameAlertPart1 = "The file name that you provided is too long. Please use a file name with less than "; var filenameAlertPart2 = " characters."; var original_values = []; var ajq = jQuery.noConflict(); ajq(document).ready(function () { 'use strict'; // This fixes a conflict between jQuery and RichFaces in IE 6/7 ajq.ajaxSetup({xhr: function () { //return new window.XMLHttpRequest(); try { if (window.ActiveXObject) { return new window.ActiveXObject("Microsoft.XMLHTTP"); } } catch (e) {} return new window.XMLHttpRequest(); } }); //setupSearchBox(); doAutoSuggest(); setupAccountDropdown(); decorateOutgoingLinks(); updateLanguagePicker(); updateLoginLink(); changeNavigationState(); checkUserStatus(); textPlaceholder(); autogrowTextarea(); sideNav(); megaMenu(); doOutageMessage(); startIdleTimer(); toggleSearchBar(); tempSqiIssue(); createBreadCrumb(); // Create breadcrumbs on the page placeBreadcrumbs(); //Add a handler so that if any input has focus // our keyboard shortcuts don't steal it ajq(":input").focus(function() { onInputField = true; }).blur(function() { onInputField = false; }); // decorate with class attribute representing the language ajq("body").addClass(avalon.lang); ajq('#accountLogout').click(function(){deleteCookies();}); }); // Function to handle the breadcrumbs object function createBreadCrumb() { var htmlString = ""; } ajq("#main-wrap .wrapi").prepend(htmlString); } catch(err) { // console.log(err); } } function ieAccountBarHack() { var width = 0; var loginLis = ajq('#utility-links > div > ul > li'); loginLis.each(function() { var element = ajq(this); width += element.outerWidth(); }); ajq('#utility-links').width(width + 20); } function tempSqiIssue() { // CHANGE IN KBASE AND THEN REMOVE THIS! if (window.location.pathname.indexOf('/knowledge/solutions') == 0) { var form = ajq('.sqiEvaluationForm'); form.removeClass('sqiEvaluationForm'); form.addClass('sqiEvaluationFormHack'); ajq('.sqiEvaluationFormHack').click(function() { var checks = 0; ajq('.sqiEvaluationFormHack > div > div').each(function() { var inputs = ajq(this).find('input'); checks += inputs.filter(':checked').length; }); if (checks === 6) { ajq('.sqiEvaluationFormHack input:submit').removeAttr('disabled'); } }); } } function deleteCookies() { var i=0; var cookies =new Array('SpryMedia_DataTables_caseListForm:supportCasesList_closed','SpryMedia_DataTables_caseListForm:supportCasesList_open','SpryMedia_DataTables_caseListForm:supportCasesList_list','SpryMedia_DataTables_caseListForm:supportCasesList_all'); for(i=0; i<4; i++) { delete_cookie(cookies[i]); } } function delete_cookie ( cookie_name ) { var cookie_date = new Date ( ); // current date & time cookie_date.setTime ( cookie_date.getTime() - 1 ); document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString(); } function setupSearchBox(){ if (getApplication() == "kbase") { jQuery("select[name=col] option[value=avalon_portal]").attr("selected",false); jQuery("#searchDropRedhat").removeClass("selected"); jQuery("select[name=col] option[value=redhat_kbase]").attr("selected",true); jQuery("#searchDropRedhat_kbase").addClass("selected"); jQuery(".label").html(jQuery("select[name=col] option[value=redhat_kbase]").text()); } } /** * Sets up the dropdown menu for the accounts */ function setupAccountDropdown() { // Hide the menu when clicked anywhere outside of it ajq(document).click(function(e){ if ((e.target.id!="accountUserNameMenu") && (ajq(e.target).parents("#accountUserNameMenu").length != 1)) { ajq("#accountUserNameMenu").hide(); ajq("#accountUser").parent().removeClass("open"); } }); // Show the menu when #accountUserName is clicked ajq("#accountUserName").click(function(e){ this.blur(); var accountUserWidth = ajq("#accountUser").width(); ajq("#accountUserNameMenu").css('width', accountUserWidth).toggle(); ajq("#accountUser").parent().toggleClass("open"); e.preventDefault(); e.stopPropagation(); }); } /** * Get's the application from the path context * * return The name of the application */ function getApplication() { var contexts = window.location.pathname.split("/"); var context = "/" + contexts[1]; var context2 = "/" + contexts[2]; var context3 = "/" + contexts[3]; if (context == "/issue-tracker") { return "issue-tracker"; } else if (context == avalon.cspContext) { if (context3.toLowerCase().indexOf("software") != -1) { return "jbossnetwork_downloads"; } else if (context3.toLowerCase().indexOf("case") != -1) { return "jbossnetwork_support"; } else { return "jbossnetwork"; } } else if (context == avalon.kbaseContext) { return "kbase"; } else if (context == "subscriptions") { return "ccActive"; } else if (context == avalon.customerCenterContext && context2 == "/support") { context4 = contexts[4]; if (context4 == "subscriptions.html") { return "ccActive"; } else if (context4 == "renewals.html") { return "ccRenewals"; } else { return "ccOverview"; } } return null; } /** * Add the outgoing icon to non local links */ function decorateOutgoingLinks() { var a = document.getElementsByTagName('a'); if ((a.length > 1000) || (typeof(NO_EXTERN) != 'undefined' )) { ajq('#navPrimary a:not(:has(img))').filter(function() { for (var i = 0; i < avalon.decorationWhitelist.length; i++) { var whitelistName = avalon.decorationWhitelist[i].replace('http://','').replace('https://', ''); if (whitelistName === this.hostname || this.hostname === "") { return false; } } return true; }).addClass('outgoing'); } else { ajq('#container a[href]:not(:has(img)), .mega a:not(:has(img))').filter(function() { for (var i = 0; i < avalon.decorationWhitelist.length; i++) { var whitelistName = avalon.decorationWhitelist[i].replace('http://','').replace('https://', ''); if (whitelistName === this.hostname || this.hostname === "") { return false; } } return true; }).addClass('outgoing'); } } /** * Handle language changer on docs pages */ function docsLanguageChange() { var lang = ajq('#docsLanguage').val(); //var url = '/changeLanguage?language=' + lang + '&redirectTo=' + window.location.href; var newDoc = window.location.href; if (newDoc.match(/locale=.*$/)) { newDoc = newDoc.replace(/locale=.*$/,"locale="+lang); } else { newDoc = newDoc + "?locale="+lang+""; } var url = '/redirect?redirectTo=' + newDoc; window.location.href = url; } /** * Updates the links in the language picker to include the current url */ function updateLanguagePicker() { ajq("#editions a").each(function() { this.href = this.href + "&redirectTo=" + escape(window.location); // Get rid of duplicate language parameter. Allow the proper, // single-valued parameter. Not the propagated one. var langParams = this.href.match(/language(=|%3D)/g).length; if (langParams > 1) { // Sometimes the commas are double escaped this.href = this.href.replace(/language(=|%3D)\w*?(,|%2C|%252C)\w*?(&|%26)/g, ''); } }); } function updateLoginLink() { ajq("#accountLogin").each(function() { this.href = this.href + "?redirectTo=" + escape(window.location); }); } /** * Gets the users status from the service call. Then changes the login status * and handles unknown languages. */ function checkUserStatus() { var service = avalonHost + "/services/user/status?jsoncallback=?"; // Disable caching for IE bugs ajq.ajaxSetup ({ cache: false}); ajq.getJSON(service, function(data) { handleLoginDiv(data.authorized, data.hello, data.name, data.account_number); checkUserLanguage(data.lang, data.lang_err_msg); }); } /** * Changes the login div based on the authorized state * * authorized True or False based on the users login state * hello The verbage for hello in the navtive language * name The users name to display in header */ function handleLoginDiv(authorized, hello, name, accountNumber) { if (authorized) { ajq("#accountLinksLoggedIn").css("display", "block"); setUsername(hello, name); setAccountNumber(accountNumber); ajq('body').addClass('loggedIn').removeClass('loggedOut'); } else { ajq("#accountLinksLoggedOut").css("display", "block"); ajq('body').addClass('loggedOut').removeClass('loggedIn'); } /* * We need this here so that in IE we resize the #utility-links * Also this needs to happen *after* the login div is handled */ if (ajq.browser.msie) { if (parseInt(ajq.browser.version) <= 7) { ieAccountBarHack(); } } } /** * Sets the username in the header, instead of My Account * * hello The verbage for hello in the native language * name The username to set */ function setUsername(hello, name) { ajq('#accountUser').prepend(""+hello+" "); ajq('#accountUser #accountUserName').html(name); ajq('#accountUser #userFullName').html(name); } /** * Sets the account number in the account username menu */ function setAccountNumber(accountNumber) { if(accountNumber !== '') { ajq("#accountUserNameMenu .accountNumber .value").html(accountNumber); } else { ajq("#accountUserNameMenu .accountNumber").hide(); } } /** * Sets the correct navigation state. This is either set by the page as * siteMapState or base on the application */ function changeNavigationState() { if (!window.siteMapState) { var app = getApplication(); if (app == "issue-tracker") { window.siteMapState = "supportCases/cases"; } else if (app == "jbossnetwork_downloads") { window.siteMapState = "downloads/downloadsMiddleware"; } else if (app == "jbossnetwork_support") { window.siteMapState = "supportCases/cases"; } else if (app == "kbase") { window.siteMapState = "knowledge/kbase"; } else if (app == "ccOverview") { window.siteMapState = "subscription/overview"; } else if (app == "ccActive") { window.siteMapState = "subscription/active"; } else if (app == "ccRenewals") { window.siteMapState = "subscription/renewals"; } else { window.siteMapState = "start"; } } var ids = siteMapState.split("/"); changePrimaryNavigationState("#nav" + ids[0]); changeSecondaryNavigationState("#nav" + ids[0], "#nav" + ids[1]); } /** * Adds the class "active" to the given id * * id The id to make active */ function changePrimaryNavigationState(id) { ajq(id).addClass("active"); } /** * Displays the correct secondary navigation and set the secondary * item active * * id The id of the primary div * secondaryId The id of the secondary item */ function changeSecondaryNavigationState(id, secondaryId) { if (secondaryId != "#") { ajq(secondaryId).addClass("active"); } } /** * Checks to see if the current application supports the users language * * user_locale The users current language * unknown_lang_msg The message to display to the user */ function checkUserLanguage(user_locale, unknown_lang_msg) { var lang_it = ['en']; var lang_kbase = ['en', 'ja', 'zh_CN']; var lang_csp = ['en', 'ja', 'zh_CN']; var lang_cc = ['en', 'ja', 'zh_CN', 'zh', 'ko', 'es', 'fr', 'it', 'de']; lang = user_locale.split('_')[0]; country = user_locale.split('_')[1]; user_lang = lang; if (lang == 'zh') { user_lang = lang + "_" + country.toUpperCase(); } if (user_lang !== undefined && unknown_lang_msg !== undefined) { var app = getApplication(); if (app == "issue-tracker" && lang_it.indexOf(user_lang) == -1) { displayUnknownLangMsg(unknown_lang_msg); } else if ((app == "jbossnetwork_downloads" || app == "jbossnetwork_support" || app == "jbossnetwork") && lang_csp.indexOf(user_lang) == -1) { displayUnknownLangMsg(unknown_lang_msg); } else if (app == "kbase" && lang_kbase.indexOf(user_lang) == -1) { displayUnknownLangMsg(unknown_lang_msg); } else if (app == "customercenter" && lang_cc.indexOf(user_lang) == -1) { displayUnknownLangMsg(unknown_lang_msg); } } } /** * Prepends the supplied error message to the main div * * msg The message to display */ function displayUnknownLangMsg(msg) { ajq("#main").prepend("
"+msg+"
"); } /** * Shows the main content of the page and hides the loading dialog * * @return */ function hideLoadingDialog(targetDiv) { // DOM if (targetDiv === undefined || targetDiv === "") { targetDiv = 'searchResults'; } if (document.getElementById) { if (document.getElementById(targetDiv) !== null) { document.getElementById('prepage').style.visibility = 'hidden'; document.getElementById(targetDiv).className = ''; } } else { if (document.layers) { // NS4 document.prepage.visibility = 'hidden'; eval("document." + targetDiv + ".className = ''"); } else { // IE4 document.all.prepage.style.visibility = 'hidden'; document.all.item(targetDiv).className = ''; } } } /** * Fades the main content of the page and shows the loading dialog * * TODO There must be a more concise way of writing this * * @return */ function showLoadingDialog(targetDiv) { // DOM if (targetDiv === undefined || targetDiv === "") { targetDiv = 'searchResults'; } if (document.getElementById) { if (document.getElementById(targetDiv) !== null) { document.getElementById('prepage').style.visibility = 'visible'; document.getElementById(targetDiv).className = 'opacityOn'; } } else { if (document.layers) { // NS4 document.prepage.visibility = 'visible'; eval("document." + targetDiv + ".className = 'opacityOn'"); } else { // IE4 document.all.prepage.style.visibility = 'visible'; document.all.item(targetDiv).className = 'opacityOn'; } } } function blockUI(targetDiv){ ajq(targetDiv).block({message:null}); } function unblockUI(targetDiv){ ajq(targetDiv).unblock(); //extra clean-up - blockUI adds style position:relative which can break other input fields on the page ajq(targetDiv).removeAttr('style'); } /** * For all input elements with the textPlaceholder class, display a placeholder * text that disappears when the user clicks on it. * * TODO This could use some optimization. * * @return */ function textPlaceholder() { var service = avalonHost + "/services/user/status?jsoncallback=?"; // Load the internationalized string ajq.getJSON(service, function(data) { original_values['fileDescription'] = data.description_placeholder; // Set the initial value and color if (ajq('input#fileDescription').val() === '' || // This check allows refreshes to preserve behavior ajq('input#fileDescription').val() === original_values['fileDescription']) { ajq('input#fileDescription').val(function() {return original_values[this.id];}); }else{ ajq('input#fileDescription').removeClass("placeholder"); } // Set the methods to handle focus and blur events ajq('input#fileDescription').focus(function() { if (!original_values[this.id]) { original_values[this.id] = this.value; } if (this.value == original_values[this.id]) { this.value = ''; ajq(this).removeClass("placeholder"); } ajq(this).blur(function() { if (this.value === '') { this.value = original_values[this.id]; ajq(this).addClass("placeholder"); } }); }); ajq('#fileUploadForm').submit(function() { if (ajq('#fileDescription').hasClass('placeholder')){ ajq('#fileDescription').val(''); ajq('#fileDescription').removeClass("placeholder"); } }); }); } function autogrowTextarea() { try { ajq('textarea.autoresize').autoResize({ // On resize: onResize : function() { ajq(this).css({opacity:0.8}); }, // After resize: animateCallback : function() { ajq(this).css({opacity:1}); } }); } catch (err) { //This is a test to see if stuff works better now.... } } /** * Equalize the heights of #sideNav and #main */ function sideNav() { if (ajq('#sideNav').length && ajq('#main').length) { ajq('#sideNav, #main').equalHeights(); } } /** * Mega menu layout -- adjust the widths and balance the columns */ function megaMenu() { ajq('#navPrimary > ul > li').hover(function() { // total the outerWidth of each .col and the padding on .body and .cap var cols = 0; var total; ajq(this).find('.col').each(function(){ cols += parseInt(ajq(this).outerWidth(true)); }); body = parseInt(ajq(this).find('.body').css('padding-left')); cap = parseInt(ajq(this).find('.cap').css('padding-right')); total = cols + body + cap + 8; // add extra pixels for IE8+9 // set the width of .mega to total ajq(this).find('.mega').css('width', total); // call as separate function for IE 7+8 balanceCols(ajq(this)); }); } function balanceCols(element) { element.find('.col').equalHeights(); } /** * Equal Heights Plugin * Equalize the heights of elements. Great for columns or any elements * that need to be the same size (floats, etc). * * Version 1.0 * Updated 12/10/2008 * * Copyright (c) 2008 Rob Glazebrook (cssnewbie.com) * * Usage: $(object).x([minHeight], [maxHeight]); * * Example 1: $(".cols").equalHeights(); Sets all columns to the same height. * Example 2: $(".cols").equalHeights(400); Sets all cols to at least 400px tall. * Example 3: $(".cols").equalHeights(100,300); Cols are at least 100 but no more * than 300 pixels tall. Elements with too much content will gain a scrollbar. * */ (function(ajq) { ajq.fn.equalHeights = function(minHeight, maxHeight) { tallest = (minHeight) ? minHeight : 0; this.each(function() { if(ajq(this).height() > tallest) { tallest = ajq(this).height(); } }); if((maxHeight) && tallest > maxHeight) tallest = maxHeight; return this.each(function() { // Customized to use min-height for all browsers except IE 6. // ajq(this).height(tallest); ajq(this).css((ajq.browser.msie && ajq.browser.version < 7 ? '' : 'min-') + 'height', tallest); }); }; })(ajq); /** * Fades an element out and then another element in * @param hideElement, the element to hide * @param showElement, the element to show * @return */ function toggleInput(hideElement, showElement) { if (!ajq('body').hasClass('sfdc_readonly')) { ajq('.toggleInput').css("display", "none"); ajq('.toggleOutput').css("display", "inline"); ajq('#' + hideElement).fadeOut('fast', function() { ajq('#' + showElement).fadeIn('fast'); }); } } function doOutageMessage() { var message, now; if (portalOutageObj) { for (key in portalOutageObj) { message = portalOutageObj[key]; now = new Date(); if (now < message.end && now > message.start) { if (ajq('#messages').length === 0) { ajq('#content').prepend(''); } else if (ajq('div#messages').length !== 0) { ajq('div#messages').remove(); ajq('#content').prepend(''); } ajq('#messages').prepend('
  • '+message.message+'
  • '); } } } } function startIdleTimer() { ajq(document).ready(function(){ ajq(document).idleTimeout({ aliveUrl: '/services/ping' }); }); } function doAutoSuggest() { // Function that makes ajax calls to the GSA and responds with JSON function suggestAjaxCall(request, response, len) { ajq.ajax({ url: "/suggest", cache: false, dataType: "json", data: { format: "rich", client: "avalon_frontend", site: "avalon_portal", q: request.term }, success: function(data) { // trim the results array to len data.results.splice(len, data.results.length - len); //response(array.filter(function(elem){return elem.value.indexOf("inmeta:") == -1;})); // US9912, IE hates if we appy a filter to the ajq.map() var array = ajq.map(data.results, function(item) { return { label: item.name, value: item.name }; }); // Strip out elements that have inmeta in the title var strippedArray = []; for (var i = 0; i < array.length ; i++) { if (array[i].value.indexOf("inmeta:") == -1) { strippedArray.push(array[i]); } } // return the an array that contains no inmeta entries... without using .filter() response(strippedArray); } }); } // Adds our new fancey handlers to an element. Likely an function setupInput(element, activatable) { // Remove browsers autocomplete element.attr("autocomplete", "off"); element.keyup(function(){ if (element.val() === '') { // ensure that the close is not visible when element is empty close.addClass('nodisplay'); } else { // remove the display blocking class when a user starts typing close.removeClass('nodisplay'); } }); // Put the X/close anchor after the global search var closeID = 'searchClose_' + element.attr('id'); element.after('Close'); var close = ajq('#' + closeID.replace(':', '\\:')); // close the autocomplete flyout when the user clicks close close.mousedown(function() { element.autocomplete("close"); element.val(''); close.addClass('nodisplay'); element.focus(); }); element.focus(function() { // on focus add the active class and remove the input value (if it is Search) if (activatable) { element.addClass("active"); if (element.val() == searchLabel) { element.val(''); } } }).blur(function() { // on blur remove the active class and set an empty input value to Search if (element.val() === '') { if (activatable) { element.removeClass("active"); element.val(searchLabel); } close.addClass('nodisplay'); } }); } // Find important elements in the DOM (do this once) var globalBar = ajq("#topSearchInput"); var resultsBar = ajq(".quickSearchInput"); var keywordSearch = ajq("#keywordInput"); var searchLabel = ajq.trim(ajq("#searchLabel").text()); // WARNING! do not do .text().trim() because of an IE8 issue setupInput(globalBar, true); setupInput(resultsBar, false); // Setup autocomplete on page load for the globalBar globalBar.autocomplete({ appendTo: "#globalSearchBlock", open: function() { ajq('#topAdvSearch').hide(); }, close: function() { ajq('#topAdvSearch').show(); }, // Careful here. We override select to submit, but we _must_ manually shove the selected items val in the input first select: function(event, ui) { //cl_clk(null, ui.item.value, 'auto_suggest', null, null, 0, ajq('#col').val(), null) globalBar.val(ui.item.value); ajq('#topSearchForm').submit(); }, minLength: 2, source: function(request, response) { suggestAjaxCall(request, response, 10); } }); // Setup autocomplete on page load for the results page bar resultsBar.autocomplete({ appendTo: "div.searchField", // Careful here. We override select to submit, but we _must_ manually shove the selected items val in the input first select: function(event, ui) { //cl_clk(null, ui.item.value, 'auto_suggest', null, null, 0, page_site, null); resultsBar.val(ui.item.value); ajq('#quickSearchform').submit(); }, minLength: 2, source: function(request, response) { suggestAjaxCall(request, response, 5); } }); keywordSearch.autocomplete({ appendTo: "div.searchField", select: function(event, ui) { //cl_clk(null, ui.item.value, 'auto_suggest', null, null, 0, page_site, null); keywordSearch.val(ui.item.value); ajq('#keywordInputHidden').change(); }, minLength: 2, source: function(request, response) { suggestAjaxCall(request, response, 5); } }); } function displayMoreFacets(facetName){ currentIndex = parseInt(jQuery("#"+facetName+"-pos").html(), 10); var i = currentIndex; for (; icurrentIndex-5;i--){ jQuery("#"+facetName+i).hide(); } jQuery("#"+facetName+"-pos").html(i); jQuery("#"+facetName+"-more").show(); if (i == 5){ jQuery("#"+facetName+"-less").hide(); } } function getCookie(name) { var dc = document.cookie; var prefix = name + "="; var begin = dc.indexOf("; " + prefix); if (begin == -1) { begin = dc.indexOf(prefix); if (begin !== 0) { return null; } } else { begin += 2; } var end = document.cookie.indexOf(";", begin); if (end == -1) { end = dc.length; } return unescape(dc.substring(begin + prefix.length, end)); } /* * A function that finds the first input checkbox, and adds select all funtionality to it. */ function tableSelectAll(element) { var myTable = element; // Get the already initialized dataTable object. // var myDataTable = ajq(myTable).dataTable(); var thInput = element.find('th input').first(); ajq(thInput).change(function() { myTable.find('td input').each(function(index) { var input = ajq(this); if (input.is(':disabled') === true) { return; } if (thInput.attr('checked')) { input.attr('checked', 'checked'); //ajq('input', myDataTable.fnGetNodes()).attr('checked','checked'); } else { input.removeAttr('checked'); //ajq('input', myDataTable.fnGetNodes()).removeAttr('checked','checked'); } }); }); } /** * Toggle Width of Global Search Bar on/off Focus */ function toggleSearchBar() { var globalSearchBar = ajq('#topSearchInput'); var globalSearchBarWidth = globalSearchBar.width(); var initialText = globalSearchBar.val(); var searchButton = ajq('#searchButton'); var searchButtonOff = searchButton.attr('src'); var buttonStrSplit = searchButtonOff.split('-wht'); var searchButtonOn = (buttonStrSplit.length > 1) ? buttonStrSplit[0] + buttonStrSplit[1] : buttonStrSplit[0]; /* check and default just in case. */ globalSearchBar.focus(function(e){ /* calculate widths to determine max width based on window size */ brandWidth = ajq('#brand').width(); accountWidth = ajq('#utility-links').width(); headerWidth = ajq('#header').width(); newSearchWidth = headerWidth - (accountWidth + brandWidth) - 160; if (newSearchWidth < globalSearchBarWidth) { newSearchWidth = globalSearchBarWidth; } else if (newSearchWidth > 400) { newSearchWidth = 400; } searchButton.attr('src', searchButtonOn); ajq(this).stop().animate({ 'width' : newSearchWidth + 'px' }, 300); }); ajq(window).resize(function(e) { if (ajq('#globalSearchBlock .ui-autocomplete:visible').length === 0) { globalSearchBar.stop().animate({ 'width' : globalSearchBarWidth + 'px' }, 300); } }); ajq('#topSearchForm').focusout(function(e) { if (ajq('#globalSearchBlock .ui-autocomplete:visible').length === 0) { if (globalSearchBar.val() == '') { /* if we've typed something, then don't change the icon back. */ searchButton.attr('src', searchButtonOff); } globalSearchBar.stop().animate({ 'width' : globalSearchBarWidth + 'px' }, 300); } }); var searchForm = ajq('#topSearchForm'); searchForm.submit(function() { if (globalSearchBar.val() === initialText || globalSearchBar.val() === "") { return false; } }); } /** * Place Breadcrumbs */ function placeBreadcrumbs() { ajq('#breadcrumbs').remove().prependTo('#main-top').wrap('
    '); } function getCookieValue(cookieName) { var start, end; if(document.cookie.length > 0){ start=document.cookie.indexOf(cookieName + "="); if(start != -1 && (start == 0 || (document.cookie.charAt(start-1) === ' '))){ start += cookieName.length+1; end=document.cookie.indexOf(";",start); if(end == -1){end=document.cookie.length;} return unescape(document.cookie.substring(start,end)); } } return ""; } function cl_clk(url, query, ctype, cdata, rank, start, site, src_id){ var sessionId; if (!document.images) { return false; } var esc = encodeURIComponent || escape; var img = document.createElement('img'); query = query.replace(/\s+/g, "+"); if(document.cookie.indexOf('JSESSIONIDSSO') !== -1) { sessionId = 'SessionID:' + getCookieValue('JSESSIONIDSSO'); } else { sessionId = 'SessionID:' + getCookieValue('JSESSIONID'); } if(cdata !== null) { cdata = cdata + sessionId; cdata = cdata.replace(/\s+/g, "+"); } else { cdata = sessionId; } var src = "/click?" + (query ? "q=" + esc(query) : "") + (ctype ? "&ct=" + esc(ctype) : "") + (cdata ? "&cd=" + esc(cdata) : "") + (url ? "&url=" + esc(url.replace(/#.*/, "")).replace(/\+/g, "%2B") : ""); if (rank !== null && typeof rank !== 'undefined') { src += "&r=" + esc(rank); } if (start !== null && typeof start !== 'undefined') { src += "&s=" + esc(start); } if (site !== null && typeof site !== 'undefined') { src += "&site=" + esc(site); } if (src_id !== null && typeof src_id !== 'undefined') { src += "&src_id=" + esc(src_id); } img.src = src; return true; } .