$('document').ready(function(){

    //navi hover effects
    $('img.hoverImg').hover(function(){
        var newSrc = $(this).attr('src').replace('normal','mo');
        $(this).attr('src', newSrc);
    },
    function(){
        var newSrc = $(this).attr('src').replace('mo','normal');
        $(this).attr('src', newSrc);
    });


   //animate and align topNav to the right place on load
   jQuery('#topNav').css({height: '0'}).animate({height: '34px'}, 'slow');
   fixedBarsPosition(jQuery('#topNav div'));


   //random image for slideshow
   var count = jQuery('#slideshow').children('img').length;
   var randomnumber=Math.floor(Math.random()*count)
   jQuery('#slideshow').children('img').eq(randomnumber).addClass('active');

   //tableDesign
   applyTableDesign();

 });






 //align topNav to the right place when the window is resized
 jQuery(window).resize(function(){

    fixedBarsPosition(jQuery('#topNav div'));
 });



 function fixedBarsPosition(element){
    var windowWidth = jQuery(window).width();
    var left = (windowWidth - 982) / 2;
    element.css('left', left);
 }

 function applyTableDesign(){
     jQuery('table tr:odd').css({background: '#eee'});
 }
