    Cufon.replace('h2.frontTop, h3.frontNews, h1, h2', { fontFamily: 'HelvThinExp' });
    Cufon.replace('h1.frontBottom', { fontFamily: 'HelvUltraLight' });
    
$(document).ready(function(){
$(".varjo").dropShadow({left: -1, top: -1, blur: 1, opacity: 0.25});


  $('a#searchIcon').click(function(e){
    e.preventDefault();
    
    if($('form#searchBox').is(':visible')){
      $('form#searchBox').fadeOut(100);
    } else {
      $('form#searchBox').fadeIn(100);
    }
  });
  
  // checkbox handling
  $('form.defaultForm a.checkbox').click(function(e){
    e.preventDefault();
    
    var divId = $(this).attr("rel");
        
    if($('form.defaultForm  #'+divId).attr('checked')) {
      $(this).removeClass('selected');
      $('form.defaultForm #'+divId).attr('checked','');
    } else {
      $(this).addClass('selected');
      $('form.defaultForm #'+divId).attr('checked','checked');
    }
  });
  
  // radio button handling - custom
  $('form.defaultForm a.radio2').click(function(e){
    e.preventDefault();
    
    var divId = $(this).attr("rel");
    
    // if(!$('form.defaultForm  #'+divId).attr('checked')) {
      $('#specialButtons a.radio2').removeClass('selected');
      $(this).addClass('selected');
      $(this).parent().parent().parent().children('select').val($(this).attr('rel'));
      // $('form.defaultForm #'+divId).attr('checked','checked');
    // }
  });
  

  
  // radio button handling - survey

  $('.block a.radio2').click(function(e){
    e.preventDefault();
     var divId = $(this).attr("rel"); 
     var sectionId = $(this).parent().parent().parent().attr("class"); 
    
  //  alert('.block .'+sectionId+' a.radio2');
    // if(!$('form.defaultForm  #'+divId).attr('checked')) {
      $('.block .'+sectionId+' a.radio2').removeClass('selected');
      $('.block .'+sectionId+' input.survey_input').removeClass('checked');
      $(this).addClass('selected');

      $('.'+sectionId+' #'+divId).attr('checked','checked');
      

  });
  
  // radio button handling
  $('form.defaultForm a.radio').click(function(e){
    e.preventDefault();
    
    var divId = $(this).attr("rel");
    
    // if(!$('form.defaultForm  #'+divId).attr('checked')) {
      $(this).parent().children('a').removeClass('selected');
      $(this).addClass('selected');
      $(this).parent().children('select').val($(this).attr('rel'));
      // $('form.defaultForm #'+divId).attr('checked','checked');
    // }
  });
  
  // selectbox handling
  $('form.defaultForm a.fieldSelector').click(function(e){
    e.preventDefault();
    
    var divId = $(this).attr("rel");
    
    if($('form.defaultForm #'+divId).is(':visible')){
      $('form.defaultForm #'+divId).fadeOut(100);
    } else {
      $('form.defaultForm div.selectBox').fadeOut(100);
      $('form.defaultForm #'+divId).fadeIn(100);
    }
  });
  
  $('form.defaultForm div.selectBox a').click(function(e){
    e.preventDefault();
    
    var newTime = 'toivomasi mittarinlukuaika on <b>'+$(this).html()+'</b> (+/- puoli tuntia)';
    
    $(this).parent().parent().children('select').val($(this).attr('rel'));
    $(this).parent().parent().children('a.fieldSelector').html(newTime);
    $(this).parent().fadeOut(100);
  });

// We need to make some overridings for survey
    $('form.defaultForm .survey-choices div.selectBox a').click(function(e){
    e.preventDefault();
    
    var newTime = '<b>'+$(this).html()+'</b>';
    
    $(this).parent().parent().children('select').val($(this).attr('rel'));
    $(this).parent().parent().children('a.fieldSelector').html(newTime);
    $(this).parent().fadeOut(100);
  });
  
});
