<!--

/**
* Function is called when AreaSelect-element's option is changed. Function fills the 
* RegionSelect-element with regions indicated by AreaSelect-element.
*
* @param areaId String AreaSelect-element's selected option.
*/
function changeArea(areaId){

	var regionIds;
	var regionSelect;
	var regionSelectOption;
	var loop;
	var selectedRegionId;
	
	//Either use selected area's regions or all regions...
	if(IsInteger(areaId)){
		loop=Network[areaId]["RegionIds"][areaId];		
		document.getElementById("TypeRegionCode").value=Network[areaId]["TypeRegionCode"];
	}else{
		loop=Region;
		document.getElementById("AreaSelect").value="suomi";
		document.getElementById("TypeRegionCode").value=null;
	}
	
	regionSelect=document.getElementById("RegionSelect");
	selectedRegionId=regionSelect.value;
	
	
	//Clear region-select...
	regionSelect.options.length=0;
	

	//Add first option...
	regionSelectOption=document.createElement("option");
	regionSelectOption.text=Region["valitse"]["RegionName"];
	regionSelectOption.value="valitse";
	
	try {
    	regionSelect.add(regionSelectOption, null); 
    }
    catch(ex) {
    	regionSelect.add(regionSelectOption, regionSelectOption.selectedIndex); 
    }
	
	//Populate region-select with desired regions...
	for(var regionId in loop){
		
		if(Region[regionId]!=null){
			regionSelectOption=document.createElement("option");
			regionSelectOption.text=Region[regionId]["RegionName"];
			regionSelectOption.value=regionId;
			
			if(selectedRegionId==regionId){
				regionSelectOption.setAttribute("selected",true);

			}
			try {
		    	regionSelect.add(regionSelectOption, null); 
		    }
		    catch(ex) {
		    	regionSelect.add(regionSelectOption, regionSelectOption.selectedIndex); 
		    }

		}
	}
	
}

/**
* Fetched stations are displayed in a html-table which has every second row coloured as grey. 
* So after sorting the table the rows must be re-coloured also. 
*
* @param tableRows Array(HTMLTableRowElement) Contains table-rows which needs to be coloured.
*/
function colorTableRows(tableRows){
	var i=0;

	for (a=0;a<tableRows.length;a++){
		
		if(i%2==0)
			tableRows[a].className="teksti12";
		else
			tableRows[a].className="harmaatausta";
			
		i++;
	}	
}


-->

