jQuery.noConflict(); jQuery(document).on('submit', 'form[name=availableAttributesSearch]', function() { var selected_attributes = getSelectedAttributes(true); var selected_attributes_split = getSelectedAttributes(false, true); jQuery('input[name=attSearchList]').val(selected_attributes.attributevalues); jQuery('input[name=attributes]').val(selected_attributes_split.attributes); jQuery('input[name=attributeValues]').val(selected_attributes_split.attributevalues); }); function attributeSearch_initTabs() { /* Initialize Tabs */ var attributeTabs=new ddtabcontent("attributeTabs"); attributeTabs.setselectedClassTarget("link"); attributeTabs.init(); jQuery('.select-availattributes').children('option:selected').attr('selected', false); setURLSpecifiedSearchAttributes(); } jQuery(document).on('click', '.attsearch-more-link', function() { var clicked_link = jQuery(this); var invisible_elements = clicked_link.parent().siblings(); jQuery.each(invisible_elements, function(key, link) { jQuery(link).show(); }); clicked_link.hide(); }); jQuery(document).on('change', '.select-availattributes', function() { markSelection(jQuery(this)); refreshSelectionOptions(); }); jQuery(document).on('click', '.attribute-search-selection-clear', function() { clearSelection(jQuery(this)); refreshSelectionOptions(); }); // Client Side Caching var queryCache = {}; function getCachedResponse(parameters) { var serialized = JSON.stringify(parameters); if ( typeof(queryCache[serialized]) != 'undefined' ) { return queryCache[serialized]; } else { return false; } } function cacheResponse(parameters, result) { var serialized = JSON.stringify(parameters); queryCache[serialized] = result; } function setURLSpecifiedSearchAttributes() { jQuery('.select-availattributes').each( function(key, select_option) { var select_id = jQuery(select_option).attr('data-id'); var querystring_value = 0; if(querystring(select_id).length > 0) { querystring_value = decodeURIComponent(querystring(select_id)[0]).replace('+', '\ '); } if (querystring_value.length > 0 && querystring_value != '0') { jQuery(select_option).children('option[value="' + querystring_value + '"]').attr('selected', true); jQuery(select_option).change(); } }); } function refreshSelectionOptions() { var selectedAttributes = getSelectedAttributes(); var target = jQuery(this); var cacheResult = getCachedResponse(selectedAttributes); if (cacheResult != false) { showAvailableAttributes( target, cacheResult); } else { jQuery.ajax( { url: "/index.cfm?fuseaction=catalog.attributeOptionsSearch", data: selectedAttributes, dataType: 'json', type: 'GET', success: function(data) { cacheResponse(selectedAttributes, data.DATA); showAvailableAttributes( target, data.DATA ); } } ); } } function markSelection(select_obj) { var selected_val = select_obj.children('option:selected').val(); if (selected_val != 0) { // Create selection filler text with remove option var filler_text_wrapper = jQuery('