// *************************** jQuery Initialisation **************************** //

$(document).ready(function() {

	// mouse over images
	$('.productZoom').imghover();

	$("#brochure .tab").hover( function () {
		$(this).addClass("hover");
	}, function () {
		$(this).removeClass("hover");
	} );

	// Select all links with class thickbox
	$('.lightbox').lightBox({fixedNavigation:true}); 
	//$('a[rel^=lightbox]').lightBox();


	$('#printedBrochure').click(function(){
		$('#downloadBrochures').hide();
		$('#printedBrochures').show();
		$('#downloadBrochure').removeClass('active');
		$(this).addClass('active');
	});
	$('#downloadBrochure').click(function(){
		$('#printedBrochures').hide();
		$('#downloadBrochures').show();
		$('#printedBrochure').removeClass('active');
		$(this).addClass('active');
	});
	
	$('.viewDetails').imghover();
		
	//$('#sizes .section:not(:first)').hide();
	$('#productSizeNav a').not('#productSizeNav a.group').click(function() {
		$('#productSizeNav a.current').removeClass('current');
		$(this).addClass('current');
		var sectionId = $(this).attr('href');
		sectionId = sectionId.replace('#','')
		$('#sizes .section:visible').hide('slow');
		$('#sizes .section#' + sectionId).show('slow');
		return false;
	});


















	/* product search & spare parts search */
	$('#searchValue').defaultRestore();
	$("#searchValue").focus(function(){
		$("#searchOptions").slideToggle();
	});
	$("#searchValue").blur(function(){
		$("#searchOptions").slideToggle();
	});
	$("#searchForm").submit(function(){
		var sV = $("#searchValue");
		if( sV.val() == sV.data("default") ){
			alert('Please enter a search term');
			return false;
		}
		if( $('#searchSpares').is(':checked') ){
			$("#searchForm").attr({action: relPath + "spareParts/index.asp", method: 'POST'});
			$("#searchValue").attr('name', 'keyword');
		} else {
			$("#searchForm").attr({action: relPath + "aqualux/search.asp", method: 'GET'});
			$("#searchValue").attr('name', 'searchValue');
		}
	});




});

