function UnicefMap() {
	
	this.id;
	this.self;
	
	this.width;
	this.height;

	// Sub Class References
	this.markerEvents;
	this.markerData;
	
	this.mapMarkers = [];
	
	this.progress = document.getElementById("progress-bar");
	
	// TEMP
	
	this.prev = "";
		
	// Marker Icon Array
	// [0]	GIcon Object
	// [1]	Icon Name
		
	this.markerIcons;
	
	// Default Map Center
	this.defaultMapLat = "21.94304553343818";
	this.defaultMapLng = "22.03125";
	this.defaultMapZoom = 2;
	
     this.defaultMapCenter = new GLatLng(this.defaultMapLat,this.defaultMapLng);
    
     this.defaultCategory = '1001';
     this.currentCategory = '';
     
     this.startPointMarker = 1;
    
     this.markerQueue;
    
	this.init = function () {
		this.markerIcons = 	[	[new GIcon(),"red"],
								[new GIcon(),"green"],
								[new GIcon(),"blue"]
							];
	
	
		// Be sure to set the _HTMLID variable on the container page
		if (_HTMLID)	{ this.id = _HTMLID;	};
	
		if (GBrowserIsCompatible()) {
			this.self = new GMap2(document.getElementById(this.id));
			
			this.self.addControl(new GLargeMapControl());
			this.self.addControl(new GMapTypeControl());
			
			this.self.setCenter(this.defaultMapCenter, this.defaultMapZoom);
			
			this.setMarkerIconProperties();
			
			this.markerData = new UnicefMapData(this);
			this.markerEvents = new UnicefMapEvents(this, this.markerData);
			
			this.self.classRef = this;
			
			GEvent.bind(this.self, "click", this.markerEvents, this.markerEvents.mapClick);
			GEvent.bind(this.self, "addoverlay", this.markerEvents, this.markerEvents.add);
			
			if (this.startPoint.length > 0) {
				this.swapCategory(this.startPoint[0]);
			}
			else {
				this.swapCategory(this.defaultCategory);				
			}
		}
		else	{
			
			this.showBrowserIncompatibilityMessage();
		}
	}
	
	this.indicateProgress = function (toggle)	{
      //this.progress.style.visibility = toggle;
	   if ( ! this.progress.style.visibility ) {
		   this.progress.style.visibility = toggle;
	   }
	}
	
	this.swapCategory = function (cat)	{
		this.currentCategory = cat;
		
		setTimeout('uni_map.indicateProgress(\'"visible"\')',2000);
	
		this.markerData.getZones(cat);
		
		this.changeTab(cat);
	}
	
	this.changeTab = function (cat) {
		items = document.getElementById("navTabs");
		nodes = items.childNodes;
		
		for (var i=0;i<nodes.length;i++) {
			if (nodes[i].nodeName == "LI") {
				cur_id = nodes[i].attributes['id'].value;
				
				if (cur_id == cat) {
					nodes[i].childNodes[0].className = 'selected';
				}
				else {
					nodes[i].childNodes[0].className = '';
				}
			}
		}
	}
	
	this.debugPrint = function (msg) {
		msgwin = document.getElementById("debug");
		
		msgwin.innerHTML += msg + '<br />';
	
	}
	
	this.setMarkerData = function (markers)	{
		this.self.setCenter(this.defaultMapCenter, this.defaultMapZoom);
		this.self.clearOverlays();
		
		this.markerQueue = markers;
		
		this.addMarkers(this.startPoint);
		
		var sp = this.startPoint;
		if (sp.length > 0) {
			this.showArticleDetail(sp[2],sp[1]);
			//this.startPoint = [];
		}
	}
	
	this.zoomToRegion = function (region) {
		this.markerEvents.closeInfoWindow();
	
		var region_data = REGIONS[region];
	
		this.self.setCenter(region_data[0], region_data[1]);
	}
	
	this.addMarkers = function (startPoint) {
		if (this.markerQueue.length) {
			var mrkr = this.markerQueue.pop();
		
			var id = mrkr[0];
			var geo = mrkr[1];
						
			//var gmkrOpts = new GMarkerOptions();
			var gmkr = new GMarker(geo);
			
			if (startPoint) {
				this.startPointMarker = gmkr;
			}
			
			gmkr.uid = id;
			gmkr.classRef = this;
			
			GEvent.addListener(gmkr, "click", this.markerEvents.click);
						
			this.self.addOverlay(gmkr);
		}
		else {
			this.indicateProgress("hidden");
		}
	}
	
	this.getMarkerIcon = function (type)	{
		return this.markerIcons[1];
	}
	
	this.showArticleDetail = function (id,zone) 	{
		this.self.setZoom(4);
		
		setTimeout('uni_map.indicateProgress(\'"visible"\')',2000);
	
		this.markerData.getArticleByID(id,zone);
	}
	
	this.showArticleList = function (zone) 	{
		this.self.setZoom(3);
		
		setTimeout('uni_map.indicateProgress(\'"visible"\')',2000);
		
		this.markerData.getArticleListByID(zone);
	}
	
	this.updateCurrentWindow = function (html,zoom)	{
		
		this.uni_map.indicateProgress("hidden");

		var opts = {'noCloseOnClick':true};
		if (this.uni_map.markerEvents.currentlyOpenInfoWindow) {
			var window = this.uni_map.markerEvents.currentlyOpenInfoWindow;
			window.openInfoWindowHtml(html,opts);
		}
		else {
			this.uni_map.startPointMarker.openInfoWindowHtml(html,opts);
		}
	}
	
	// Pos [lat, lng]
	// Icon "red", "green", "blue"
	
	this.getMarkerObj = function (pos, icon)	{
		var point = new GLatLng();
	}
	
	this.setMarkerIconProperties = function ()	{
		
		// Set Marker Icon Properties Here
	
		var icons = this.markerIcons;
	
		// Marker Icons in Image Directory Named By Marker Name (i.e. "red.png", "blue.png")
		var imagePath = "images/markers/";
		var iconShadow = imagePath + "shadow.png"
		
		var iconSize = [20,34];
		var shadowSize = [37,34];
		var iconAnchor = [10,34];
		var iwAnchor = [10,1]; 		// Info Window Anchor
		
		for (var i = 0; i < icons; i++) {
		
			var icon = icons[i][0];
			
			icon.image = imagePath + icons[i][1] + ".png";
			icon.shadow = iconShadow;
			
			icon.iconSize = new GSize(iconSize[0],	iconSize[1]);
			icon.shadowSize = new GSize(shadowSize[0],	shadowSize[1]);
			
			icon.iconAnchor = new GPoint(iconAnchor[0],	iconAnchor[1]);
			icon.infoWindowAnchor = new GPoint(iwAnchor[0],	iwAnchor[1]);
		}
	}
	
	this.showBrowserIncompatibilityMessage = function () {
	
		// This needs some elaboration
		alert('Sorry, your browser is not compatible with this feature.')
	}
}



//]]>

