// file: BrowseMapEnhanced.js
// author: Matthew Lawhead
// purpose: map to browse projects entered into the Conservation Registry
// namespace: TOF (The Other Firm)
// application: ConsRegistry (Conservation Registry)
//
// usage: var browseMap = TOF.ConsRegistry.BrowseMapEnhanced.init(map, portal);
// depends on: BrowseMap.js

TOF.ConsRegistry.BrowseMapEnhanced = function(){

  function init(mapDivId, portal){
		var browseMap = new BrowseMap(mapDivId, portal, 'browse');
		
		var portal_mode = false;
		
		if(portal == "NCED"){
			portal_mode = true;
			var cbox = $$('input[name="All Project Sites"]').first();
			cbox.observe('click', function(){
				browseMap.togglePortalMode();
				if(cbox.checked){
					// to keep portal sites on top; portalSites is a global variable...
					browseMap.map.removeOverlay(portalSites);
					browseMap.map.addOverlay(portalSites); 
				}
			});
		}	

		browseMap.initEvents(portal_mode);
		
		return browseMap;
  }

	return {init:init};
}();



