﻿$(document).bind("MRM-ADD-CONTROL-BINDINGS", function () {
	var util = mrm.global.utilities;
	/*
	-----------------------------
	Register the Search Criteria Class
	-----------------------------
	*/
	mrm.cms.display.quickSearch = new mrm.cms.display.QuickSearch();

	/*
	-----------------------------
	Register control classes
	-----------------------------
	*/

	if (mrm.global.isClassDefined("mrm.lib.ui.controls.DynamicLookupList")) {
		util.defaultControlBinder.addControlBinder(new mrm.donnellyGroup.lib.ui.controls.DynamicLookupList(util.tracing, { "BINDER_NAME": "DefaultDynamicLookupList", "URL_HANDLER_PAGE": "cta.ashx?max=10&cf=5,6&" }));
	}

	if (mrm.global.isClassDefined("mrm.lib.ui.controls.HtmlList")) {		
		util.defaultControlBinder.addControlBinder(new mrm.lib.ui.controls.HtmlList(util.tracing, { "SELECTOR_CONTROL": "div.htmllist-container", "CLOSE_ACTION": "ACTION_CLICK_OUTSIDE" }));
	}


	/*
	----------------------------
	Add control bindings
	----------------------------
	*/
	//Temporary solution for postoce until DB updated for ROI postcodes.
	/*util.defaultControlBinder.addControlBinding(
		{
			"name": "Postcode Lookup",
			"binderName": "DefaultDynamicLookupList",
			"selector": ".mp-form-search .postcode",
			"instanceId": "QuickSearchLocationLookup"
		}
	);*/
	util.defaultControlBinder.addControlBinding(
		{
			"name": "HtmlList",
			"binderName": "HtmlList",
			"selector": ".mp-form-search .htmllist-container",
			"instanceId": "HtmlList"
		}
	);

});
