// JavaScript Document

function tabs_info(){
	$('#tabs #tabsconteiner .hiders').hide(); // Hide all divs
	$('#tabs #tabsconteiner #tab-8').show(); // Show the first div
	$('#tabs ul li a:first').addClass('activeTABINFO'); // Set the class of the first link to active
	$('#tabs ul li a').click(function(){ //When any link is clicked
	$('#tabs ul li a').removeClass('activeTABINFO'); // Remove active class from all links
	$(this).addClass('activeTABINFO'); //Set clicked link class to active
	var currentTab = $(this).attr('href'); // Set variable currentTab to value of href attribute of clicked link
	$('#tabs #tabsconteiner .hiders').hide(); // Hide all divs
	$(currentTab).show(); // Show div with id equal to variable currentTab
	return false;
});
}

function tovar_tabs(){
	$('#tovar_content .hiders').hide(); // Hide all divs
	$('#tovar_content #tovar_tab1').show(); // Show the first div
	$('#tovar_tabs ul li:first').addClass('active'); // Set the class of the first link to active
	$('#tovar_tabs ul li a').click(function(){ //When any link is clicked
	$('#tovar_tabs ul li').removeClass('active'); // Remove active class from all links
	$(this).parent().addClass('active'); //Set clicked link class to active
	var currentTab = $(this).attr('href'); // Set variable currentTab to value of href attribute of clicked link
	$('#tovar_content .hiders').hide(); // Hide all divs
	$(currentTab).show(); // Show div with id equal to variable currentTab
	return false;
});
}

function sorterarrows(){
	$('#sorter_tovar  a').click(function(){
	$('#sorter_tovar  a').removeClass('activedown');
	$(this).addClass('activedown');
	});
	

}

function comment_form(){
	$('#comment_form').hide();
	$('a.buttonplus').click(function(){
		$('#comment_form').slideToggle('slow');
	});
}

function subcategory(){
	$('#cattabs #subcategory_conteiner .hiders').hide(); // Hide all divs
	$('#cattabs #subcategory_conteiner #tab-1').show() // Show the first div
	//$('#cattabs ul li a.tablinks:first').addClass('active'); // Set the class of the first link to active
	$('#cattabs ul li a.tablinks').click(function(){ //When any link is clicked
		$('#cattabs ul li a.tablinks').removeClass('active'); // Remove active class from all links
		$(this).addClass('active'); //Set clicked link class to active
		var currentTab = $(this).attr('href'); // Set variable currentTab to value of href attribute of clicked link
		$('#cattabs #subcategory_conteiner .hiders').hide(); // Hide all divs
		$(currentTab).show(); // Show div with id equal to variable currentTab
		return false;
	});
}

function mainmenu(){
$(".subcategorylist div").css({display: "none"}); // Opera Fix*/
$(".subcategorylist li").hover(function(){
		$(this).find('div').css({visibility: "visible",display: "none"}).show(200);
		},function(){
		$(this).find('div').css({visibility: "hidden"});
		});
}

function z_indexfixer() {
		var zIndexNumber = 9999;
		$('div').each(function() {
			$(this).css('zIndex', zIndexNumber);
			zIndexNumber -= 10;
		});
}


function highlightTabManu() {
	// set default actove tab
	$('#categorytabs a:contains("Электроника")').addClass('active');

	// add class to active tab in top menu
	var act = $("#path a").eq(1).html();
	if(act && act.length>1) {
		// show correct tab
		$('#categorytabs a').removeClass('active');
		$('#categorytabs a:contains('+act+')').addClass('active');
		// show correct submenu
		var actSubMenuHref = $('#categorytabs a.active').attr('href');
		if(actSubMenuHref ) {
			$('#cattabs #subcategory_conteiner div').hide();
			$('#cattabs #subcategory_conteiner').find(actSubMenuHref).show();
		}
	}
}
