
/*
Script by RoBorg
RoBorg@geniusbug.com
http://javascript.geniusbug.com | http://www.roborg.co.uk
Please do not remove or edit this message
Please link to this website if you use this script!
*/



//Start setup [Edit below here]

var d = new dynamicSelect();

d.addSelect('Option1');

d.selects['Option1'].addOption('1283');
d.selects['Option1'].options['1283'].createOption('Select', '');
d.selects['Option1'].options['1283'].createOption('No Ozonator', 'null');
d.selects['Option1'].options['1283'].createOption('120V Clarathon XL Ozonator +$59.95', '9624');

d.selects['Option1'].addOption('1284');
d.selects['Option1'].options['1284'].createOption('Select', '');
d.selects['Option1'].options['1284'].createOption('No Ozonator', 'null');
d.selects['Option1'].options['1284'].createOption('120V Clarathon XL Ozonator +$59.95', '9624');

d.selects['Option1'].addOption('1285');
d.selects['Option1'].options['1285'].createOption('Select', '');
d.selects['Option1'].options['1285'].createOption('No Ozonator', 'null');
d.selects['Option1'].options['1285'].createOption('240V Clarathon XL Ozonator +$59.95', '9630');

d.selects['Option1'].addOption('1286');
d.selects['Option1'].options['1286'].createOption('Select', '');
d.selects['Option1'].options['1286'].createOption('No Ozonator', 'null');
d.selects['Option1'].options['1286'].createOption('240V Clarathon XL Ozonator +$59.95', '9630');

d.selects['Option1'].addOption('1287');
d.selects['Option1'].options['1287'].createOption('Select', '');
d.selects['Option1'].options['1287'].createOption('No Ozonator', 'null');
d.selects['Option1'].options['1287'].createOption('240V Clarathon XL Ozonator +$59.95', '9630');

d.selects['Option1'].addOption('1288');
d.selects['Option1'].options['1288'].createOption('Select', '');
d.selects['Option1'].options['1288'].createOption('No Ozonator', 'null');
d.selects['Option1'].options['1288'].createOption('240V Clarathon XL Ozonator +$59.95', '9630');

//End setup [Edit above here]



function dynamicSelect()
{
	this.selects = new Array();
	
	this.addSelect = function(name)
	{
		this.selects[name] = new selectObj();
	}



	this.updateOptions = function(source, target)
	{
		var form = source.form;
		var target = form.elements[target];
		var value = source.options[source.selectedIndex].value;
		
		while(target.options.length) target.remove(0);
		
		if(!this.selects[source.name].options[value])
		{
			//alert('Invalid selection.'); //For debugging while you set it up
			return;
		}
		
		var data = this.selects[source.name].options[value].options;
		
		for(var x=0; x<data.length; x++)
		{
			try
			{
				target.add(data[x]);
			}
			catch(e)
			{
				target.add(data[x], null);
			}
		}
		
		target.selectedIndex = 0;
	}

}



function selectObj()
{
	this.options = new Array();
	
	this.addOption = function(value)
	{
		this.options[value] = new optionObj();
	}
}



function optionObj()
{
	this.options = new Array();
	
	this.createOption = function(name, value)
	{
		this.options[this.options.length] = new Option(name, value);
	}
}
