dojo.addOnLoad(function(){
	init();
});
//mghSearch.js
/********************************** Initialize *****************************************/
	
	var config = {
		az			: 'all',
		age			: '',
		cat 		: '',		
		subcat		: '',
		type		: '',
		links		: 7,
		query		: '',
		numPerPage 	: 50,
		href 		: '/assets/processing/xmlProxy.aspx',
		search		: 'conditions'
	};
	var mySearch;
	
	var catConfig = {
		az			: '',
		age			: '',
		cat 		: '65',		
		subcat		: '',
		type		: '',
		links		: 7,
		query		: '',
		catTitle	: 'Medical Categories',		
		numPerPage 	: 50,
		href 		: '/assets/processing/xmlProxy.aspx',
		search		: 'conditions'
	};
	var myCategories;
	
	var subCatConfig = {
		az		: '',
		age		: '',
		cat 	: '',		
		subcat	: '',
		type	: '',
		links	: 7,
		query	: '',		
		href 	: '/assets/processing/xmlProxy.aspx',
		search	: 'conditions'
	};
	var mySubCategories;	
	var qs;	
	var cat;
	var catName;
	
	init = function(){
		//window.scroll(0,0);
		//var myQs = new com.mgh.FacetedSearchQueryString(config,'conditions');
		//config = myQs.setParameters();
		cat = '';
		catName = '';
		
		try {
			qs = new com.mgh.QueryString(null);
			cat = qs.get('cat').replace('#','');
			catName = qs.get('catName').replace('#','');
			config.cat = cat;
			catConfig.cat = cat;
			subCatConfig.cat = cat;
		} catch (e) {
			console.log(e);	
		}
		dojo.byId('keyWord').value = '';
		mySearch = new com.mgh.Search(config);
		myCategories = new com.mgh.Categories(catConfig);
		myCategories.buildFilter1();		
		mySubCategories = new com.mgh.SubCategories(subCatConfig);
		
		registerEvents();
	}