$(document).ready(function(){
	
	$('#menu ul li').hover(function(){
		$(this).addClass('hover');
	},function(){
		$(this).removeClass('hover');
	});
	
	var options = {
		resizeLgImages:     true,
		handleUnsupported:  'remove',
		keysClose:          ['c', 27], // c or esc
		autoplayMovies:     false
	};

	Shadowbox.init(options);
	
	var flashvars = { xmlurl: '/_inc/flash/flash.php' };
	swfobject.embedSWF('/_inc/flash/Main.swf', 'flashbanner', '928', '399', '9.0.0', '/_inc/flash/expressInstall.swf', flashvars, {menu:false,wmode:'opaque'});
					
	var prodimg = $('#prodimg');
	var prodimgs = $(prodimg).children('.prodimg');
	var prodgal = $('#prodgalthumbs');
	var prodimgheight = 0;
	
	$(prodimgs).hide();
	
	$(prodgal).children('a').click(function(){
		var clicked = $(this).attr('rel');
		$(prodgal).children('a').removeClass('active');
		$(this).addClass('active');
		$(prodimgs).fadeOut(100).filter('#'+clicked).fadeIn(100);					
		return false;
	});;
	
	$(prodimgs).filter(':first').show(0);
	$(prodgal).children('a:first').addClass('active');
	
	if( $(prodgal).children('a').length <= 1 ) {
		$(prodgal).hide();
	}
	
	$(prodimgs).each(function(){
		if($(this).height()>prodimgheight) {
			prodimgheight = $(this).height();
			if(prodimgheight>50) {
				$('#prodimg').height(prodimgheight+4);
			}
		}
	});

});
					
$(window).load(function(){

	var prodimg = $('#prodimg');
	var prodimgs = $(prodimg).children('.prodimg');
	var prodgal = $('#prodgalthumbs');
	var prodimgheight = 0;
	
	$(prodimgs).each(function(){
		if($(this).height()>prodimgheight) {
			prodimgheight = $(this).height();
			if(prodimgheight>50) {
				$('#prodimg').height(prodimgheight+4);
			}
		}
	});
	
});