/* start module: cerca_linea */
$pyjs['loaded_modules']['cerca_linea'] = function (__mod_name__) {
	if($pyjs['loaded_modules']['cerca_linea']['__was_initialized__']) return $pyjs['loaded_modules']['cerca_linea'];
	var $m = $pyjs['loaded_modules']['cerca_linea'];
	$m['__repr__'] = function() { return '<module: cerca_linea>'; };
	$m['__was_initialized__'] = true;
	if ((__mod_name__ === null) || (typeof __mod_name__ == 'undefined')) __mod_name__ = 'cerca_linea';
	$m['__name__'] = __mod_name__;


	$m['RootPanel'] = $p['___import___']('pyjamas.ui.RootPanel.RootPanel', null, null, false);
	$m['VerticalPanel'] = $p['___import___']('pyjamas.ui.VerticalPanel.VerticalPanel', null, null, false);
	$m['HorizontalPanel'] = $p['___import___']('pyjamas.ui.HorizontalPanel.HorizontalPanel', null, null, false);
	$m['VerticalSplitPanel'] = $p['___import___']('pyjamas.ui.VerticalSplitPanel.VerticalSplitPanel', null, null, false);
	$m['SimplePanel'] = $p['___import___']('pyjamas.ui.SimplePanel.SimplePanel', null, null, false);
	$m['FlowPanel'] = $p['___import___']('pyjamas.ui.FlowPanel.FlowPanel', null, null, false);
	$m['DisclosurePanel'] = $p['___import___']('pyjamas.ui.DisclosurePanel.DisclosurePanel', null, null, false);
	$m['TabPanel'] = $p['___import___']('pyjamas.ui.TabPanel.TabPanel', null, null, false);
	$m['Grid'] = $p['___import___']('pyjamas.ui.Grid.Grid', null, null, false);
	$m['Frame'] = $p['___import___']('pyjamas.ui.Frame.Frame', null, null, false);
	$m['TextBox'] = $p['___import___']('pyjamas.ui.TextBox.TextBox', null, null, false);
	$m['TextArea'] = $p['___import___']('pyjamas.ui.TextArea.TextArea', null, null, false);
	$m['HTML'] = $p['___import___']('pyjamas.ui.HTML.HTML', null, null, false);
	$m['HTMLPanel'] = $p['___import___']('pyjamas.ui.HTMLPanel.HTMLPanel', null, null, false);
	$m['Anchor'] = $p['___import___']('pyjamas.ui.Anchor.Anchor', null, null, false);
	$m['Label'] = $p['___import___']('pyjamas.ui.Label.Label', null, null, false);
	$m['CheckBox'] = $p['___import___']('pyjamas.ui.CheckBox.CheckBox', null, null, false);
	$m['ListBox'] = $p['___import___']('pyjamas.ui.ListBox.ListBox', null, null, false);
	$m['Button'] = $p['___import___']('pyjamas.ui.Button.Button', null, null, false);
	$m['RadioButton'] = $p['___import___']('pyjamas.ui.RadioButton.RadioButton', null, null, false);
	$m['PopupPanel'] = $p['___import___']('pyjamas.ui.PopupPanel.PopupPanel', null, null, false);
	$m['KeyboardHandler'] = $p['___import___']('pyjamas.ui.KeyboardListener.KeyboardHandler', null, null, false);
	$m['FocusHandler'] = $p['___import___']('pyjamas.ui.FocusListener.FocusHandler', null, null, false);
	$m['Tree'] = $p['___import___']('pyjamas.ui.Tree.Tree', null, null, false);
	$m['TreeItem'] = $p['___import___']('pyjamas.ui.Tree.TreeItem', null, null, false);
	$m['Image'] = $p['___import___']('pyjamas.ui.Image.Image', null, null, false);
	$m['HasAlignment'] = $p['___import___']('pyjamas.ui.HasAlignment', null, null, false);
	$m['MenuBar'] = $p['___import___']('pyjamas.ui.MenuBar.MenuBar', null, null, false);
	$m['MenuItem'] = $p['___import___']('pyjamas.ui.MenuItem.MenuItem', null, null, false);
	$m['Widget'] = $p['___import___']('pyjamas.ui.Widget.Widget', null, null, false);
	$m['Hyperlink'] = $p['___import___']('pyjamas.ui.Hyperlink.Hyperlink', null, null, false);
	$m['Window'] = $p['___import___']('pyjamas.Window', null, null, false);
	$m['Timer'] = $p['___import___']('pyjamas.Timer.Timer', null, null, false);
	$m['JSONProxy'] = $p['___import___']('pyjamas.JSONService.JSONProxy', null, null, false);
	$m['History'] = $p['___import___']('pyjamas.History', null, null, false);
	$m['DOM'] = $p['___import___']('pyjamas.DOM', null, null, false);
	$m['prnt'] = $p['___import___']('prnt.prnt', null, null, false);
	$m['StyledFixedColumnFlexTable'] = $p['___import___']('util.StyledFixedColumnFlexTable', null, null, false);
	$m['HTMLFlowPanel'] = $p['___import___']('util.HTMLFlowPanel', null, null, false);
	$m['DP'] = $p['___import___']('util.DP', null, null, false);
	$m['VP'] = $p['___import___']('util.VP', null, null, false);
	$m['HP'] = $p['___import___']('util.HP', null, null, false);
	$m['GP'] = $p['___import___']('util.GP', null, null, false);
	$m['SP'] = $p['___import___']('util.SP', null, null, false);
	$m['get_checked_radio'] = $p['___import___']('util.get_checked_radio', null, null, false);
	$m['HidingPanel'] = $p['___import___']('util.HidingPanel', null, null, false);
	$m['ValidationErrorRemover'] = $p['___import___']('util.ValidationErrorRemover', null, null, false);
	$m['MyAnchor'] = $p['___import___']('util.MyAnchor', null, null, false);
	$m['LoadingButton'] = $p['___import___']('util.LoadingButton', null, null, false);
	$m['date'] = $p['___import___']('datetime.date', null, null, false);
	$m['time'] = $p['___import___']('datetime.time', null, null, false);
	$m['datetime'] = $p['___import___']('datetime.datetime', null, null, false);
	$m['timedelta'] = $p['___import___']('datetime.timedelta', null, null, false);
	$m['Calendar'] = $p['___import___']('Calendar.Calendar', null, null, false);
	$m['DateField'] = $p['___import___']('Calendar.DateField', null, null, false);
	$m['TimeField'] = $p['___import___']('Calendar.TimeField', null, null, false);
	$m['MapPanel'] = $p['___import___']('map.MapPanel', null, null, false);
	$m['Layer'] = $p['___import___']('map.Layer', null, null, false);
	$m['LayerPanel'] = $p['___import___']('map.LayerPanel', null, null, false);
	$m['Marker'] = $p['___import___']('map.Marker', null, null, false);
	$m['DissolvingPopup'] = $p['___import___']('DissolvingPopup.DissolvingPopup', null, null, false);
	$m['JsonHandler'] = $p['___import___']('util.JsonHandler', null, null, false);
	$m['redirect'] = $p['___import___']('util.redirect', null, null, false);
	$m['client'] = $m['JSONProxy']('/json/', $p['list'](['paline_smart_search', 'urldecode', 'paline_percorso_fermate', 'paline_orari']));
	$m['PalinaPanel'] = (function(){
		var $cls_definition = new Object();
		var $method;
		$cls_definition['__module__'] = 'cerca_linea';
		$method = $pyjs__bind_method2('__init__', function(owner, p, img) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				owner = arguments[1];
				p = arguments[2];
				img = arguments[3];
			}
			if (typeof img == 'undefined') img=arguments['callee']['__args__'][5][1];
			var $iter1_iter,vp,$iter2_type,$iter2_iter,$iter1_array,$and3,$iter1_nextval,$and1,$and2,altre,$and4,$and5,$and6,$iter2_idx,titolo,$iter2_array,$iter2_nextval,$iter1_type,i,l,$iter1_idx,linea;
			$m['HorizontalPanel']['__init__'](self);
			self['addStyleName']('palina');
			self['owner'] = owner;
			i = $m['Image'](img);
			i['addStyleName']('palina-img');
			self['add'](i);
			vp = $m['VerticalPanel']();
			self['add'](vp);
			titolo = $m['HTMLFlowPanel']();
			vp['add'](titolo);
			if ($p['bool'](($p['bool']($and1=p['__contains__']('nascosta'))?p['__getitem__']('nascosta'):$and1))) {
				self['nascosta'] = true;
				self['setVisible'](false);
			}
			else {
				self['nascosta'] = false;
			}
			titolo['addAnchor']($p['sprintf']('%s (%s)', $p['tuple']([p['__getitem__']('nome'), p['__getitem__']('id_palina')])), owner['onPalinaFactory'](p['__getitem__']('id_palina')));
			titolo['addStyleName']('h2');
			if ($p['bool'](($p['bool']($and3=p['__contains__']('distanza_arrotondata'))?!$p['op_eq'](p['__getitem__']('distanza_arrotondata'), ''):$and3))) {
				titolo['addHtml']($p['sprintf']('&nbsp;(%s)', p['__getitem__']('distanza_arrotondata')));
			}
			if ($p['bool'](p['__contains__']('linee_info'))) {
				$iter1_iter = p['__getitem__']('linee_info');
				$iter1_nextval=$p['__iter_prepare']($iter1_iter,false);
				while (typeof($p['__wrapped_next']($iter1_nextval)['$nextval']) != 'undefined') {
					l = $iter1_nextval['$nextval'];
					linea = $m['HTMLFlowPanel']();
					linea['add']($m['Image']('/paline/s/img/bus.png'));
					linea['addAnchor'](l['__getitem__']('id_linea'), owner['onLineaFactory'](l['__getitem__']('id_linea')));
					linea['addHtml']($p['sprintf']('&nbsp;Direz. %s', l['__getitem__']('direzione')));
					vp['add'](linea);
				}
			}
			if ($p['bool'](($p['bool']($and5=p['__contains__']('linee_extra'))?($p['cmp']($p['len'](p['__getitem__']('linee_extra')), 0) == 1):$and5))) {
				altre = $m['HTMLFlowPanel']();
				altre['add']($m['Image']('/paline/s/img/bus.png'));
				vp['add'](altre);
				altre['addHtml']('Altre linee:&nbsp;');
				$iter2_iter = p['__getitem__']('linee_extra');
				$iter2_nextval=$p['__iter_prepare']($iter2_iter,false);
				while (typeof($p['__wrapped_next']($iter2_nextval)['$nextval']) != 'undefined') {
					l = $iter2_nextval['$nextval'];
					altre['addAnchor'](l, owner['onLineaFactory'](l));
					altre['addHtml']('&nbsp;');
				}
			}
			return null;
		}
	, 1, [null,null,['self'],['owner'],['p'],['img', '/paline/s/img/palina.png']]);
		$cls_definition['__init__'] = $method;
		$method = $pyjs__bind_method2('mostra', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			self['setVisible'](true);
			return null;
		}
	, 1, [null,null,['self']]);
		$cls_definition['mostra'] = $method;
		var $bases = new Array($m['HorizontalPanel']);
		var $data = $p['dict']();
		for (var $item in $cls_definition) { $data['__setitem__']($item, $cls_definition[$item]); }
		return $p['_create_class']('PalinaPanel', $p['tuple']($bases), $data);
	})();
	$m['PalinaSmallPanel'] = (function(){
		var $cls_definition = new Object();
		var $method;
		$cls_definition['__module__'] = 'cerca_linea';
		$method = $pyjs__bind_method2('__init__', function(owner, p, img) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				owner = arguments[1];
				p = arguments[2];
				img = arguments[3];
			}
			if (typeof img == 'undefined') img=arguments['callee']['__args__'][5][1];
			var i;
			$m['HTMLFlowPanel']['__init__'](self);
			self['owner'] = owner;
			i = $m['Image'](img);
			self['add'](i);
			self['addAnchor']($p['sprintf']('%s (%s)', $p['tuple']([p['__getitem__']('nome'), p['__getitem__']('id_palina')])), owner['onPalinaFactory'](p['__getitem__']('id_palina')));
			return null;
		}
	, 1, [null,null,['self'],['owner'],['p'],['img', '/paline/s/img/down_arrow.png']]);
		$cls_definition['__init__'] = $method;
		var $bases = new Array($m['HTMLFlowPanel']);
		var $data = $p['dict']();
		for (var $item in $cls_definition) { $data['__setitem__']($item, $cls_definition[$item]); }
		return $p['_create_class']('PalinaSmallPanel', $p['tuple']($bases), $data);
	})();
	$m['PercorsoPanel'] = (function(){
		var $cls_definition = new Object();
		var $method;
		$cls_definition['__module__'] = 'cerca_linea';
		$method = $pyjs__bind_method2('__init__', function(owner, p) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				owner = arguments[1];
				p = arguments[2];
			}

			$m['HTMLFlowPanel']['__init__'](self);
			self['owner'] = owner;
			self['add']($m['Image']('/paline/s/img/bus.png'));
			self['addAnchor']($p['sprintf']('%s %s Direz. %s', $p['tuple']([p['__getitem__']('id_linea'), p['__getitem__']('carteggio_dec'), p['__getitem__']('direzione')])), owner['onPercorsoFactory'](p['__getitem__']('id_percorso')));
			return null;
		}
	, 1, [null,null,['self'],['owner'],['p']]);
		$cls_definition['__init__'] = $method;
		var $bases = new Array($m['HTMLFlowPanel']);
		var $data = $p['dict']();
		for (var $item in $cls_definition) { $data['__setitem__']($item, $cls_definition[$item]); }
		return $p['_create_class']('PercorsoPanel', $p['tuple']($bases), $data);
	})();
	$m['OrarioPanel'] = (function(){
		var $cls_definition = new Object();
		var $method;
		$cls_definition['__module__'] = 'cerca_linea';
		$method = $pyjs__bind_method2('__init__', function(owner, o, id_percorso) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				owner = arguments[1];
				o = arguments[2];
				id_percorso = arguments[3];
			}
			var a;
			$m['HorizontalPanel']['__init__'](self);
			self['owner'] = owner;
			self['giorno'] = o['__getitem__']('giorno');
			self['orari'] = null;
			self['id_percorso'] = id_percorso;
			a = $m['MyAnchor']();
			a['setWidget']($m['HTML'](o['__getitem__']('nome')));
			a['addClickListener']($p['getattr'](self, 'onOrario'));
			self['add'](a);
			return null;
		}
	, 1, [null,null,['self'],['owner'],['o'],['id_percorso']]);
		$cls_definition['__init__'] = $method;
		$method = $pyjs__bind_method2('onOrario', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			if ($p['bool'](($p['getattr'](self, 'orari') !== null))) {
				self['remove']($p['getattr'](self, 'orari'));
				self['orari'] = null;
			}
			else {
				$m['client']['paline_orari']($p['getattr'](self, 'id_percorso'), $p['getattr'](self, 'giorno'), $m['JsonHandler']($p['getattr'](self, 'onOrarioDone')));
			}
			return null;
		}
	, 1, [null,null,['self']]);
		$cls_definition['onOrario'] = $method;
		$method = $pyjs__bind_method2('onOrarioDone', function(res) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				res = arguments[1];
			}
			var $iter3_idx,$iter3_array,m,$iter3_iter,trovato,$iter3_type,h,$iter3_nextval;
			self['orari'] = $m['VerticalPanel']();
			trovato = false;
			$iter3_iter = res['__getitem__']('orari_partenza');
			$iter3_nextval=$p['__iter_prepare']($iter3_iter,false);
			while (typeof($p['__wrapped_next']($iter3_nextval)['$nextval']) != 'undefined') {
				h = $iter3_nextval['$nextval'];
				m = h['__getitem__']('minuti');
				if ($p['bool'](($p['cmp']($p['len'](m), 0) == 1))) {
					self['orari']['add']($m['HTML']($p['sprintf']('<b>%s:</b> %s', $p['tuple']([h['__getitem__']('ora'), ' '['join'](m)]))));
					trovato = true;
				}
			}
			if ($p['bool'](!$p['bool'](trovato))) {
				if ($p['bool'](res['__getitem__']('no_orari'))) {
					self['orari']['add']($m['HTML']('Siamo spiacenti, non sono disponibili gli orari di partenza dal capolinea per il percorso selezionato.'));
				}
				else {
					self['orari']['add']($m['HTML']('Nella giornata selezionata il percorso non &egrave; attivo.'));
				}
			}
			self['add']($p['getattr'](self, 'orari'));
			return null;
		}
	, 1, [null,null,['self'],['res']]);
		$cls_definition['onOrarioDone'] = $method;
		var $bases = new Array($m['VerticalPanel']);
		var $data = $p['dict']();
		for (var $item in $cls_definition) { $data['__setitem__']($item, $cls_definition[$item]); }
		return $p['_create_class']('OrarioPanel', $p['tuple']($bases), $data);
	})();
	$m['CercaLineaPanel'] = (function(){
		var $cls_definition = new Object();
		var $method;
		$cls_definition['__module__'] = 'cerca_linea';
		$method = $pyjs__bind_method2('__init__', function(owner) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				owner = arguments[1];
			}

			$m['SimplePanel']['__init__'](self);
			$m['KeyboardHandler']['__init__'](self);
			self['owner'] = owner;
			self['map'] = null;
			self['base'] = $pyjs_kwargs_call(null, $m['VP'], null, null, [{'add_to_owner':true}, self, $p['list']([$p['dict']([['class', $m['VP']], ['style', 'indicazioni'], ['sub', $p['list']([$p['dict']([['class', $m['Label']], ['args', $p['list'](['Fermata, linea o indirizzo'])], ['style', 'indicazioni-h1'], ['height', null]]), $p['dict']([['class', $m['HP']], ['sub', $p['list']([$p['dict']([['class', $m['HP']], ['width', '70%'], ['sub', $p['list']([$p['dict']([['class', $m['TextBox']], ['name', 'query'], ['call_addKeyboardListener', $p['tuple']([$p['list']([self]), $p['dict']([])])], ['call_addFocusListener', $p['tuple']([$p['list']([self]), $p['dict']([])])]]), $p['dict']([['class', $m['HP']], ['call_setVisible', $p['tuple']([$p['list']([false]), $p['dict']([])])], ['name', 'query_list_holder'], ['sub', $p['list']([$p['dict']([['class', $m['ListBox']], ['name', 'query_list'], ['width', '100%']]), $p['dict']([['class', $m['Button']], ['args', $p['list'](['X', $p['getattr'](self, 'onChiudiQuery')])], ['width', '40px']])])]])])]]), $p['dict']([['class', $m['LoadingButton']], ['args', $p['list'](['Cerca', $p['getattr'](self, 'onCerca')])], ['width', '30%'], ['name', 'button']])])]])])]]), $p['dict']([['class', $m['SP']], ['name', 'risultati_holder'], ['sub', $p['list']([])]])])]);
			self['risultati'] = null;
			self['cl_layer'] = null;
			return null;
		}
	, 1, [null,null,['self'],['owner']]);
		$cls_definition['__init__'] = $method;
		$method = $pyjs__bind_method2('availableParams', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			return $p['list'](['query', 'id_percorso', 'cl']);
		}
	, 1, [null,null,['self']]);
		$cls_definition['availableParams'] = $method;
		$method = $pyjs__bind_method2('setParam', function(param, value) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				param = arguments[1];
				value = arguments[2];
			}

			if ($p['bool']($p['op_eq'](param, 'query'))) {
				self['base']['by_name']('query')['setText'](value);
			}
			if ($p['bool']($p['op_eq'](param, 'cl'))) {
				self['onCerca']();
			}
			if ($p['bool']($p['op_eq'](param, 'id_percorso'))) {
				self['cercaPercorso'](value);
			}
			return null;
		}
	, 1, [null,null,['self'],['param'],['value']]);
		$cls_definition['setParam'] = $method;
		$method = $pyjs__bind_method2('ripristinaWidgets', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}
			var $iter4_nextval,x_holder,$iter4_idx,$iter4_type,$iter4_array,x,$iter4_iter,x_list;
			$iter4_iter = $p['list']([self['getWidgets']()]);
			$iter4_nextval=$p['__iter_prepare']($iter4_iter,false);
			while (typeof($p['__wrapped_next']($iter4_nextval)['$nextval']) != 'undefined') {
				var $tupleassign1 = $p['__ass_unpack']($iter4_nextval['$nextval'], 3, null);
				x = $tupleassign1[0];
				x_list = $tupleassign1[1];
				x_holder = $tupleassign1[2];
				x['removeStyleName']('validation-error');
				if ($p['bool'](!$p['bool'](x['getVisible']()))) {
					x['setText'](x_list['getSelectedItemText']()['__getitem__'](0));
					x_holder['setVisible'](false);
					x['setVisible'](true);
				}
			}
			return null;
		}
	, 1, [null,null,['self']]);
		$cls_definition['ripristinaWidgets'] = $method;
		$method = $pyjs__bind_method2('onChange', function(el) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				el = arguments[1];
			}

			el['removeStyleName']('validation-error');
			return null;
		}
	, 1, [null,null,['self'],['el']]);
		$cls_definition['onChange'] = $method;
		$method = $pyjs__bind_method2('onFocus', function(text) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				text = arguments[1];
			}

			text['selectAll']();
			return null;
		}
	, 1, [null,null,['self'],['text']]);
		$cls_definition['onFocus'] = $method;
		$method = $pyjs__bind_method2('setMap', function(map) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				map = arguments[1];
			}

			self['map'] = map;
			self['map']['addRightClickOption']('Fermate vicine', $p['getattr'](self, 'onRightClick'));
			return null;
		}
	, 1, [null,null,['self'],['map']]);
		$cls_definition['setMap'] = $method;
		$method = $pyjs__bind_method2('onRightClick', function(lat, lng) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				lat = arguments[1];
				lng = arguments[2];
			}
			var query,m;
			query = self['base']['by_name']('query');
			query['setText']($p['sprintf']('punto:(%s,%s)', $p['tuple']([lat, lng])));
			self['owner']['setTabCercaLinea']();
			self['createClLayer']();
			m = $pyjs_kwargs_call(null, $m['Marker'], null, null, [{'icon_size':$p['tuple']([32, 32])}, $p['getattr'](self, 'cl_layer'), $p['tuple']([lng, lat]), '/paline/s/img/arrivo_percorso.png']);
			self['onCerca']();
			return null;
		}
	, 1, [null,null,['self'],['lat'],['lng']]);
		$cls_definition['onRightClick'] = $method;
		$method = $pyjs__bind_method2('onKeyDown', function(sender, keycode, modifiers) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				sender = arguments[1];
				keycode = arguments[2];
				modifiers = arguments[3];
			}

			if ($p['bool']($p['op_eq'](keycode, 13))) {
				self['onCerca']();
			}
			return null;
		}
	, 1, [null,null,['self'],['sender'],['keycode'],['modifiers']]);
		$cls_definition['onKeyDown'] = $method;
		$method = $pyjs__bind_method2('onPercorsoFactory', function(id_percorso) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				id_percorso = arguments[1];
			}
			var onPercorso;
			onPercorso = function(source) {

				self['cercaPercorso'](id_percorso);
				return null;
			};
			onPercorso['__name__'] = 'onPercorso';

			onPercorso['__bind_type__'] = 0;
			onPercorso['__args__'] = [null,null,['source']];
			return onPercorso;
		}
	, 1, [null,null,['self'],['id_percorso']]);
		$cls_definition['onPercorsoFactory'] = $method;
		$method = $pyjs__bind_method2('onLineaFactory', function(id_linea) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				id_linea = arguments[1];
			}
			var onLinea;
			onLinea = function(source) {

				self['cercaLinea'](id_linea);
				return null;
			};
			onLinea['__name__'] = 'onLinea';

			onLinea['__bind_type__'] = 0;
			onLinea['__args__'] = [null,null,['source']];
			return onLinea;
		}
	, 1, [null,null,['self'],['id_linea']]);
		$cls_definition['onLineaFactory'] = $method;
		$method = $pyjs__bind_method2('onPalinaFactory', function(id_palina) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				id_palina = arguments[1];
			}
			var onPalina;
			onPalina = function(source) {

				self['palinaSuMappa'](id_palina);
				return null;
			};
			onPalina['__name__'] = 'onPalina';

			onPalina['__bind_type__'] = 0;
			onPalina['__args__'] = [null,null,['source']];
			return onPalina;
		}
	, 1, [null,null,['self'],['id_palina']]);
		$cls_definition['onPalinaFactory'] = $method;
		$method = $pyjs__bind_method2('onMostraTuttePaline', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}
			var $iter5_nextval,$iter5_idx,p,$iter5_iter,$iter5_array,$iter5_type;
			$iter5_iter = $p['getattr'](self, 'paline_nascoste');
			$iter5_nextval=$p['__iter_prepare']($iter5_iter,false);
			while (typeof($p['__wrapped_next']($iter5_nextval)['$nextval']) != 'undefined') {
				p = $iter5_nextval['$nextval'];
				p['mostra']();
			}
			self['mostra_tutto']['setVisible'](false);
			return null;
		}
	, 1, [null,null,['self']]);
		$cls_definition['onMostraTuttePaline'] = $method;
		$method = $pyjs__bind_method2('createClLayer', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			self['owner']['setTabCercaLinea']();
			if ($p['bool'](($p['getattr'](self, 'cl_layer') !== null))) {
				self['cl_layer']['destroy']();
			}
			self['map']['hideAllLayers']();
			self['cl_layer'] = $m['Layer']('cp_layer', 'Fermate trovate', $p['getattr'](self, 'map'));
			return null;
		}
	, 1, [null,null,['self']]);
		$cls_definition['createClLayer'] = $method;
		$method = $pyjs__bind_method2('palinaSuMappa', function(id_palina) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				id_palina = arguments[1];
			}

			self['map']['loadNewLayer'](id_palina, 'palina-singola', id_palina);
			return null;
		}
	, 1, [null,null,['self'],['id_palina']]);
		$cls_definition['palinaSuMappa'] = $method;
		$method = $pyjs__bind_method2('cercaLinea', function(query) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				query = arguments[1];
			}

			self['base']['by_name']('button')['start']();
			$m['client']['paline_smart_search'](query, $m['JsonHandler']($p['getattr'](self, 'onCercaDone')));
			return null;
		}
	, 1, [null,null,['self'],['query']]);
		$cls_definition['cercaLinea'] = $method;
		$method = $pyjs__bind_method2('onCerca', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}

			self['ripristinaWidgets']();
			self['cercaLinea'](self['base']['by_name']('query')['getText']());
			return null;
		}
	, 1, [null,null,['self']]);
		$cls_definition['onCerca'] = $method;
		$method = $pyjs__bind_method2('cercaPercorso', function(id_percorso) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				id_percorso = arguments[1];
			}

			$m['client']['paline_percorso_fermate'](id_percorso, $m['JsonHandler']($p['getattr'](self, 'onCercaPercorsoDone')));
			self['map']['loadNewLayer'](id_percorso, 'percorso', id_percorso);
			return null;
		}
	, 1, [null,null,['self'],['id_percorso']]);
		$cls_definition['cercaPercorso'] = $method;
		$method = $pyjs__bind_method2('onCercaPercorsoDone', function(res) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				res = arguments[1];
			}
			var $iter6_type,paline,$iter6_iter,$iter6_nextval,risultati_holder,$iter7_type,$iter6_idx,$iter7_iter,$iter6_array,$iter7_idx,orari,img,$iter7_nextval,i,$iter7_array,o,n,$add2,p,$add1;
			risultati_holder = self['base']['by_name']('risultati_holder');
			if ($p['bool'](($p['getattr'](self, 'risultati') !== null))) {
				risultati_holder['remove']($p['getattr'](self, 'risultati'));
			}
			self['risultati'] = $pyjs_kwargs_call(null, $m['DP'], null, null, [{'title':'Risultati', 'style':'indicazioni'}, null, $p['list']([$p['dict']([['class', $m['VP']], ['style', 'indicazioni'], ['name', 'dettaglio'], ['sub', $p['list']([$p['dict']([['class', $m['Label']], ['args', $p['list'](['Partenze da capolinea'])], ['style', 'indicazioni-h1'], ['height', null]]), $p['dict']([['class', $m['VP']], ['name', 'orari'], ['sub', $p['list']([])]]), $p['dict']([['class', $m['Label']], ['args', $p['list'](['Fermate'])], ['style', 'indicazioni-h1'], ['height', null]]), $p['dict']([['class', $m['VP']], ['name', 'paline'], ['sub', $p['list']([])]])])]])])]);
			risultati_holder['add']($p['getattr'](self, 'risultati'));
			orari = self['risultati']['by_name']('orari');
			$iter6_iter = res['__getitem__']('giorni');
			$iter6_nextval=$p['__iter_prepare']($iter6_iter,false);
			while (typeof($p['__wrapped_next']($iter6_nextval)['$nextval']) != 'undefined') {
				o = $iter6_nextval['$nextval'];
				orari['add']($m['OrarioPanel'](self, o, res['__getitem__']('id_percorso')));
			}
			paline = self['risultati']['by_name']('paline');
			n = $p['len'](res['__getitem__']('paline'));
			i = 0;
			$iter7_iter = res['__getitem__']('paline');
			$iter7_nextval=$p['__iter_prepare']($iter7_iter,false);
			while (typeof($p['__wrapped_next']($iter7_nextval)['$nextval']) != 'undefined') {
				p = $iter7_nextval['$nextval'];
				i = $p['__op_add']($add1=i,$add2=1);
				img = $p['sprintf']('/paline/s/img/%s_arrow.gif', ($p['bool'](($p['cmp'](i, n) == -1))? ('down') : ('stop')));
				paline['add']($m['PalinaSmallPanel'](self, p, img));
			}
			return null;
		}
	, 1, [null,null,['self'],['res']]);
		$cls_definition['onCercaPercorsoDone'] = $method;
		$method = $pyjs__bind_method2('onCercaErrore', function(el) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				el = arguments[1];
			}
			var $iter8_idx,i,$iter8_array,x_holder,$iter8_iter,$iter8_nextval,$iter8_type,x,x_list;
			var $tupleassign2 = $p['__ass_unpack'](self['getWidgets'](), 3, null);
			x = $tupleassign2[0];
			x_list = $tupleassign2[1];
			x_holder = $tupleassign2[2];
			if ($p['bool']($p['op_eq'](el['__getitem__']('tipo'), 'Indirizzo ambiguo'))) {
				x['setVisible'](false);
				x_holder['setVisible'](true);
				x_list['addStyleName']('validation-error');
				x_list['clear']();
				$iter8_iter = el['__getitem__']('indirizzi');
				$iter8_nextval=$p['__iter_prepare']($iter8_iter,false);
				while (typeof($p['__wrapped_next']($iter8_nextval)['$nextval']) != 'undefined') {
					i = $iter8_nextval['$nextval'];
					x_list['addItem'](i);
				}
			}
			else {
				x['addStyleName']('validation-error');
			}
			return null;
		}
	, 1, [null,null,['self'],['el']]);
		$cls_definition['onCercaErrore'] = $method;
		$method = $pyjs__bind_method2('getWidgets', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}
			var x,x_list,x_holder;
			x = self['base']['by_name']('query');
			x_list = self['base']['by_name']('query_list');
			x_holder = self['base']['by_name']('query_list_holder');
			return $p['tuple']([x, x_list, x_holder]);
		}
	, 1, [null,null,['self']]);
		$cls_definition['getWidgets'] = $method;
		$method = $pyjs__bind_method2('onChiudiQuery', function() {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
			}
			var x,x_list,x_holder;
			var $tupleassign3 = $p['__ass_unpack'](self['getWidgets'](), 3, null);
			x = $tupleassign3[0];
			x_list = $tupleassign3[1];
			x_holder = $tupleassign3[2];
			x_holder['setVisible'](false);
			x['setVisible'](true);
			return null;
		}
	, 1, [null,null,['self']]);
		$cls_definition['onChiudiQuery'] = $method;
		$method = $pyjs__bind_method2('onCercaDone', function(res) {
			if (this['__is_instance__'] === true) {
				var self = this;
			} else {
				var self = arguments[0];
				res = arguments[1];
			}
			var $iter10_nextval,palina,$iter10_iter,risultati_holder,$iter9_iter,$iter9_nextval,$iter9_idx,$iter11_idx,$iter9_type,$or1,$or2,$iter11_iter,$iter10_idx,dettaglio,$iter11_array,$iter11_nextval,percorso,tipo,h,$iter11_type,m,$iter10_array,p,$iter10_type,$iter9_array;
			self['base']['by_name']('button')['stop']();
			risultati_holder = self['base']['by_name']('risultati_holder');
			if ($p['bool'](($p['getattr'](self, 'risultati') !== null))) {
				risultati_holder['remove']($p['getattr'](self, 'risultati'));
			}
			if ($p['bool'](res['__getitem__']('errore'))) {
				self['onCercaErrore'](res);
				return null;
			}
			tipo = res['__getitem__']('tipo');
			if ($p['bool']($p['op_eq'](tipo, 'Palina'))) {
				self['palinaSuMappa'](res['__getitem__']('id_palina'));
				return null;
			}
			else if ($p['bool']($p['op_eq'](tipo, 'Indirizzo ambiguo'))) {
				self['onCercaErrore'](res);
			}
			self['risultati'] = $pyjs_kwargs_call(null, $m['DP'], null, null, [{'title':'Risultati', 'style':'indicazioni'}, null, $p['list']([$p['dict']([['class', $m['VP']], ['style', 'indicazioni'], ['name', 'dettaglio'], ['sub', $p['list']([])]])])]);
			self['map']['hideAllLayers']();
			self['risultati']['setOpen'](true);
			dettaglio = self['risultati']['by_name']('dettaglio');
			risultati_holder['add']($p['getattr'](self, 'risultati'));
			self['paline_nascoste'] = $p['list']([]);
			if ($p['bool'](($p['bool']($or1=($p['cmp']($p['len'](res['__getitem__']('paline_extra')), 0) == 1))?$or1:($p['cmp']($p['len'](res['__getitem__']('paline_semplice')), 0) == 1)))) {
				h = $m['HTML']('Fermate trovate');
				h['addStyleName']('indicazioni-h1');
				dettaglio['add'](h);
			}
			$iter9_iter = res['__getitem__']('paline_semplice');
			$iter9_nextval=$p['__iter_prepare']($iter9_iter,false);
			while (typeof($p['__wrapped_next']($iter9_nextval)['$nextval']) != 'undefined') {
				p = $iter9_nextval['$nextval'];
				$m['prnt'](p);
				palina = $m['PalinaPanel'](self, p);
				dettaglio['add'](palina);
				if ($p['bool']($p['getattr'](palina, 'nascosta'))) {
					self['paline_nascoste']['append'](palina);
				}
			}
			if ($p['bool'](($p['cmp']($p['len'](res['__getitem__']('paline_extra')), 0) == 1))) {
				self['createClLayer']();
			}
			$iter10_iter = res['__getitem__']('paline_extra');
			$iter10_nextval=$p['__iter_prepare']($iter10_iter,false);
			while (typeof($p['__wrapped_next']($iter10_nextval)['$nextval']) != 'undefined') {
				p = $iter10_nextval['$nextval'];
				palina = $m['PalinaPanel'](self, p);
				dettaglio['add'](palina);
				if ($p['bool']($p['getattr'](palina, 'nascosta'))) {
					self['paline_nascoste']['append'](palina);
				}
				else {
					if ($p['bool'](p['__contains__']('lng'))) {
						m = $pyjs_kwargs_call(null, $m['Marker'], null, null, [{'icon_size':$p['tuple']([16, 16]), 'anchor':$p['tuple']([8, 8]), 'name':$p['tuple'](['palina', $p['tuple']([p['__getitem__']('id_palina'), ''])]), '$$label':p['__getitem__']('nome'), 'infobox':p['__getitem__']('nome')}, $p['getattr'](self, 'cl_layer'), $p['tuple']([p['__getitem__']('lng'), p['__getitem__']('lat')]), '/paline/s/img/partenza.png']);
					}
				}
				self['cl_layer']['centerOnMap']();
			}
			if ($p['bool'](($p['cmp']($p['len'](res['__getitem__']('percorsi')), 0) == 1))) {
				h = $m['HTML']('Linee trovate');
				h['addStyleName']('indicazioni-h1');
				dettaglio['add'](h);
			}
			$iter11_iter = res['__getitem__']('percorsi');
			$iter11_nextval=$p['__iter_prepare']($iter11_iter,false);
			while (typeof($p['__wrapped_next']($iter11_nextval)['$nextval']) != 'undefined') {
				p = $iter11_nextval['$nextval'];
				percorso = $m['PercorsoPanel'](self, p);
				dettaglio['add'](percorso);
			}
			if ($p['bool'](($p['cmp']($p['len']($p['getattr'](self, 'paline_nascoste')), 0) == 1))) {
				self['mostra_tutto'] = $m['HTMLFlowPanel']();
				dettaglio['add']($p['getattr'](self, 'mostra_tutto'));
				self['mostra_tutto']['addHtml']('Alcune fermate sono state nascoste perch&eacute; non vi transitano altre linee bus.&nbsp');
				self['mostra_tutto']['addAnchor']('Mostra tutte le fermate', $p['getattr'](self, 'onMostraTuttePaline'));
			}
			if ($p['bool'](res['__contains__']('lng'))) {
				m = $pyjs_kwargs_call(null, $m['Marker'], null, null, [{'icon_size':$p['tuple']([32, 32]), 'drop_callback':$p['getattr'](self, 'onRightClick')}, $p['getattr'](self, 'cl_layer'), $p['tuple']([res['__getitem__']('lng'), res['__getitem__']('lat')]), '/paline/s/img/partenza_percorso.png']);
			}
			return null;
		}
	, 1, [null,null,['self'],['res']]);
		$cls_definition['onCercaDone'] = $method;
		var $bases = new Array($m['SimplePanel'],$m['KeyboardHandler'],$m['FocusHandler']);
		var $data = $p['dict']();
		for (var $item in $cls_definition) { $data['__setitem__']($item, $cls_definition[$item]); }
		return $p['_create_class']('CercaLineaPanel', $p['tuple']($bases), $data);
	})();
	return this;
}; /* end cerca_linea */


