$(document).ready(function(){
	$('#tabs1 div').hide(); // Hide all divs
	$('#tabs1 div#tab1-1').show(); // Show the first div
	$('#tabs1 div#blank').show(); // Show the first div
	$('#tabs1   ul li a:first').addClass('active'); // Set the class of the first link to active
	$('#tabs1   ul li a').click(function(){ //When any link is clicked
		$('#tabs1   ul li a').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
		$('#tabs1   div').hide(); // Hide all divs
		$(currentTab).show(); // Show div with id equal to variable currentTab
		var id = $(this).attr('id');	
		var html = $.ajax({
			type: "POST",
			url: "ajax/get_news.php",
			data: "section_name="+id,
			async: false
		}).responseText;
		$(currentTab).html(html);
		return false;
	})

	
	$('#tabs2 div').hide(); // Hide all divs
	$('#tabs2 div#tab2-1').show(); // Show the first div
	$('#tabs2 div#blank').show(); // Show the first div
	$('#tabs2   ul li a:first').addClass('active'); // Set the class of the first link to active
	$('#tabs2   ul li a').click(function(){ //When any link is clicked
		$('#tabs2   ul li a').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
		$('#tabs2   div').hide(); // Hide all divs
		$(currentTab).show(); // Show div with id equal to variable currentTab
		var id = $(this).attr('id');	
		var html = $.ajax({
			type: "POST",
			url: "ajax/get_news.php",
			data: "section_name="+id,
			async: false
		}).responseText;
		$(currentTab).html(html);
		return false;
	})

	$('#tabs3  div').hide(); // Hide all divs
	$('#tabs3  div#tab3-1').show(); // Show the first div
	$('#tabs3  ul li a:first').addClass('active'); // Set the class of the first link to active
	$('#tabs3  ul li a').click(function(){ //When any link is clicked
		$('#tabs3  ul li a').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
		$('#tabs3  div').hide(); // Hide all divs
		$(currentTab).show(); // Show div with id equal to variable currentTab
		var id = $(this).attr('id');
		var html = $.ajax({
			type: "POST",
			url: "ajax/get_news.php",
			data: "section_name="+id,
			async: false
		}).responseText;
		$(currentTab).html(html);
		return false;
	})
	
	$('#tabs4  div').hide(); // Hide all divs
	$('#tabs4  div#tab4-1').show(); // Show the first div
	$('#tabs4  ul li a:first').addClass('active'); // Set the class of the first link to active
	$('#tabs4  ul li a').click(function(){ //When any link is clicked
		 // Remove active class from all links
		$('#tabs4  ul li a').removeClass('active');
		 $(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
		$('#tabs4  div').hide(); // Hide all divs
		$(currentTab).show(); // Show div with id equal to variable currentTab
		var id = $(this).attr('id');
		var html = $.ajax({
			type: "POST",
			url: "ajax/get_news.php",
			data: "section_name="+id,
			async: false
		}).responseText;
		$(currentTab).html(html);
		return false;
	})

	///////////////////////////////// shopping tabs /////////////////////////////////////////
	// ads
	$('#product_details  div').hide();
	$('#product_details  div:first').show(); 
	// add event if click on product
	$('#shop_list ul li a').click(function(){
		//$(this).addClass('active');
		var currentProduct = $(this).attr('href');
		$('#product_details  div').hide();
		$(currentProduct).show();
		return false;
	})
	
	// hot product
	$('#hot_product_details  div').hide();
	$('#prod-0').show(); 
	$('#prod-tab-0-0').show(); 
	$('#prod_nav ul li a:first').addClass('active'); 
	// add event if click on product
	$('#hot_shop_list ul li a').click(function(){
		var currentProduct = $(this).attr('href');
		$('#hot_product_details  div').hide();
		$('#prod-'+currentProduct).show(); 
		$('#prod-tab-'+currentProduct+'-0').show(); 
		$('#prod_nav ul li a').removeClass('active');
		$('#prod_nav ul li a:first').addClass('active'); 
		return false;
	})
	
	$('#prod_nav ul li a').click(function(){
		$('.white_block').hide(); 
		$('#prod_nav ul li a').removeClass('active');
		$(this).addClass('active'); 
		var currentProduct = $(this).attr('href');
		$('#prod-tab-'+currentProduct).show(); 
		return false;
	})
});