// Copyright (C) 2008 Robert W. Clarke Consulting, all rights reserved.// do not remove this copyright noticefunction makeXML(yi,type){ // called by buildFrames function during system init	// this function generates the xml to configure the map based one year and type	var year = ary_years[yi];	var key, xml_state, re, color, val;	var xml_state_tmpl = '<state id="_ID_" ncolor="_COLOR_" rcolor="_COLOR_" action="javascript:selectState(\'_ID_\')" />';		// start the xml	var xml = '<?xml version="1.0" encoding="iso-8859-1" ?><MT1022>'; // start the xml	xml += '<global state_initials="on" state_name="off" action_target="_self" />';		for(key in ary_state){		xml_state = xml_state_tmpl; // set to state template xml		// perform replacements		re = /_ID_/g;		xml_state = xml_state.replace(re,key); // replace id		// make color selection		if(type == 'tpop'){			val = ary_popdat[key][year];		}		if(type == 'dpop'){ // type is deltapop, the change in population			var prev_year = ary_years[yi-1];			val = ary_popdat[key][year]-ary_popdat[key][prev_year]		}		if((type == 'dpop')&&(yi == 0)){			// no change data for year 1960 (0)			color = "FFFFFF";		} else {			color = getColorCode(type,val);		}		re = /_COLOR_/g;		xml_state = xml_state.replace(re,color); // replace color		xml += xml_state; // append xml	}		xml += '</MT1022>'; // finish xml	return xml;}function sendXML(xml){	// this function sends the xml to the map	// the map receives the xml and configures itself automatically	if(window.maptron){		window.document["maptron"].SetVariable("jxml", xml);	}	if(document.maptron){		document.maptron.SetVariable("jxml", xml);	}}