/* end module: cerca_linea */


/*
PYJS_DEPS: ['pyjamas.ui.RootPanel.RootPanel', 'pyjamas', 'pyjamas.ui', 'pyjamas.ui.RootPanel', 'pyjamas.ui.VerticalPanel.VerticalPanel', 'pyjamas.ui.VerticalPanel', 'pyjamas.ui.HorizontalPanel.HorizontalPanel', 'pyjamas.ui.HorizontalPanel', 'pyjamas.ui.VerticalSplitPanel.VerticalSplitPanel', 'pyjamas.ui.VerticalSplitPanel', 'pyjamas.ui.SimplePanel.SimplePanel', 'pyjamas.ui.SimplePanel', 'pyjamas.ui.FlowPanel.FlowPanel', 'pyjamas.ui.FlowPanel', 'pyjamas.ui.DisclosurePanel.DisclosurePanel', 'pyjamas.ui.DisclosurePanel', 'pyjamas.ui.TabPanel.TabPanel', 'pyjamas.ui.TabPanel', 'pyjamas.ui.Grid.Grid', 'pyjamas.ui.Grid', 'pyjamas.ui.Frame.Frame', 'pyjamas.ui.Frame', 'pyjamas.ui.TextBox.TextBox', 'pyjamas.ui.TextBox', 'pyjamas.ui.TextArea.TextArea', 'pyjamas.ui.TextArea', 'pyjamas.ui.HTML.HTML', 'pyjamas.ui.HTML', 'pyjamas.ui.HTMLPanel.HTMLPanel', 'pyjamas.ui.HTMLPanel', 'pyjamas.ui.Anchor.Anchor', 'pyjamas.ui.Anchor', 'pyjamas.ui.Label.Label', 'pyjamas.ui.Label', 'pyjamas.ui.CheckBox.CheckBox', 'pyjamas.ui.CheckBox', 'pyjamas.ui.ListBox.ListBox', 'pyjamas.ui.ListBox', 'pyjamas.ui.Button.Button', 'pyjamas.ui.Button', 'pyjamas.ui.RadioButton.RadioButton', 'pyjamas.ui.RadioButton', 'pyjamas.ui.PopupPanel.PopupPanel', 'pyjamas.ui.PopupPanel', 'pyjamas.ui.KeyboardListener.KeyboardHandler', 'pyjamas.ui.KeyboardListener', 'pyjamas.ui.FocusListener.FocusHandler', 'pyjamas.ui.FocusListener', 'pyjamas.ui.Tree.Tree', 'pyjamas.ui.Tree', 'pyjamas.ui.Tree.TreeItem', 'pyjamas.ui.Image.Image', 'pyjamas.ui.Image', 'pyjamas.ui.HasAlignment', 'pyjamas.ui.MenuBar.MenuBar', 'pyjamas.ui.MenuBar', 'pyjamas.ui.MenuItem.MenuItem', 'pyjamas.ui.MenuItem', 'pyjamas.ui.Widget.Widget', 'pyjamas.ui.Widget', 'pyjamas.ui.Hyperlink.Hyperlink', 'pyjamas.ui.Hyperlink', 'pyjamas.Window', 'pyjamas.Timer.Timer', 'pyjamas.Timer', 'pyjamas.JSONService.JSONProxy', 'pyjamas.JSONService', 'pyjamas.History', 'pyjamas.DOM', 'prnt.prnt', 'prnt', 'util.StyledFixedColumnFlexTable', 'util', 'util.HTMLFlowPanel', 'util.DP', 'util.VP', 'util.HP', 'util.GP', 'util.SP', 'util.get_checked_radio', 'util.HidingPanel', 'util.ValidationErrorRemover', 'util.MyAnchor', 'util.LoadingButton', 'datetime.date', 'datetime', 'datetime.time', 'datetime.datetime', 'datetime.timedelta', 'Calendar.Calendar', 'Calendar', 'Calendar.DateField', 'Calendar.TimeField', 'map.MapPanel', 'map', 'map.Layer', 'map.LayerPanel', 'map.Marker', 'DissolvingPopup.DissolvingPopup', 'DissolvingPopup', 'util.JsonHandler', 'util.redirect']
*/
