var ajax = new Array();
var Specification;
var Product;
var Lamp_Type;
var Position;
function getSpecification(sel)
{
	Specification = sel.options[sel.selectedIndex].value;
	document.getElementById('atlantic_Product').options.length = 0;	
	if(Specification.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = 'getProducts.cfm?Specification='+Specification;	
		ajax[index].onCompletion = function(){ makeProduct(index) };	
		ajax[index].runAJAX();		
	}
}

function makeProduct(index)
{
	var obj = document.getElementById('atlantic_Product');
	eval(ajax[index].response);	
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function getProduct(sel)
{
	Product = sel.options[sel.selectedIndex].value;
	document.getElementById('atlantic_Lamp_Type').options.length = 0;	// Empty city select box
	if(Product.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = 'getProducts.cfm?Specification='+Specification+'&Product='+Product;	// Specifying which file to get
		ajax[index].onCompletion = function(){ makeType(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}

function makeType(index)
{
	var obj = document.getElementById('atlantic_Lamp_Type');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}	
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function getLampPos(sel)
{
	Lamp_Type = sel.options[sel.selectedIndex].value;
	document.getElementById('atlantic_Position').options.length = 0;	
	if(Lamp_Type.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = 'getProducts.cfm?Specification='+Specification+'&Product='+Product+'&Lamp_Type='+Lamp_Type;	
		ajax[index].onCompletion = function(){ makePosition(index) };	
		ajax[index].runAJAX();		
	}
}
function makePosition(index)
{
	var obj = document.getElementById('atlantic_Position');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function getPosition(sel)
{
	Position = sel.options[sel.selectedIndex].value;
	document.getElementById('atlantic_Aperture').options.length = 0;
	if(Position.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		ajax[index].requestFile = 'getProducts.cfm?Specification='+Specification+'&Product='+Product+'&Lamp_Type='+Lamp_Type+'&Position='+Position;	
		ajax[index].onCompletion = function(){ makeAperture(index) };	
		ajax[index].runAJAX();		
	}
}
function makeAperture(index)
{
	var obj = document.getElementById('atlantic_Aperture');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}	
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function getAperture(sel)
{
	Aperture = sel.options[sel.selectedIndex].value;
	if(Aperture.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		ajax[index].requestFile = 'getProducts.cfm?Specification='+Specification+'&Product='+Product+'&Lamp_Type='+Lamp_Type+'&Position='+Position+'&Aperture='+Aperture;	
		ajax[index].onCompletion = function(){ getItems(index) };	
		ajax[index].runAJAX();		
	}
}
function getItems(index)
{
	eval(ajax[index].response);	
}	

