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

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

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    // uncomment the 3 lines below to pull the images in random order
    
    //var $sibs  = $active.siblings();
    //var rndNum = Math.floor(Math.random() * $sibs.length );
    //var $next  = $( $sibs[ rndNum ] );


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

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}
$(function() {
    setInterval( "slideSwitch()", 5000 );
});

//photos thumb effects
    $(document).ready(function() {
        $('.product_overllay').each(function() {
            $(this).hover(function() {
                $(this).stop().animate({ opacity: 1.0 }, 200);
            },
           function() {
               $(this).stop().animate({ opacity: 0.8 }, 200);
           });
        });
    });

function initMenus() {
	$('ul.product-menu ul').hide();
	$.each($('ul.product-menu'), function(){
		$('#' + this.id + '.expandfirst ul:first').show();
	});


	$('ul.product-menu li a').click(
		function() {
			var checkElement = $(this).next();
			var parent = this.parentNode.parentNode.id;

			if($('#' + parent).hasClass('noaccordion')) {
				$(this).next().slideToggle('normal');
				return false;
			}
			if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
				if($('#' + parent).hasClass('collapsible')) {
					$('#' + parent + ' ul:visible').slideUp('normal');
				}
				return false;
			}
			if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
				$('#' + parent + ' ul:visible').slideUp('normal');
				checkElement.slideDown('normal');
				return false;
			}
		}
	  
	);
}
$(document).ready(function() {initMenus();});
$(document).ready(function() {$('ul.item_42').show();});
$(document).ready(function() {$('ul ul.flag').show();});
$(document).ready(function() {$('ul.item_56').show();});
$(document).ready(function() {$('ul.item_68').show();});

$(document).ready(function(){
	$("a[rel='group1']").colorbox({transition:"fade", width:"75%", height:"90%"});
	$("a[rel='group2']").colorbox({transition:"fade", width:"75%", height:"90%"});
	$("a[rel='single']").colorbox({transition:"fade", width:"90%", height:"90%"});
});
$(document).ready(function() {
	$('#tabbs > ul').tabs({ fx: { opacity: 'toggle' } });
}); 

$(function () {
	var scroll_timer;
	var displayed = false;
	var $message = $('#foot-mes a');
	var $window = $(window);
	var top = $(document.body).children(0).position().top;
	$window.scroll(function () {
		window.clearTimeout(scroll_timer);
		scroll_timer = window.setTimeout(function () {
			if($window.scrollTop() <= top)
			{
				displayed = false;
				$message.fadeOut(500);
			}
			else if(displayed == false)
			{
				displayed = true;
				$message.stop(true, true).show().click(function () { $message.fadeOut(500); });
			}
		}, 100);
	});
});

