/*	PAX option transfer demo.
*/
pax.load.onloaded( function() {
	
	var options1 = [
		{ 'value': '1', 'text': 'honey cake' },
		{ 'value': '2', 'text': 'jam donut' },
		{ 'value': '3', 'text': 'chocolate chip muffin' },
		{ 'value': '7', 'text': 'Blueberry tart' }
	];
	
	var options2 = [
		{ 'value': '5', 'text': 'Vanilla slice' },
		{ 'value': '4', 'text': 'Rasphberry tartlet' },
		{ 'value': '6', 'text': 'Lemon merang' },
		{ 'value': '9', 'text': 'Banana split' }
	];

	//	Sorting optiontransfer example
	pax.widget.optiontransfer.init( pax.$('pax.widget.optiontransfer.example4'), {
		options1: options1,
		options2: options2,
		optionFilter: function( options, fromSelect, toSelect ) {
			//	Exclude tarts from being moved!
			//	Could look at fromSelect and toSelect to see where the options coming from and going to.
			var newOptions = [];
			for( var i = 0; i < options.length; i++ ) {
				if( (options[i].text).indexOf( 'tart' ) == -1 ) {
					newOptions.push( options[i] );
				}
			}
			return newOptions;
		}
	} );
	
} );
