// 	MG October 06
//	Function to create a weighted list of airlines for AU market and display appropriate farefinder
//
//	Each airline in the ko_airlines array needs a div by the same name, set to display:none; on page load...
//
//  Other variables are defined in the farefinder CFM files as they take Shado vars
//

ko_weightedairlines=new Array(); //new array to hold "weighted" airlines
ko_currentairline=0;

function buildweightedArray_KO(){
	while (ko_currentairline<ko_airlines.length){ //step through each ko_airlines[] element
		for (i=0; i<ko_airlineweight[ko_currentairline]; i++)
			ko_weightedairlines[ko_weightedairlines.length]=ko_airlines[ko_currentairline];
			ko_currentairline++;
		}
	}

//	This shows the weighted farefinder

function showFareFinder_KO(){
	buildweightedArray_KO();
	var ko_randomnumber=Math.floor(Math.random()*ko_totalweight);
	var farefinder = $('#farefinder');
	var farefinderselect = $('#ko_select_other_form');
	if (farefinder){
		farefinder.attr("src",ko_url[ko_weightedairlines[ko_randomnumber]]);
	}
}