submenutop = new Image();
submenutop.src = '/wp-content/themes/stapleton/images/sub-menu-top-bg.png';

submenubottom = new Image();
submenubottom.src = '/wp-content/themes/stapleton/images/sub-menu-bottom-bg.png';

var iteration = 1;

function changeSlideshowImage(total) {
    var visible = '#' + $('.slide:visible').attr('id');
    if (iteration == total) iteration = 1;
    else iteration++;
    $('.slide:visible').fadeOut(2000);
    $('#slide' + iteration).fadeIn(2000);
}

$(document).ready(function() {
    var total = $('.slide').length;
    if (total > 1) {
        startSlideshow = setInterval("changeSlideshowImage("+total+")", 5000);
        $('#slideshow').hover(function () {
            clearInterval(startSlideshow);
        }, function() {
            startSlideshow = setInterval("changeSlideshowImage("+total+")", 5000);
        });
    }
    $('.leftSideThumbnail a').click(function() {
		$('.detailBox:visible').hide();
		var product = $(this).attr('href');
		$(product).show();
		return false;
	});
    $('#commentForm').validate({
        highlight: function(element,errorClass) {
            $(element).css('border','1px solid #F33');
        },
        unhighlight: function(element,errorClass) {
            $(element).css('border','1px solid #FFF');
        }
    });
});
