﻿Ext.BLANK_IMAGE_URL = 'ext-2.1/resources/images/default/s.gif';
try { console.log(''); } catch(e) { console = { log: function(s) {} } }

Ext.onReady(function() {
		
		//create blank form
		var searchForm = new Ext.Mapper.SearchForm({ id : 'searchForm'});
		
		var fsSubjects = Ext.getCmp('form-fs-subjects')
		var fsAuthors = Ext.getCmp('form-fs-authors')
		var fsOrgs = Ext.getCmp('form-fs-orgs');
		var fsPublications = Ext.getCmp('form-fs-publications');
		var fsCountries = Ext.getCmp('form-fs-countries');
		/* Added by Rajat*/
		var fsPublishers = Ext.getCmp('form-fs-publishers');
		
		//add blank fields
		var hide = [];
		fsSubjects.addComboBox(); hide.push(fsSubjects);
		fsAuthors.addComboBox(); hide.push(fsAuthors);
		fsOrgs.addComboBox(); hide.push(fsOrgs);
		fsPublications.addComboBox(); hide.push(fsPublications);
		fsCountries.addComboBox(); hide.push(fsCountries);
		/* Added by Rajat*/
		fsPublishers.addComboBox(); hide.push(fsPublishers);
		
		hide.push(Ext.getCmp("form-fs-dates"));
		hide.push(Ext.getCmp('form-openaccess'));
		
		//render form first, then hide blank fields
		searchForm.render('search-form');
		Ext.each(hide, function(o) { o.hide(); });

		Ext.get('form-search').addKeyListener(Ext.EventObject.ENTER, function(key, e) {
			e.preventDefault();
			Ext.getCmp('btnSearch').handler();
		});

		//load map
		GMapEventHandler.load('');
		
		//scroll timeline to end for no good reason
		var timeline = Ext.get("year-facet-container");
		if (timeline) timeline.scroll("l", 9999, false);
		
		var key = Ext.get("map-key");
		key.on({
			'mouseover' : {	fn : function() { Ext.get('map-keyinfo').show(); } },
			'mouseout' : {	fn : function() { Ext.get('map-keyinfo').hide(); } }
		});
		
		var resizeMap = new Ext.Resizable("map-resize", {
			wrap: false,
			handles: 's',
			width : 678,
			maxWidth: 678,
			minHeight: 6,
			maxHeight: 500,
			pinned: true
		});
		
});



