//The Order Selector (for use with playlist usually)
//2007-11-12, Luke McKenzie theclockspot.com

//Generates order selector control
//will be placed in dom @ <div id='orderselectordiv'>
//"parent" .js should handle onChange with onOrderSelect()
//Also holds and populates an array of show image urls.

//requires ajax.js for population
//requires enclosing file to specify pathtohome in javascript


//initialization---
//Why do these weird "init" functions exist?
//The creation of the order selector is registered for the onload event of the enclosing page.
//Ordinarily we'd have it call initOrderSelector() with appropriate "mode" parameter,
//but the registration method prevents specifying parameters, which totally sucks.
//So these functions are a stopgap, allowing initShowSelector() to be called with "mode" parameter
//(so it knows how to tailor the show selector for the page requesting its presence).

function initOrderSelectorForAll() {
	initOrderSelector('');
}

function initOrderSelector(mode) { //not intended to be public
	//builds code for order selector, places it in dom @ <div id='orderselectordiv'>
	//the onchange onShowSelector() to be handled in parent document
	
	somecode=''; //construction playground
	somecode+='<p>Order: ';
	somecode+='<input type=\'radio\' name=\'orderselectors\' id=\'asc\' onChange="onOrderSelect();" />&nbsp;Ascending (latest at bottom)&nbsp;&nbsp;';
	somecode+='<input type=\'radio\' name=\'orderselectors\' id=\'desc\' onChange="onOrderSelect();" checked />&nbsp;Descending (latest at top)</p>';
	
	//place that sucka on the page
	document.getElementById("orderselectordiv").innerHTML = somecode;
}

function getOrder() {
	//returns 'desc' if descending, 'asc' if ascending/else (default)
	if(document.getElementById("desc").checked) return 'desc';
	else return 'asc';
}