$(document).ready(function () {
	$(".sub2").click(function () {
		$(".menu_sub3").hide();
		$(".menu_sub2").each(function () {
			$(this).find('.topsub').removeClass('sub_bg');
			$(this).find('.link').removeClass('link');
		});
		var top = $(this).parent().parent().parent().parent().parent().parent().parent();
		top.find(".menu_sub3").show();
		top.find('.topsub').addClass('sub_bg');
		$(this).parent().addClass('link');
		//var id = $(this).attr("rel");
		//$("#s"+id).show();
	});
	$(".sub").click(function () {
		$(".menu_sub2").hide();
		$(".sub").removeClass("act");
		$(this).parent().parent().find(".menu_sub2").show();
		//var id = $(this).attr("rel");
		//$("#s"+id).show();
		$(this).addClass("act");
	});

	/*
	$(".voltage220").click(function () {
		$(this).parent().attr("class", "switch_on");
		$(".voltage380").parent().attr("class", "switch_off");
		$(".voltage690").parent().attr("class", "switch_off");
		
		$(".one").each(function () {
			if($(this).attr("volt220")== 'true' && $(this).attr("filteredByPower")!='true' && $(this).attr("filteredByPhase")!='true' && $(this).attr("filteredByUsage")!='true'){
				$(this).show();
				
			}
			else{
				$(this).hide();
				$(this).attr("filteredByVoltage", 'true');
			}
		});
	});
	$(".voltage380").click(function () {
		$(this).parent().attr("class", "switch_on");
		$(".voltage220").parent().attr("class", "switch_off");
		$(".voltage690").parent().attr("class", "switch_off");
		
		$(".one").each(function () {
			if($(this).attr("volt380")== 'true' && $(this).attr("filteredByPower")!='true'  && $(this).attr("filteredByPhase")!='true' && $(this).attr("filteredByUsage")!='true'){
				$(this).show();
				
			}
			else{
				$(this).hide();
				$(this).attr("filteredByVoltage", 'true');
			}
			
		});
	});
	$(".voltage690").click(function () {
		$(this).parent().attr("class", "switch_on");
		$(".voltage380").parent().attr("class", "switch_off");
		$(".voltage220").parent().attr("class", "switch_off");
		
		$(".one").each(function () {
			if($(this).attr("volt690")== 'true' && $(this).attr("filteredByPower")!='true'  && $(this).attr("filteredByPhase")!='true' && $(this).attr("filteredByUsage")!='true'){
				$(this).show();
				
			}
			else{
				$(this).hide();
				$(this).attr("filteredByVoltage", 'true');
			}
		});
	});
	$(".phase1").click(function () {
		$(this).parent().attr("class", "switch_on");
		$(".phase3").parent().attr("class", "switch_off");
		$(".voltage380").parent().hide();
		$(".voltage690").parent().hide();
		
		$(".one").each(function () {
			if($(this).attr("phases1")== 'true' && $(this).attr("filteredByPower")!='true' && $(this).attr("filteredByVoltage")!='true' && $(this).attr("filteredByUsage")!='true'){
				$(this).show();
			}
			else{
				$(this).hide();
				$(this).attr("filteredByPhase", 'true');
			}
		});
	});
	$(".phase3").click(function () {
		$(this).parent().attr("class", "switch_on");
		$(".phase1").parent().attr("class", "switch_off");
		$(".voltage380").parent().show();
		$(".voltage690").parent().show();
		
		$(".one").each(function () {
			if($(this).attr("phases3")== 'true'  && $(this).attr("filteredByPower")!='true' && $(this).attr("filteredByVoltage")!='true' && $(this).attr("filteredByUsage")!='true'){
				$(this).show();
				
			}
			else{
				$(this).hide();
				$(this).attr("filteredByPhase", 'true');
			}
		});
	});
	$(".removeFilter").click(function () {
		$(".one").each(function () {
			$(this).show();
			$(this).removeAttr("filteredByPower");
			$(this).removeAttr("filteredByPhase");
			$(this).removeAttr("filteredByVoltage");
		});
	});
	*/
	/*$(".usage").change(function () {
	var id=$(this).val();
	if($(this).attr("checked")){
		$(".one").each(function () {
			if($(this).attr("usage"+id)== 'true'  && $(this).attr("filteredByPower")!='true' && $(this).attr("filteredByVoltage")!='true' && $(this).attr("filteredByPhase")!='true'){
				$(this).show();
				
			}
			else{
				$(this).hide();
				$(this).attr("filteredByUsage", 'true');
			}
		});
	}
	else{
		$(".one").each(function () {
			if($(this).attr("filteredByPower")!='true' && $(this).attr("filteredByVoltage")!='true' && $(this).attr("filteredByPhase")!='true'){
				$(this).show();
				
			}
		});
	
	}
	
	});*/
	
});
/*
	$(function() {
		$("#slider-range").slider({
			range: true,
			value:2,
			min: 0,
			max: 10,
			step: 0.1,
			values: [1, 5],
			slide: function(event, ui) {
				$("#amount").val(ui.values[0] + ' - ' + ui.values[1]);
			},
			stop: function(event, ui) { 
				$(".one").each(function () {
					var min = parseFloat($(this).attr("vmin"));
					var max = parseFloat($(this).attr("vmax"));
					
					if(ui.values[0]<=min && max<=ui.values[1] && $(this).attr("filteredByPhase")!='true' && $(this).attr("filteredByUsage")!='true' && $(this).attr("filteredByVoltage")!='true')
					$(this).show();
					else{
						$(this).hide();
						$(this).attr("filteredByPower", 'true');
					}
				});
			}


		});
		$("#amount").val($("#slider-range").slider("values", 0) + ' - ' + $("#slider-range").slider("values", 1));

	});
*/
