Cufon.replace('h1, h3', { fontFamily: 'DIN-Regular', hover: true  });
Cufon.replace('h4, div.sponsor-word h2', { fontFamily: 'DIN-Bold', hover: true  });

Cufon.DOM.ready(function() {

  // SECTOR NAME
  if(document.getElementById('main-content') != null){
      Cufon.replace(document.getElementById('main-content').getElementsByTagName('h1'), { fontFamily: 'DIN-Regular' });
      Cufon.replace(document.getElementById('main-content').getElementsByTagName('h3'), { fontFamily: 'DIN-Regular' });
  }

  // SECTOR NAME
  if(document.getElementById('main-content') != null){
      Cufon.replace(document.getElementById('main-content').getElementsByTagName('h4'), { fontFamily: 'DIN-Bold' });
  }

  // TOP 10 SUB NAV
  if(document.getElementById('sector-nav') != null){
      Cufon.replace(document.getElementById('sector-nav').getElementsByTagName('span'), { fontFamily: 'DIN-Bold' });
      Cufon.replace(document.getElementById('sector-nav').getElementsByTagName('a'), { fontFamily: 'DIN-Bold' });
  }

  // SECTOR NAME
  if(document.getElementById('home') != null){
      Cufon.replace(document.getElementById('main-content').getElementsByTagName('h2'), { fontFamily: 'DIN-Bold' });
  }

  // SECTOR NAME
  if(document.getElementById('title1') != null){
    Cufon.replace(document.getElementById('title1'), { fontFamily: 'DIN-Bold' });
  }

  // KEY
  if(document.getElementById('sector-key') != null){
    Cufon.replace(document.getElementById('sector-key').getElementsByTagName('li'), { fontFamily: 'DIN-Bold' });
  }

});

// eo:CUFON

// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
$(document).ready(function() {

  if ($('#survey_offices_outside_region_false').attr("checked")) {
    $('#other-offices').hide();
  }
  $('#survey_offices_outside_region_false').click(
    function() {
      if ($(this).attr("checked")) {
        $('#other-offices').hide( );
      }
    }
  );
  $('#survey_offices_outside_region_true').click(
    function() {
      if ($(this).attr("checked")) {
        $('#other-offices').show( );
      }
    }
  );

  if ($('#survey_parent_company_false').attr("checked")) {
    $('#parent-fields').hide();
  }
  $('#survey_parent_company_false').click(
    function() {
      if ($(this).attr("checked")) {
        $('#parent-fields').hide( );
      }
    }
  );
  $('#survey_parent_company_true').click(
    function() {
      if ($(this).attr("checked")) {
        $('#parent-fields').show( );
      }
    }
  );

  //  Click table row and go somewhere quite magical
  //  Added logic so that top5/top10 watch pages don't click
  //  Will need to update when body has correct ID
  var link;
  var bodyid;
  var tableid;

  $("body#top_100 tbody tr, body#top_10 tbody tr, body#show tbody tr").click(function(){
    link = $(this).find('td a').attr("href");
    window.location.href = link;
  });

  // if ($('input#survey_respected_company_name').length > 0) {
  //   $('input#survey_respected_company_name').autocomplete({ajax: "/respected_companies.json"}).attr('autocomplete','off');
  //   $('input#survey_respected_individual_name').autocomplete({ajax: "/respected_individuals.json"}).attr('autocomplete','off');
  // }

});

