$(document).ready(function() {

	// ====== select vendor category funciton and function assignment =====
	function Vendor_Category_Click(myLink){
		var myID = $(myLink).attr('id');
		//get vendor category data
		$.post('a_get_vendor_categories2.aspx', {CategoryID: myID}, function(NewCategoryList) {
			if(NewCategoryList)
			{
				$('#wheretoshop_content').html(NewCategoryList);
				$('a.vendor_category').click(function(e){
					e.preventDefault();
					Vendor_Category_Click(this);
				});
			}
			//get vendor data for this category, if any
			$.post('a_get_vendors2.aspx', {CategoryID: myID}, function(NewVendorList) {
				if(NewVendorList)
				{
					$('#wheretoshop_content').append(NewVendorList);
					
					$('a.vendor_info_link').click(function(e){
						Vendor_Click(this);
					});
				}
			});
		});
	}

	function Vendor_Click(myLink){
		$.post('a_log_vendor_click.aspx', {CategoryID: $(myLink).attr('id')});
	}

	$('a.vendor_category').click(function(e){
		e.preventDefault();
		Vendor_Category_Click(this);
	});
	
	$('a.vendor_info_link').click(function(e){
		Vendor_Click(this);
	});
	
 });

 
 
 

