// JavaScript Document
jQuery.fn.hoverImages = function() {
  this.hover(function() {
    $(this).find('img').each(function() {
      this.src = this.src.replace('Off', 'On');
    });
    $(this).addClass('hover');
  }, function() {
    $(this).find('img').each(function() {
      this.src = this.src.replace('On', 'Off');
    });
    $(this).removeClass('hover');
  });
}
 
$(document).ready(function() {
  $('#navi a').not('.hover').hoverImages();
  $('.subNaviItems a').not('.selected').hoverImages();
  $('.banners a').not('.doNotHover').hoverImages();
  $('#yritysnavi a').not('.hover').hoverImages();
  
  $('.faqAnswer').hide();
  
  $('.faqHeader').click(function() {
    $('.faqHeader').not(this).find('img').attr('src', 'http://www.palpa.fi/files/palpa/img/faqPlus.gif');
    $('.faqAnswer').not('#'+this.id.replace('q', 'a')).hide();
    
    $('#'+this.id.replace('q', 'a')).toggle();
    if($(this).find('img').attr('src').indexOf('Plus') != -1) {
      $(this).find('img').attr('src', 'http://www.palpa.fi/files/palpa/img/faqMinus.gif');
    }
    else {
      $(this).find('img').attr('src', 'http://www.palpa.fi/files/palpa/img/faqPlus.gif');
    }
  });
});
 
function avaa_popup(url) {
  uusi_ikkuna = window.open(url, "Palpa",  "width=400,height=285");
  uusi_ikkuna.focus();
}
