$(document).ready(function() {
    $('#slideshow img, #homeslideshow img').hide().css({'position':'absolute'})
    $('#slideshow img, #homeslideshow img').first().show()
    $('#menu li').mouseenter(function() {
        $(this).children('ul').hide().fadeIn('fast')
    })
    $('#menu li').mouseleave(function() {
        $(this).children('ul').fadeOut('fast')
    })
    $('#slideshow img').css('cursor','pointer').click(function() {
        nextImage()
    })
    $('#homeslideshow img').css('cursor','pointer').click(function() {
        homenextImage()
    })
    $('a.moreinfo').click(function() {
        $(this).parent().parent().parent().children('.more').slideDown('slow')
        return false
    })
    $('.thumb img').css('cursor','pointer').click(function() {
        $(this).parent().parent().children('.more').slideDown('slow')
        return false
    })
    $('a.close').click(function() {
        $(this).parent().parent().parent().slideUp('slow')
        return false
    })
})
i = 1
function nextImage() {
    window.clearInterval(slide)
    slide = window.setInterval(nextImage,7500)
    $('#slideshow img').eq(i-1).fadeOut('slow')
    $('#slideshow img').eq(i).fadeIn('slow')
    i++
    if (i>$('#slideshow img').length-1)
    i = 0
}
slide = window.setInterval(nextImage,7500)
j = 1
function homenextImage() {
    window.clearInterval(homeslide)
    homeslide = window.setInterval(homenextImage,10000)
    $('#homeslideshow img').eq(j-1).fadeOut(500)
    $('#homeslideshow img').eq(j).fadeIn(1000)
    j++
    if (j>$('#homeslideshow img').length-1)
    j = 0
}
homeslide = window.setInterval(homenextImage,10000)
