var ajax = new Array();

function getSubCategoryList(sel, current_category_id){
	var prod_id = sel.options[sel.selectedIndex].value;
	
	document.getElementById('hc-model_id').options.length = 0;	// Empty sub category select box
	if(prod_id.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = 'hardcopy.php?hc-prod_id='+prod_id+'&hc-cid='+current_category_id+'&hc-query=qm';	// Specifying which file to get
		ajax[index].onCompletion = function(){ createSubCategories(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}
function createSubCategories(index){
	document.getElementById('hc-model_id').className='selected'; // change CSS class
	var obj = document.getElementById('hc-model_id');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}
