var ajax = new Array();

function getProductList(sel,locale)
{
	var category = sel.options[sel.selectedIndex].value;
	document.getElementById('product_select').options.length = 0;	// Empty select box
	if(category.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = '/sites/all/themes/polar/getProducts.php?category='+category+'&locale='+locale;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createProducts(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}

}

function createProducts(index)
{
	var obj = document.getElementById('product_select');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}
