function submitDoc(formName) {
	$('form[name="'+formName+'"]').submit();
}
function jumpMenu(target, object, restore) {
	eval(target+".location='"+object.options[object.selectedIndex].value+"'");
	if (restore) object.selectedIndex=0;
}

$(function() {
	$("#graphic-showcase-panel, #graphic-showcase-panel-short").after('<span id="graphic-showcase-prev" class="showcase-prev">&lt;</span><span id="graphic-showcase-next" class="showcase-next">&gt;</span><div id="graphic-showcase-pagination" class="showcase-pagination"><ul>').cycle({
		speed				: 'fast', 
		slideExpr			: 'div.showcase-item',
		timeout				: 5000, 
		next				: '#graphic-showcase-next',
		prev				: '#graphic-showcase-prev',
		pager				: '#graphic-showcase-pagination ul', 
		pagerAnchorBuilder	: function(idx, slide) { 
			return '<li><span class="showcase-pag-page">'+idx+'</span></li>'; 
		}
	});
	$("#grid-showcase-panel").after('<span id="grid-showcase-prev" class="showcase-prev">&lt;</span><span id="grid-showcase-next" class="showcase-next">&gt;</span><div id="grid-showcase-pagination" class="showcase-pagination"><ul>').cycle({
		speed				: 'fast', 
		slideExpr			: 'div.showcase-item',
		timeout				: 7500, 
		next				: '#grid-showcase-next',
		prev				: '#grid-showcase-prev',
		pager				: '#grid-showcase-pagination ul', 
		pagerAnchorBuilder	: function(idx, slide) { 
			return '<li><span class="showcase-pag-page">'+idx+'</span></li>'; 
		}
	});
	/*
	$("#colour-opts label").click(function(e) {
		e.preventDefault();
		$("#colour-opts .select-link").removeClass("highlight").text("Select");
		$("input[name=helmetColour]:radio").removeAttr("checked");
		var targetInput = $(this).attr("for");
		$("#"+targetInput).attr("checked", "checked");
		$(this).find(".select-link").addClass("highlight").text("Selected");
	});
	*/
	$("#prod-image > a").fancybox({
		titleShow	: false,
		padding 	: 4,
		margin		: 10,
		autoScale	: false
	});
	$("#gallery-thumbs > li > a").fancybox({
		titleShow		: false,
		padding			: 4,
		margin			: 10,
		autoScale 		: false,
		overlayOpacity	: 0.9,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic'

	});
	$(".prod-image-changer > li > a:not(.follow-link)").click(function(e) {
		e.preventDefault();
		var newTarget = $(this).attr("href").replace("large", "lightbox");
		var newImage = $(this).attr("href");
		$("#prod-image > a").attr("href", newTarget).find("img").attr("src", newImage);
	});
	
	$("#product-carousel > ul").jcarousel({
		buttonNextHTML	: '<span id="product-carousel-next" class="showcase-next">&gt;</span>',
		buttonPrevHTML	: '<span id="product-carousel-prev" class="showcase-prev">&lt;</span>',
		scroll			: 1,
		auto			: 5,
		wrap			: "circular"
	});
	$("#fb-btn, #twitt-btn").attr("target", "_blank");
	
	$("a:not(.slideshow, #prod-image > a, .no-fade) > img").hover(function(e) {
		$(this).stop().animate({"opacity": "0.7"}, "fast");
	},function(e) {
		$(this).stop().animate({"opacity": "1"}, "fast");
	});
	$("a.slideshow").hover(function(e) {
		$(this).find("img:first").fadeOut("fast");
	}, function(e) {
		$(this).find("img:first").fadeIn("fast");
	});
});
