function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 2000, function() {
            $active.removeClass('active last-active');
        });
}

document.onkeyup = KeyCheck;

function KeyCheck(e)
{
    var KeyID = (window.event) ? event.keyCode : e.keyCode;

    switch(KeyID)
    {
      case 37:
        if(document.getElementById("prev") != null)
        {
            document.location = $('#prev a').attr("href");
        }
      break;

      case 39:
        if(document.getElementById("next") != null)
        {
            document.location = $('#next a').attr("href");
        }
      break;
    }
}

$(document).ready(function() {

    try{
    document.execCommand("BackgroundImageCache", false, true);
    }
    catch(err){}

    setInterval( "slideSwitch()", 3000 );
});


var type = 0;

function menuShow(item, el)
{
    type=el;
    $('#sub'+item).css('visibility', 'visible');
    $('#menu_top'+item).css('color', '#ffffff');
    $('#menu_top'+item).css('padding', '5px 0 8px');
    $('#menu_top'+item).css('border-bottom', 'solid 1px #7b7b7b');
    $('#menu_top'+item).css('font-size', '1.6em');
}

function menuHide(item, el)
{
    if(el<type) return;
    $('#sub'+item).css('visibility', 'hidden');
    $('#menu_top'+item).css('color', '#7d7c7c');
    $('#menu_top'+item).css('padding', '6px 0 10px');
    $('#menu_top'+item).css('border', 'none');
    $('#menu_top'+item).css('font-size', '1.2em');
}