$(document).ready(function() { var screenSize = $('body').width(); $('.panel .cap').click(function(){ var content = $(this).parent().find('.content'); var tabs = $(this).parent().find('.tabs'); var accordionWrapper = $(this).parent().find('.accordion-wrapper'); var isOpen = content.is(":visible"); if (!isOpen) { var isOpen = tabs.is(":visible"); } if (!isOpen) { var isOpen = accordionWrapper.is(":visible"); } if (isOpen){ if (screenSize <= 1024){ content.hide(); tabs.hide(); accordionWrapper.hide(); } else { content.slideUp(); tabs.slideUp(); accordionWrapper.slideUp(); } } else { if (screenSize <= 1024){ content.show(); tabs.show(); accordionWrapper.show(); } else { content.slideDown(); tabs.slideDown(); accordionWrapper.slideDown(); } } }); $('.alert-text .close').live('click',function(){ $(this).parents('.alert-wrapper').slideUp(300); return false; }); try { $(".pagesize").chosen(); } catch(e){} //When page loads... $(".tab_content").hide(); //Hide all content //Determine if first tab or passed tab should be active when page loads if (location.hash == "") { $("ul.tabs li:first").addClass("active").show(); //Activate first tab $(".tab_content:first").show(); //Show first tab content } else { var activeTab = location.hash; //Grab hash to determine which tab to make active $('ul.tabs li a[href|="'+activeTab+'"]').parent().addClass("active"); $(activeTab).show(); //Show tab content } //On Click Event $("ul.tabs li a").click(function() { $("ul.tabs li").removeClass("active"); //Remove any "active" class $(this).parent().addClass("active"); //Add "active" class to selected tab $(".tab_content").hide(); //Hide all tab content var activeTab = $(this).attr("href"); //Find the href attribute value to identify the active tab + content $(activeTab).fadeIn(); //Fade in the active ID content return false; }); // little extra magic $("a.next_link").click(function() { $("ul.tabs li").removeClass("active"); //Remove any "active" class var activeTab = $(this).attr("href"); $('ul.tabs li a[href|="'+activeTab+'"]').parent().addClass("active"); $(".tab_content").hide(); //Hide all tab content //Find the href attribute value to identify the active tab + content $(activeTab).fadeIn(); //Fade in the active ID content return false; }); // On load, show the first panel in each accordion. $('.accordion').each(function(){ $(this).find('.accordion-block').eq(0).addClass('open'); $(this).find('.accordion-block').eq(0).find('.accordion-content').show(); }); $('.accordion-block h3').click(function(){ if($(this).parent().hasClass('open')){ $('.accordion-block .accordion-content').slideUp('fast',function(){ $('.accordion-block').removeClass('open'); }); } else { $('.accordion-block .accordion-content').slideUp('fast'); $(this).parent().find('.accordion-content').slideDown('fast'); $('.accordion-block').removeClass('open'); $(this).parent().addClass('open'); } }); // Add Fancybox lightboxing to each of the images. try { $('.fancybox').fancybox(); } catch(e) {} // On window resize, adjust the sizing. $(window).resize(function(){ setTimeout("resizeChosenWidths()",50); setTimeout("generateGraphs()", 50); }); // Custom file field $('form.styled input[type=file]').each(function(){ $(this).before(''); }); $('form.styled input[type=file]').animate({'opacity':0},0); $('form.styled input[type=file]').hover(function(){ $(this).parent().find('.browse').addClass('hover'); },function(){ $(this).parent().find('.browse').removeClass('hover'); }); $('form.styled input[type=file]').change(function(){ $(this).parent().find('.file-field').val($(this).val().replace('C:\\fakepath\\','')); }); // "Chosen" field // http://harvesthq.github.com/chosen/ try { $('form.styled').find('.chosen').chosen(); } catch(err){} $('.mobile-navigation').change(function(){ var url = $(this).val(); location.href = url; return false; }); $('a.fancybox').click(function(){ if ( !$(this).hasClass('fancybox') ){ var href = $(this).attr('href'); if (href) { var firstChar = href.substring(0,1); } if (href && href != '#' && firstChar != '#') { location.href = href; return false; } else { return false; } } }); setTimeout("resizeChosenWidths()",50); setTimeout("generateGraphs()", 50); }); function log(str){ if( (window['console'] !== undefined) ){ console.log(str); } } /* CHARTS */ /* -------------------------------------------------------------------- */ function generateGraphs(){ $("table.statics").each(function() { var widthOfParent = $(this).parent().width(); $(this).hide(); $(this).parent().find('.flot-graph').remove(); var colors = []; $(this).find("thead th:not(:first)").each(function() { colors.push($(this).css("color")); }); $(this).graphTable({ series: 'columns', position: 'before', width: widthOfParent, /* width: '1000px', */ height: '200px', colors: colors }, { xaxis: {mode: "time", timeformat: "%d", tickSize: [1, "day"], minTickSize: [1, "day"], position: "bottom", color: "#545454" } }); }); $('.flot-graph').before('
'); function showTooltip(x, y, contents) { $('