var ajax = new Array();

function getStyles(sel)
{
	var bagStyle = sel.options[sel.selectedIndex].value;
	document.getElementById('style').options.length = 0;	// Empty city select box
	if(bagStyle.length>0){
		var index = ajax.length;
		ajax[index] = new sack();

		ajax[index].requestFile = 'getStyles.php?bagStyle='+bagStyle;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createStyles(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}

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

function getTypes(sel)
{
	var bagType = sel.options[sel.selectedIndex].value;
	document.getElementById('type').options.length = 0;	// Empty city select box
	if(bagType.length>0){
		var index = ajax.length;
		ajax[index] = new sack();

		ajax[index].requestFile = 'getTypes.php?bagType='+bagType;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createTypes(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}

function createTypes(index)
{
	var obj = document.getElementById('type');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code
}
function getQty(sel)
{
	var bagQty = sel.options[sel.selectedIndex].value;
	document.getElementById('quantity').options.length = 0;	// Empty city select box
	if(bagQty.length>0){
		var index = ajax.length;
		ajax[index] = new sack();

		ajax[index].requestFile = 'getQty.php?bagQty='+bagQty;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createQty(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}

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