/*************************************************************************
*             make options                                               *             
*             Changes options in <select>                                *             
*             Scripting: PEKAN SOLUTIONS Copyright: 2005                 *
*             Email: pia.klein@pekan.de                                  *
*************************************************************************/


//******************** please leave the following unchanged **************






//************** function to create elements *****************
function makeOption(targetElement,optionArray,selectedValue){
	changeList=targetElement;
	changeList.options.length=0;
	
	
	for(var i in optionArray[selectedValue]){
		newOption=new Option(optionArray[selectedValue][i][0],optionArray[selectedValue][i][1]);		
		changeList.options[changeList.options.length]=newOption;
	}
}

function changeOptions(thisForm,dropDownArray){
	for(var i in dropDownArray){

		//targetElement
		thisTargetElement=thisForm.elements[dropDownArray[i].targetElement];
		
		//startElement
		thisStartElement=thisForm.elements[dropDownArray[i].startElement];
		
		//slelected value
		partsSelectedValue=thisStartElement.options[thisStartElement.selectedIndex].value.split(' ');
		thisSelectedValue="";
		for(var j in partsSelectedValue){
			thisSelectedValue+=partsSelectedValue[j];
		}
		
		//make options for dropDown
		makeOption(thisTargetElement,dropDownArray[i].optionArray,thisSelectedValue);
		
		//select first option
		thisTargetElement.selectedIndex=0;
	}
}


function relatedOption(startElement,targetElement,optionArray){
	this.targetElement=targetElement;
	this.startElement=startElement;
	this.optionArray=optionArray;
}




