﻿$(function(){ 

  // Suckerfish menu
  sfHover = function() {
  var sfEls = document.getElementById("mainnav").getElementsByTagName("LI");
  for (var i=0; i<sfEls.length; i++) {
    sfEls[i].onmouseover=function() {
      this.className+=" sfhover";
    }
    sfEls[i].onmouseout=function() {
      this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
    }
  }
  }
  if (window.attachEvent) window.attachEvent("onload", sfHover);




  // searchform hint
        // find all the input elements with title attributes
  $('input[title!=""]').hint();
  
  
    
  //slides for homepage richmedia header
  // Set starting slide to 1
      var startSlide = 1;
      // Get slide number if it exists
      if (window.location.hash) {
        startSlide = window.location.hash.replace('#','');
      }
      // Initialize Slides
      $('#slides').slides({
        preload: false,
        effect: 'fade',
        crossfade: true,
        //preloadImage: 'fileadmin/sys/template/img/loading.gif',
        generatePagination: true,
        play: 8000,
        pause: 1500,
        hoverPause: true,
        // Get the starting slide
        start: startSlide,
        animationComplete: function(current){
          // Set the slide number as a hash
          window.location.hash = '#' + current;
          
        
        }
      });


  // get count of slides and set margin of pagination
  var countofslides = $('.slide').size();

        if (countofslides == 2) {
    $('.pagination').css("width",65);
  }
  if (countofslides == 3) {
    $('.pagination').css("width",85);
  }
  if (countofslides == 4) {
    $('.pagination').css("width",105);
  }
  if (countofslides == 5) {
    $('.pagination').css("width",140);
  }
  if (countofslides == 6) {
    $('.pagination').css("width",160);
  }

  

});
