
	var ms = Array();  // metro ids array to send before showing popup
	var ds = Array();  // district ids, the same

	function loadMDPanel(mIDs, dIDs){	
		sendMVal = "";
		sendDVal = "";
		
		for(i=0; i<mIDs.length; i++) sendMVal += mIDs[i]+",";
		for(i=0; i<dIDs.length; i++) sendDVal += dIDs[i]+",";	
			
		document.getElementById("md_popup_bg").style.display = "block";
		document.getElementById("md_popup").style.display = "block";
		var so = new SWFObject("panel.swf", "mdpanel", "961", "640", "8", "white");
		so.addParam("wmode", "transparent");
		so.addParam("allowScriptAccess", "always");
		so.addVariable("dInput", sendDVal);
		so.addVariable("mInput", sendMVal);
		so.write("mdmap");
	}

	function closeMDPanel(newMS, newDS, saveData){	
		if (saveData){
			ms = newMS;    // update metro ids on APPLY btn
			ds = newDS;		 // update districts on APPLY btn
			updateRegionsAndMetroIDS(newMS, newDS);
		}	
		
		// just close da fakin panel on CLOSE btn
		document.getElementById("mdmap").innerHTML = "";
		document.getElementById("md_popup").style.display = "none";
		document.getElementById("md_popup_bg").style.display = "none";
	}
	
