$(document).ready(function() {		
	$(".beigeboxlist ul li a.toggle").click(function(e) {
		e.preventDefault();

		if($(this).next().css("display") == "none") {
			$(this).next().show();
		}
		else {
			$(this).next().hide();
		}
	});
	
	var allOpen = false;
	
	$(".beigeboxlist a.toggleAll").click(function(e) {
		e.preventDefault();

		if(allOpen) {
			$(this).parent().parent().find(".item_info").hide();
			$(this).html("Visa alla");
			allOpen = false;
		}
		else {
			$(this).parent().parent().find(".item_info").show();
			$(this).html("Dölj alla");
			allOpen = true;
		}
	});

	$("#manufacturerDrop").change(function() {
		var theURL = "?page=reclamation&manufacturerId=" + $(this).options[$(this).selectedIndex].value;
		if(theURL != "null") {
			window.location.href = theURL;
		}
	});

	hostName = document.location.href.split("/");
	
	$("#supportCategoriesDrop").change(function() {
		if($(this).options[$(this).selectedIndex].value != "") {
			var theURL =  hostName[0] + "/upl/support/" + $(this).options[$(this).selectedIndex].value;
			if(theURL != "null") {
				window.open(theURL);
			}
		}
	});

	$("#accept-terms").click(function() {
		if($(this).find("input:checked")) {
			$("#reclamation-form").show();
		}
		else {
			$("#reclamation-form").hide();
		}
	});

});
