/*Last updated MM 1.31.12 JavaScript Document*/ var currentProduct =""; var currentReport = 0; var currentReportCategory = [0,"Maps and Reports"]; //get current location var urllocation = location.href; //find url parameter var getPage = ''; if(urllocation.indexOf("#") != -1){ getPage = urllocation.substring(urllocation.indexOf("#")); //alert(getPage); var categoryTitles = ["#menu", "#2011_2016_updated_demographics", "#2010_and_2015_demographics", "#2010_census_demographics", "#american_community_survey_reports", "#2010_consumer_spending", "#2010_market_potential", "#2010_tapestry_market_segmentation", "#business_data", "#maps_and_aerial_imagery", "#traffic_counts", "#crime_risk", "#1990_and_2000_census_demographics"]; var gotoPage = jQuery.inArray(getPage,categoryTitles) if( gotoPage > -1) { currentReportCategory[0] = gotoPage; //currentReportCategory[1] = categoryTitles[gotoPage]; } else{//you must REMOVE the first entries up until the first '#menu' and the last comma var pageTitles = /*[ "#menu", "#2011_2016_updated_demographics_panel", "#menu", "#age_50_plus_profile_panel", "#age_by_income_profile_panel", "#age_by_sex_by_race_profile_panel", "#age_by_sex_profile_panel", "#demographic_and_income_comparison_profile_panel", "#detailed_age_profile_panel", "#detailed_income_profile_panel", "#disposable_income_profile_panel", "#executive_summary_panel", "#graphic_profile_panel", "#housing_profile_panel", "#market_profile_panel", "#net_worth_profile_panel", "#quarterly_demographic_profile_panel", "#menu", "#2010_census_panel", "#menu", "#population_summary_panel", "#housing_summary_panel", "#menu", "#automotive_aftermarket_expenditures_panel", "#financial_expenditures_panel", "#house_and_home_expenditures_panel", "#household_budget_expenditures_panel", "#medical_expenditures_panel", "#recreation_expenditures_panel", "#retail_goods_and_services_expenditures_panel", "#menu", "#electronics_and_internet_market_potential_panel", "#financial_investments_market_potential_panel", "#health_and_beauty_market_potential_panel", "#pets_and_products_market_potential_panel", "#restaurant_market_potential_panel", "#retail_market_potential_panel", "#sports_and_leisure_market_potential_panel", "#menu", "#dominant_tapestry_site_map_panel", "#tapestry_segmentation_area_profile_panel", "#menu", "#business_locator_panel", "#business_summary_panel", "#major_shopping_center_locator_panel", "#major_shopping_center_map_panel", "#retail_market_place_profile_panel", "#menu", "#site_details_map_panel", "#site_map_panel", "#site_map_with_satellite_imagery_panel", "#menu", "#traffic_count_profile_panel", "#traffic_count_profile_map_panel", "#traffic_count_map_closeup_panel", "#menu", "#crime_risk_panel", "#menu", "#comparison_profile_1990_2000_panel", "#census_2000_detailed_race_profile_panel", "#census_2000_summary_profile_panel" ];*/ ["#menu", "#2012_2017_updated_demographics_panel", "#demographic_and_income_comparison_profile_panel", "#household_income_profile_panel", "#age_50_plus_profile_panel", "#age_by_sex_by_race_profile_panel", "#age_by_sex_profile_panel", "#detailed_age_profile_panel", "#disposable_income_profile_panel", "#executive_summary_panel", "#graphic_profile_panel", "#housing_profile_panel", "#market_profile_panel", "#net_worth_profile_panel", "#menu", "#2010_census_panel", "#menu", "#population_summary_panel", "#housing_summary_panel", "#menu", "#automotive_aftermarket_expenditures_panel", "#financial_expenditures_panel", "#house_and_home_expenditures_panel", "#household_budget_expenditures_panel", "#medical_expenditures_panel", "#recreation_expenditures_panel", "#retail_goods_and_services_expenditures_panel", "#menu", "#electronics_and_internet_market_potential_panel", "#financial_investments_market_potential_panel", "#health_and_beauty_market_potential_panel", "#pets_and_products_market_potential_panel", "#restaurant_market_potential_panel", "#retail_market_potential_panel", "#sports_and_leisure_market_potential_panel", "#menu", "#dominant_tapestry_site_map_panel", "#tapestry_segmentation_area_profile_panel", "#menu", "#business_locator_panel", "#business_summary_panel", "#major_shopping_center_locator_panel", "#major_shopping_center_map_panel", "#retail_market_place_profile_panel", "#menu", "#site_details_map_panel", "#site_map_panel", "#site_map_with_satellite_imagery_panel", "#menu", "#traffic_count_profile_panel", "#traffic_count_profile_map_panel", "#traffic_count_map_closeup_panel", "#menu", "#crime_risk_panel", "#menu", "#comparison_profile_1990_2000_panel", "#census_2000_detailed_race_profile_panel", "#census_2000_summary_profile_panel"] //you must REMOVE the first entries up until the first '#menu' and the last comma var panelInfo = [ ["#menu", 0,1], ["#2012_2017_updated_demographics_panel", 1,1], ["#demographic_and_income_comparison_profile_panel", 2,1], ["#household_income_profile_panel", 3,1], ["#age_50_plus_profile_panel", 4,1], ["#age_by_sex_by_race_profile_panel", 5,1], ["#age_by_sex_profile_panel", 6,1], ["#detailed_age_profile_panel", 7,1], ["#disposable_income_profile_panel", 8,1], ["#executive_summary_panel", 9,1], ["#graphic_profile_panel", 10,1], ["#housing_profile_panel", 11,1], ["#market_profile_panel", 12,1], ["#net_worth_profile_panel", 13,1], ["#menu", 0,2], ["#2010_census_panel", 1,2], ["#menu", 0,3], ["#population_summary_panel", 1,3], ["#housing_summary_panel", 2,3], ["#menu", 0,4], ["#automotive_aftermarket_expenditures_panel", 1,4], ["#financial_expenditures_panel", 2,4], ["#house_and_home_expenditures_panel", 3,4], ["#household_budget_expenditures_panel", 4,4], ["#medical_expenditures_panel", 5,4], ["#recreation_expenditures_panel", 6,4], ["#retail_goods_and_services_expenditures_panel", 7,4], ["#menu", 0,5], ["#electronics_and_internet_market_potential_panel", 1,5], ["#financial_investments_market_potential_panel", 2,5], ["#health_and_beauty_market_potential_panel", 3,5], ["#pets_and_products_market_potential_panel", 4,5], ["#restaurant_market_potential_panel", 5,5], ["#retail_market_potential_panel", 6,5], ["#sports_and_leisure_market_potential_panel", 7,5], ["#menu", 0,6], ["#dominant_tapestry_site_map_panel", 1,6], ["#tapestry_segmentation_area_profile_panel", 2,6], ["#menu", 0,7], ["#business_locator_panel", 1,7], ["#business_summary_panel", 2,7], ["#major_shopping_center_locator_panel", 3,7], ["#major_shopping_center_map_panel", 4,7], ["#retail_market_place_profile_panel", 5,7], ["#menu", 0,8], ["#site_details_map_panel", 1,8], ["#site_map_panel", 2,8], ["#site_map_with_satellite_imagery_panel", 3,8], ["#menu", 0,9], ["#traffic_count_profile_panel", 1,9], ["#traffic_count_profile_map_panel", 2,9], ["#traffic_count_map_closeup_panel", 3,9], ["#menu", 0,10], ["#crime_risk_panel", 1,10], ["#menu", 0,11], ["#comparison_profile_1990_2000_panel", 1,11], ["#census_2000_detailed_race_profile_panel", 2,11], ["#census_2000_summary_profile_panel", 3,11]]; /*[//you must REMOVE the first entries up until the first '#menu' and the last comma ["#menu", 0,1],["#2011_2016_updated_demographics_panel", 1,1], ["#menu", 0,2], ["#age_50_plus_profile_panel", 1,2], ["#age_by_income_profile_panel", 2,2], ["#age_by_sex_by_race_profile_panel", 3,2], ["#age_by_sex_profile_panel", 4,2], ["#demographic_and_income_comparison_profile_panel", 5,2], ["#detailed_age_profile_panel", 6,2], ["#detailed_income_profile_panel", 7,2], ["#disposable_income_profile_panel", 8,2], ["#executive_summary_panel", 9,2], ["#graphic_profile_panel", 10,2], ["#housing_profile_panel", 11,2], ["#market_profile_panel", 12,2], ["#net_worth_profile_panel", 13,2], ["#quarterly_demographic_profile_panel", 14,2], ["#menu", 0,3], ["#2010_census_panel", 1,3], ["#menu", 0,4], ["#population_summary_panel", 1,4], ["#housing_summary_panel", 2,4], ["#menu", 0,5], ["#automotive_aftermarket_expenditures_panel", 1,5], ["#financial_expenditures_panel", 2,5], ["#house_and_home_expenditures_panel", 3,5], ["#household_budget_expenditures_panel", 4,5], ["#medical_expenditures_panel", 5,5], ["#recreation_expenditures_panel", 6,5], ["#retail_goods_and_services_expenditures_panel", 7,5], ["#menu", 0,6], ["#electronics_and_internet_market_potential_panel", 1,6], ["#financial_investments_market_potential_panel", 2,6], ["#health_and_beauty_market_potential_panel", 3,6], ["#pets_and_products_market_potential_panel", 4,6], ["#restaurant_market_potential_panel", 5,6], ["#retail_market_potential_panel", 6,6], ["#sports_and_leisure_market_potential_panel", 7,6], ["#menu", 0,7], ["#dominant_tapestry_site_map_panel", 1,7], ["#tapestry_segmentation_area_profile_panel", 2,7], ["#menu", 0,8], ["#business_locator_panel", 1,8], ["#business_summary_panel", 2,8], ["#major_shopping_center_locator_panel", 3,8], ["#major_shopping_center_map_panel", 4,8], ["#retail_market_place_profile_panel", 5,8], ["#menu", 0,9], ["#site_details_map_panel", 1,9], ["#site_map_panel", 2,9], ["#site_map_with_satellite_imagery_panel", 3,9], ["#menu", 0,10], ["#traffic_count_profile_panel", 1,10], ["#traffic_count_profile_map_panel", 2,10], ["#traffic_count_map_closeup_panel", 3,10], ["#menu", 0,11], ["#crime_risk_panel", 1,11], ["#menu", 0,12], ["#comparison_profile_1990_2000_panel", 1,12], ["#census_2000_detailed_race_profile_panel", 2,12], ["#census_2000_summary_profile_panel", 3,12] ];*/ if(jQuery.inArray(getPage,pageTitles) > -1) { //alert("found at: " +jQuery.inArray(getPage,pageTitles)); var panel = jQuery.inArray(getPage,pageTitles); //alert(panelInfo[panel][2] + " > " + panelInfo[panel][1]); currentReportCategory[0] = panelInfo[panel][2]; currentReport = panelInfo[panel][1] - 1; } } } //jquery interactions function getPageData(){ var pageTitles = " ",panelInfo = " "; $('.subNav a').each(function(){ //first array: pageTitles pageTitles += " \""+$(this).attr("href")+"\","; //second array: panelInfo panelInfo += " [\""+$(this).attr("href")+"\", "+ $(this).index()+","+ $(this).parent().index()+"],"; }); console.log(pageTitles); console.log(panelInfo); } $(document).ready(function(){ //This code creates the refresh / link tables. simply uncomment and then copy paste the output on the page. //remember to remove the home page links if you are looking for single report information //document.write(links); //alert(links); //initial category setup setCategory(currentReportCategory[0]); //initial report setup if(getPage === '' || getPage == '#menu'){$('.productPanel.home').show();} else if(getPage !== ''){setReport(currentReport);} //press the back button $(".subNav a.instructions").click(function(){ setCategory(0); $('.productPanel').hide(); $('.productPanel.home').fadeIn("fast"); //setReport(0); $('#mc_title .reportInfo').html( "BAO Reports and Maps" ); }); //choose a category from main nav $("#reportTypes.subNav a").click(function(){ $(".subNav a.current").removeClass("current"); currentReportCategory[1] = $(this).html(); setCategory($(this).index()); setReport(0); }); //select a single report $(".subTypes a").not(".instructions").click(function(){ var pan = $(this); var p = pan.index(); setReport(p-1); }); }); //pulls up a submenu and shows the first report function setCategory(category){ //console.log(category); currentReportCategory[0] = category; $(".subNav").hide(); $(".subNav").eq(category).fadeIn("fast"); //don't set categorydo for home page if(category !== 0){ $(".subNav").eq(category).children("a").eq(1).addClass("current"); currentProduct = $(".subNav").eq(category).children("a").eq(1).html(); currentReportCategory[1] = $('#reportTypes a').eq(category-1).html(); } updateTitle(); } function setReport(report){ var setlink = $('.subNav').eq(currentReportCategory[0]).children('a').eq(report+1); setlink.siblings().removeClass("current"); setlink.addClass("current"); currentProduct = setlink.html(); updateTitle(); $('.productPanel').fadeOut("fast"); $('.reportCategory').eq(currentReportCategory[0]).children('.productPanel').eq(report).fadeIn("fast"); } function updateTitle(){ $('#mc_title .reportInfo').html( currentReportCategory[1] +" > " +currentProduct+""); } String.prototype.toProperCase = function () { return this.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}); };