// 	MG October 06
//	Function to create a weighted list of airlines for AU market and display appropriate farefinder
//
//	Each airline in the ja_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
//

ja_weightedairlines=new Array(); //new array to hold "weighted" airlines
ja_currentairline=0;

function buildweightedArray_JA(){
	while (ja_currentairline<ja_airlines.length){ //step through each ja_airlines[] element
		for (i=0; i<ja_airlineweight[ja_currentairline]; i++)
			ja_weightedairlines[ja_weightedairlines.length]=ja_airlines[ja_currentairline];
			ja_currentairline++;
		}
	}

//	This shows the weighted farefinder

function showFareFinder_JA(){
	buildweightedArray_JA();
	var ja_randomnumber=Math.floor(Math.random()*ja_totalweight);
	var farefinder = $('#farefinder');
	var farefinderselect = $('#ja_select_other_form');
	if (farefinder){
		farefinder.attr("src",ja_url[ja_weightedairlines[ja_randomnumber]]);
	}
}