function GetSubCategories(){
	
	selectbox = $('Item[category_id]');
	subcat_selectbox = $('Item[subcategory_id]');
	
	for (i=0;i<subcat_selectbox.length;i++)
	    {
			subcat_selectbox.remove(i);
	    }
	
	new Ajax.Updater('Item[subcategory_id]',
					site_root + '/User/Items/_get_subcategories.js.php',
					{
					asynchronous: true,
					evalScripts: true,
					parameters : { cat_id: selectbox.options[selectbox.selectedIndex].value },
					method: 'get'
					}
					);

}

function search_subcategories(){
	
	selectbox = $('Search[category_id]');
	subcat_selectbox = $('Search[subcategory_id]');
	
	for (i=0;i<subcat_selectbox.length;i++)
	    {
			subcat_selectbox.remove(i);
	    }
	
	new Ajax.Updater('Search[subcategory_id]',
					site_root + '/Search/_get_subcategories.js.php',
					{
					asynchronous: true,
					evalScripts: true,
					parameters : { cat_id: selectbox.options[selectbox.selectedIndex].value },
					method: 'get'
					}
					);
	
	
}


function SelectSubCategory(id,sc_id){

	selectbox = $('Item[category_id]');
	
	new Ajax.Updater('Item[subcategory_id]',
					site_root + '/User/Items/_get_subcategories.js.php',
					{
					asynchronous: true,
					evalScripts: true,
					parameters : { cat_id: id, subcat_id: sc_id },
					method: 'get'
					}
					);
	
}

function CheckItemSwaps(){
	
	selectbox = $('Offer[Swap]');
	
	new Ajax.Updater('Search[subcategory_id]',
					site_root + '/Item/_find_exisiting_swaps.php',
					{
					asynchronous: true,
					evalScripts: true,
					parameters : { id: selectbox.options[selectbox.selectedIndex].value },
					method: 'get'
					}
					);
	
}