//object holds global varibles// globobj_control_tabs = new Object(); /// global object for tab control globobj = new Object; /// generic global object globobj.outputObj = new Array; globobj.tempObj = new Object; globobj_bigslides = new Object; globobj_control_tabs.currentCount = 0; /// holds the output from the slider - sent back to database on every update /// THIS COMES FROM THE html PAGE. - Change to Server Variable /// sets the number of tabs in the control globobj_control_tabs.number_tabs = NUMBERTABS_VariableChangeToServer; ///////////////////////////////////////////////////////// /////////////////// variables for all pages with tabs ///////////////// if(globobj_control_tabs.number_tabs == 2) { ////////////////////////////////////////////////////////// //this block of Global Varibles for 2 tabs for two tabs // ////////////////////////////////////////////////////////// globobj_control_tabs.standard_correct = 25; globobj_control_tabs.mozilla_correct = 26; globobj_control_tabs.msie_correct = 26; }; if(globobj_control_tabs.number_tabs == 3) { /////////////////////////////////////// //this block for 3 tabs for two tabs // /////////////////////////////////////// globobj_control_tabs.standard_correct = 22; globobj_control_tabs.mozilla_correct = 24; globobj_control_tabs.msie_correct = 24; }; if(globobj_control_tabs.number_tabs == 4) { /////////////////////////////////////// //this block for 4 tabs for two tabs // /////////////////////////////////////// globobj_control_tabs.standard_correct = 15; globobj_control_tabs.mozilla_correct = 17; globobj_control_tabs.msie_correct = 17; }; /// When the screen is resized an event is fired / $(window).bind('resize', function() { adjustDivs('e'); }); /// confitugre the tab control $(document).ready(function() { //////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////// ////////////// Begin Search Page -Slide Controls /////////////////// //////////////////////////////////////////////////////////////// /////////////////////////////////////// //////////////////////// jQuery.fn.exists = function() { return this.length > 0; } /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// /// detect if you are on the search Results page ////////////////////////// /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// /// this code creates the big slider if($('.search_results_scroller').exists()) { moveBigScreen(); // alert('big slider'); } /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// /// detect if you are on the search page ////////////////////////////////// /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// if($('#search_slidesContainer').exists()) { //// buttons //////////////////////////////////// ///// SEARCH NOW BUTTON ///////////////////////// ///////////////////////////////////////////////// //////////////////////////////////////////////// ///// REMOVE ALL /////////////////////////////// //////////////////////////////////////////////// $("#btn_RemoveAll").click(function() { $(".tab_control_text_bubble_right_content").find(".tab_control_Slide_Item").remove(); $("#tab_control_text_bubble_left_content").find('.tab_control_Slide_plus_text').css('color', '#14364b'); $("#tab_control_text_bubble_left_content").find('.tab_control_Slide_plus_icon').css('background-position', '-2px -31px'); /////////////////////////////////////////////// }); ///////////////////////////////////// /////////// var for slider ////////// ///////////////////////////////////// globobj.maximumSearchCrit = 4 globobj.currentPosition = 0; globobj.slideWidth = $('#tab_control_text_bubble_left_content').width(); globobj.slides = $('.search_slide'); globobj.numberOfSlides = globobj.slides.length; globobj.itemsinSearchCrit = 'null23'; globobj.itemsinSearchCritAtMax = false; ///////////////////////////////////// /// change the slideHeader based on the currrent slide init_SlideHeaders(); search_sortIcons(); search_loadSlideHeader(globobj.currentPosition); // Remove scrollbar in JS $('#search_slidesContainer').css('overflow', 'hidden'); // Wrap all .slides with #slideInner div globobj.slides.wrapAll('
') // Float left to display horizontally, readjust .slides width .css({ 'float' : 'left', 'width' : globobj.slideWidth }); // Set #slideInner width equal to total width of all slides $('#slideInner').css('width', globobj.slideWidth * globobj.numberOfSlides); ///////////////////////////////////// // the slide controls ///////////////////////////////////// $('#search_rightControl').bind('click', function() { // //////console.log('right'); // Determine new position // //////console.log(); if(globobj.currentPosition != 0) { globobj.currentPosition++ ////////console.log('++'); } search_moveslides() }); $('#search_leftControl').bind('click', function() { ////////console.log('--'); ////////console.log(globobj.currentPosition); // Determine new position if(globobj.currentPosition != ((globobj.numberOfSlides * -1) + 1)) { globobj.currentPosition-- // Move slideInner using margin-left } search_moveslides() }); } ///// when you click an item inside a slide $(".tab_control_Slide_Item").click(function() { ////////console.log($(this)); ////////console.log($(this).attr('title')); tempVar = $(this).attr('title'); globobj.itemsinSearchCrit = 0; //// this items is int the Search Crit if($(this).parent().parent().attr('class') != 'tab_control_text_bubble_right') { /// count the number of slides tempvar = $(".tab_control_text_bubble_right_content").find(".tab_control_Slide_Item") //////console.log('turn to zero'); $.each(tempvar, function(key, value) { globobj.itemsinSearchCrit++ }) ////// if the number of slide is less than max if(globobj.itemsinSearchCrit <= globobj.maximumSearchCrit - 1) { /// make sure it is not greyed out already; if($(this).find('.tab_control_Slide_plus_icon').css('background-position') != '-86px -31px') { //////////////////// clone ////////////// tempVar1 = $(this).clone(true, true); tempVar1.find(".tab_control_Slide_plus_icon").attr('class', 'tab_control_Slide_minus_icon'); tempVar1.appendTo(".tab_control_text_bubble_right_content"); ///// change the color $(this).find('.tab_control_Slide_plus_text').css('color', '#9a9999'); $(this).find('.tab_control_Slide_plus_icon').css('background-position', '-86px -31px'); } } //// this item is not in the Search Crit it is in Standard Items list in a Category } else { tempVar = $(this).text().trim(); $(this).remove(); $('#tab_control_text_bubble_left_content').find(".tab_control_Slide_plus_icon:contains('" + tempVar + "')").css('background-position', '-2px -31px'); tempVar = $('#tab_control_text_bubble_left_content').find(".tab_control_Slide_plus_text:contains('" + tempVar + "')").css('color', '#14364B'); tempVar.parent().find(".tab_control_Slide_plus_icon").css('background-position', '-2px -31px'); } //// check to see if it is at the max if(globobj.itemsinSearchCrit == (globobj.maximumSearchCrit - 1)){ search_turn_allitems_off(); //globobj.itemsinSearchCrit--; } /// count the slides and disable buttons if first or last slide search_count_searchCrit_items(); /// convert all icons to correct plus or minus search_sortIcons(); /// write everything in search criteria to object write_searchCrit_toObject() }); //////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////// /////////////////// End Search-Slide Controls //////////////// //////////////////////////////////////////////////////////////// /////////////////////////////////////// //////////////////////// /////////////////////////////////////// /////////////////////////////////////// $("#tabstrip").kendoTabStrip({ select : adjustDivs, open : adjustDivs, animation : { open : { effects : "fadeIn" } } }); adjustDivs('t'); // fire the div adjustmest onece when the page loads }); /////////////////////////////////////////////////////////////////////////////// ////// change width of last div in the tab to correct browser issue /////////// /////////////////////////////////////////////////////////////////////////////// function adjustDivs() { /// set the size of individual tabs based on total number of tabs tempPercent = (100 / globobj_control_tabs.number_tabs); $('.k-item').css('width', tempPercent + '%'); /// set the size of the last tab so that it fills the entire field tempResizeforPadding = globobj_control_tabs.standard_correct; if(/MSIE (\d+\.\d+);/.test(navigator.userAgent)) { tempResizeforPadding = globobj_control_tabs.msie_correct; } if(/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)) { tempResizeforPadding = globobj_control_tabs.mozilla_correct; } /////////////////////////////////////// // resize the last tab so that it fills the entire tab bar // /////////////////////////////////////// var tempVar1 = $('.k-first').css('width'); var tempVar2 = tempVar1.substring(0, tempVar1.length - 2); var tempVar3 = tempVar2 * (globobj_control_tabs.number_tabs - 1); var tempVar4 = $('.k-content.k-state-active').css('width'); var tempVar5 = tempVar4.substring(0, tempVar4.length - 2); var tempVar6 = (tempVar5 - tempVar3) + tempResizeforPadding; var tempVar7 = tempVar6 + 'px'; $('.k-last').css("width", tempVar7); // adsjust the size of the tab control container adjustHeighttoContentDiv(); } function adjustSearchResultsWidth(event){ // alert($("link[rel=stylesheet]")); //globobj_bigslides.slideWidth = $('.search_results_slide_visiblearea').width(); //document.styleSheets.reload() } ////////////////////////////////////////////////////////////////////////// ///////////// used on all tab control pages adjust div height //////////// ////////////////////////////////////////////////////////////////////////// function adjustHeighttoContentDiv() { if(PAGENAME_Current == 'Search') { $('.tab_control_text_bubble_right_content').css('height', (window.innerHeight - 440) + 'px'); $('#tab_control_text_bubble_left_content').css('height', (window.innerHeight - 440) + 'px'); } if(PAGENAME_Current == 'search_results' || PAGENAME_Current == 'trending_this_week') { //////console.log(PAGENAME_Current); //////console.log(globobj_bigslides.currentPosition); $('.search_results_scroller').css('height', (window.innerHeight - 255) + 'px'); if(globobj_bigslides.currentPosition == 0){ $('.search_results_slide_visiblearea').css('height', (window.innerHeight - 155) + 'px'); $('.main_contentwrapper').css('height', (window.innerHeight - 175) + 'px'); }; if(globobj_bigslides.currentPosition == -1){ $('#tab_control_text_bubble_left_content').css('height', (window.innerHeight - 440) + 'px'); $('.document_container').css('height', (window.innerHeight - 185) + 'px'); $('.main_contentwrapper').css('height', (window.innerHeight - 180) + 'px'); $('.search_results_scroller').css('height', (window.innerHeight - 230) + 'px'); }; if(globobj_bigslides.currentPosition == -2){ $('.document_container').css('height', (window.innerHeight - 185) + 'px'); $('.main_contentwrapper').css('height', (window.innerHeight - 175) + 'px'); }; } $('.search_results_slide_visiblearea').css('height', (window.innerHeight - 179) + 'px'); //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// if(navigator && navigator.platform && navigator.platform.match(/^(iPad)$/)) { tabs_fix_stacking_error(); } } //////////////////////////////////////////////////////////////////////// //// get the id out of the slides and use them for the names of Slides / //////////////////////////////////////////////////////////////////////// //// create dots on bottom ///////////////////////////////////////////// globobj.SlideHeaders = new Array(); function init_SlideHeaders() { $(".search_slide").each(function(i) { globobj.SlideHeaders.push($(this).attr('title')); //// create the dots control control $('.tab_control_SlideDots_dots').append(''); $('.tab_control_SlideDots_SingleDot').click(function() { $('.tab_control_SlideDots_SingleDot').css('background-color', '#fff'); /// turn all dots controls off $(this).css('background-color', '#15354a'); globobj.currentPosition = (($(this).attr('title').toString()) * -1); search_moveslides(); }); }); write_searchCrit_toObject(); /// create the output object showing the search criteria search_dots_after_slide(); /// light up the correct dot } /////////// change the slide Header when slide moves ////////// function search_loadSlideHeader(tempCurPosition) { ////////console.log(tempCurPosition * -1); $(".tab_control_SlideDots_Header_text").html(globobj.SlideHeaders[(tempCurPosition * -1)]); }; function search_dots_after_slide(tempCurPosition) { $(".tab_control_SlideDots_SingleDot").each(function(i) { if($(this).attr('title') == (globobj.currentPosition * -1 )) { $('.tab_control_SlideDots_SingleDot').css('background-color', '#fff'); /// turn all dots controls off $(this).css('background-color', '#15354a'); }; }); }; /// save searchCrit in Object to Save State function write_searchCrit_toObject() { tempvar = $(".tab_control_text_bubble_right_content").find(".tab_control_Slide_Item") globobj.outputObj = []; $.each(tempvar, function(key, value) { globobj.tempObj = {}; globobj.tempObj.title = $(this).find(".tab_control_Slide_plus_text").text().trim(); globobj.tempObj.category = $(this).attr('title'); // globobj.tempObj.title = $(this).find(".tab_control_Slide_plus_text").text().trim(); //tempObj.ItemText = $(value[key]).find(".tab_control_Slide_plus_text").text().trim(); //tempObj.Category = $(value[key]).attr('title'); globobj.outputObj.push(globobj.tempObj) }); // globobj.outputObj.push(tempObj); /////////////////////////////////////////////////////////////////////////////// //////////////// This Stores the Output from the control //////////////////// /////////////////////////////////////////////////////////////////////////////// /////// !!!! //////console.log breaks Internet Explorer - turn off !!!! ///////////// /////// //////console.log( globobj.outputObj); /////////////////////////// /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// } /// max search crit reached function search_turn_allitems_off() { $("#tab_control_text_bubble_left_content").find('.tab_control_Slide_plus_text').css('color', '#9a9999'); $("#tab_control_text_bubble_left_content").find('.tab_control_Slide_plus_icon').css('background-position', '-86px -31px'); } function search_restore_after_max() { //////console.log('search_restore_after_max'); } /// changes icons to correct plus minus function search_sortIcons() { $(".tab_control_text_bubble_right_content").find(".tab_control_Slide_plus_icon").attr('class', 'tab_control_Slide_minus_icon'); $("#tab_control_text_bubble_left_content").find(".tab_control_Slide_minus_icon").attr('class', 'tab_control_Slide_plus_icon'); $(".tab_control_Slide_minus_icon").css('background-position',' -2px -60px'); //// turn everything on in the items list $("#tab_control_text_bubble_left_content").find('.tab_control_Slide_plus_text').css('color', '#14364B'); $("#tab_control_text_bubble_left_content").find('.tab_control_Slide_plus_icon').css('background-position', '-2px -31px'); //// then go through and find items in search criteria and turn off in items; $(".tab_control_text_bubble_right_content").find(".tab_control_Slide_minus_icon").each(function (i,value) { tempvarSeachCritTitle = $(this).parent().attr('title').trim(); tempvarSeachCritContent = $(this).parent().find('.tab_control_Slide_plus_text').text().trim() ; //////console.log('Search Crit:' + tempvarSeachCritTitle + " : " + tempvarSeachCritContent); $("#tab_control_text_bubble_left_content").find(".tab_control_Slide_plus_icon").each(function (i,value) { tempvarItemTitle = $(this).parent().attr('title').trim(); tempvarItemContent = $(this).parent().find('.tab_control_Slide_plus_text').text().trim() ; //////console.log('Reg Item:' + tempvarItemTitle + " : " + tempvarItemContent); /// if both content and category match then convert it if(tempvarSeachCritTitle == tempvarItemTitle && tempvarSeachCritContent == tempvarItemContent){ $(this).parent().find('.tab_control_Slide_plus_text').css('color', '#9a9999'); $(this).css('background-position', '-86px -31px'); } }); /// turn everything off if(globobj.itemsinSearchCrit >= (globobj.maximumSearchCrit - 1)){ $("#tab_control_text_bubble_left_content").find('.tab_control_Slide_plus_text').css('color', '#9a9999'); $("#tab_control_text_bubble_left_content").find('.tab_control_Slide_plus_icon').css('background-position', '-86px -31px'); }; }); } function search_count_searchCrit_items() { tempvar = $(".tab_control_text_bubble_right_content").find(".tab_control_Slide_Item") tempVarX1 = 0; $.each(tempvar, function(key, value) { tempVarX1++ }) if(tempVarX1 == 0) { $('#btn_RemoveAll').removeClass('btnTemplate_BtnLightGrey').addClass('btnTemplate_BtnDisabledGrey'); $('#btn_SearchNow').removeClass('btnTemplate_BtnDarkGrey').addClass('btnTemplate_BtnDisabledGrey'); } else { $('#btn_RemoveAll').removeClass('btnTemplate_BtnDisabledGrey').addClass('btnTemplate_BtnLightGrey'); $('#btn_SearchNow').removeClass('btnTemplate_BtnDisabledGrey').addClass('btnTemplate_BtnDarkGrey'); } } $('#navBtn_info').bind('click', function() { search_results_checkboxes() }); function search_moveslides() { $('#slideInner').animate({ 'marginLeft' : globobj.slideWidth * (globobj.currentPosition) }) //// change the header //////////////////// search_loadSlideHeader(globobj.currentPosition); //// change the dots on the bottom ////////// search_dots_after_slide(); /////////////////////////////////////////////// if(globobj.currentPosition == 0){ $('#search_rightControl').css('opacity','0.2'); } else { $('#search_rightControl').css('opacity','1'); }; if(globobj.currentPosition == (globobj.numberOfSlides - 1) * -1){ $('#search_leftControl').css('opacity','0.2'); } else { $('#search_leftControl').css('opacity','1'); }; } function tabs_fix_stacking_error() { //////////////////////////////////////////////////////////////////////////////////// ////////// This makes no sense at all but it corrects the stacking error in ipad!!!! //////////////////////////////////////////////////////////////////////////////////// globobj_control_tabs.currentCount++; if(globobj_control_tabs.currentCount == 2){ $(e.item).find("> .k-link").text(); }; }