$(document).ready(function(){ 
	$("#buttonParts").click(function() { 
		$("#containerParts").show();
		$("#containerRims").hide();
		
		$("#buttonRims").removeClass('active');
		$(this).addClass('active');
	});
	
	$("#buttonRims").click(function() { 
		$("#containerParts").hide();
		$("#containerRims").show();
		
		$("#buttonParts").removeClass('active');
		$(this).addClass('active');
	});
	
	$("#search_brand").change(function() { 
		var brand = $('#search_brand').val();
		$('#search_model').html ($.ajax ({url: '/backend/ajax.models.php?brand=' + brand, async: false}).responseText);	
		$("#selectsearch_model").html ("Alle modellen");
	});
	
	$("#search_sub_category").change(function() { 
		var category = $('#search_sub_category').val();
		if(category == 106) {
			$("#search_model_div").hide();
			$("#search_brand_div").hide();
			$("#search_diameter_div").show();
			//$("#search_PCD_div").show();
		}
		else {
			$("#search_model_div").show();
			$("#search_brand_div").show();
			$("#search_diameter_div").hide();
			//$("#search_PCD_div").hide();
		}
		$('#search_manufacturer').html ($.ajax ({url: '/backend/ajax.manufacturers.php?category=' + category, async: false}).responseText);	
	});
	
	$("#search_main_category").change(function() { 
		var cat = $('#search_main_category').val();
		if(cat == 14) {
			$("#search_model_div").hide();
			$("#search_brand_div").hide();
		}
		else {
			$("#search_model_div").show();
			$("#search_brand_div").show();
		}
		$('#search_sub_category').html ($.ajax ({url: '/backend/ajax.subcategories.php?category=' + cat, async: false}).responseText);	
	});					
});

function startGallery() {
	var myGallery = new gallery(Moo.$('myGallery2'), {
		timed: true,
		showArrows: false,
		showInfopane: false,
		showCarousel: false,
		embedLinks: false,
		delay: 8000				
	});
}
window.onDomReady(startGallery);
