
var locs = new Array();
// params are: (this should be an assoc array)
//    0 - point marker letter
//    1 - lat
//    2 - long
//    3 - marker url
//    4 - point title
//    5 - point address
//    6 - person title
//    7 - person thumbnail
//    8 - full case link
//    9 - description


// Persecution markers
locs.push(["A",39.743098,116.376801, "http://www.google.com/mapfiles/markerA.png",
	"Chongwen District Detention Center", 
	"937 Luzhi 1 Shangxing (Nanlishilu \u2013 Xingminghu Dujiacun), 937 Luzhi 1 Xiaxing (Xingminghu Dujiacun \u2013 Nanlishilu)",
	"Ms. Xu Na, 40-year old artist, widow of popular musician Yu Zhou",
	"xuna-tn.jpg",
	"/article/756/",
	"Currently detained, awaiting trial, " +
		"Ms. Xu Na was also detained at the Beijing Women's Prison " +
		"from 2001 to 2006, during which she was reportedly placed " +
		"in solitary confinement, deprived of sleep, and tied up with " +
		"ropes in painful positions for extended periods" ]);
locs.push(["B",40.005791,116.328049, "http://www.google.com/mapfiles/markerB.png",
	"Tsinghua University dorms",
	"1 Qinghuayuan, Haidian District",
	"Ms. Yao Yue, 36-year old graduate student",
	"yaoyue-tn.jpg",
	"/article/758/",
	"Former residence prior to 12-year sentence for sending emails about Falun Gong" ]);
locs.push(["C",39.999216,116.333199, "http://www.google.com/mapfiles/markerC.png",
	"Zhongguancun Secondary School",
	"Haidian District, Beijing",
	"Ms. Li Shuying, 64-year-old retired physics teacher",
	"lishuying-tn.jpg",
	"/article/759/",
	"Currently imprisoned in Beijing Women's Labor Camp" ]);
locs.push(["D",39.957122,116.302643, "http://www.google.com/mapfiles/markerD.png",
	"Qinghe Emergency Center (hospital)",
	"Changchunqiaolu, Haidian District",
	"Mr. Yu Zhou, 42-year-old musician",
	"yuzhou-tn.jpg",
	"/article/755/",
	"Died from police abuse and body brought here, family's request for autopsy denied"]);
locs.push(["E",39.951727,116.417828, "http://www.google.com/mapfiles/markerE.png",
	"Beijing Office of the Asia Foundation",
	"18 Jianguomennei Avenue",
	"Mr. Bu Dongwei, 40-year-old",
	"budongwei-tn.jpg",
	"/article/757/",
	"Employed here prior to being taken to TuanHe Labor Camp, for 2.5 years for owning Falun Gong books, Amnesty International prisoner of conscience" ]);
locs.push(["F",39.826468,116.653519,"http://www.google.com/mapfiles/markerF.png",
	"Tongzhou District Detention Center ",
	"Tongzhouqu Taihuzhen Jianfacun south east",
	"Mr. Yu Zhou and Ms. Xu Na",
	"yuzhou-tn.jpg",
	"/article/756/",
	"Arrested for practicing Falun Gong and taken here while driving home after Mr. Yu Zhou's concert performance, this is likely where Mr. Yu Zhou was killed by police." ]);
locs.push(["G",39.724089,116.374054, "http://www.google.com/mapfiles/markerG.png",
	"Tuanhe Labor Camp ",
	"1 Tuanguilu, Daqing District",
	"Mr. Bu Dongwei, 40-year-old former employee of Asia Foundation",
	"budongwei-tn.jpg",
	"/article/757/",
	"Currently detained here for 2.5 years for practicing Falun Gong" ]);
locs.push(["H",39.728313,116.363068, "http://www.google.com/mapfiles/markerH.png",
	"Beijing Women's Prison ",
	"3 Qingfenglu Huifengjie Runhexiang, Daqing District",
	"Ms. Yao Yue, 36-year-old graduate student at Tsinghua University",
	"yaoyue-tn.jpg",
	"/article/758/",
	"Serving 12-year sentence here for sending emails about Falun Gong, Ms. Xu Na was also detained here from 2001 to 2006, during which she was reportedly placed in solitary confinement, deprived of sleep, and tied up with ropes in painful positions for extended periods" ]);
locs.push(["I",39.53794,116.305389,"http://www.google.com/mapfiles/markerI.png",
	"Beijing Women's Forced Labor Camp",
	"12 Weiyonglu, Tiantanghe, Daqing District",
	"Ms. Li Shuying, 64-year-old retired physics teacher",
	"lishuying-tn.jpg",
	"/article/759/",
	"Serving 2.5-year sentence here for practicing Falun Gong and owning Falun Gong books" ]);

// Olympic markers
locs.push(["",39.99132,116.39033, "http://faluninfo.net/media/photo/marker-olympics.png",
	"Olympic Stadium (Birds Nest)",
	"",
	"", "", "", "Track and Field"]);
locs.push(["",39.98890,116.35596, "http://faluninfo.net/media/photo/marker-olympics.png",
	"Science and Technology University Gymnasium",
	"",
	"", "", "", "Judo and Takwondo"]);
locs.push(["",39.98270,116.34512, "http://faluninfo.net/media/photo/marker-olympics.png",
	"Beijing University of Aeronautics and Astronautics Gymnasium",
	"",
	"", "", "", "Weightlifting"]);
locs.push(["",39.98841,116.30439, "http://faluninfo.net/media/photo/marker-olympics.png",
	"Peking University",
	"",
	"", "", "", "Table Tennis"]);
locs.push(["",40.00238,116.35322, "http://faluninfo.net/media/photo/marker-olympics.png",
	"China Agricultural University Gymnasium",
	"",
	"", "", "", "Wrestling"]);
locs.push(["",39.94556,116.47948, "http://faluninfo.net/media/photo/marker-olympics.png",
	"Chaoyang Park Beach",
	"",
	"", "", "", "Beach Volleyball"]);
locs.push(["",39.95787,116.30835, "http://faluninfo.net/media/photo/marker-olympics.png",
	"Beijing Institute Of Technology Gymnasium",
	"",
	"", "", "", "Volleyball"]);
locs.push(["",39.93074,116.43603, "http://faluninfo.net/media/photo/marker-olympics.png",
	"Beijing Workers' Gymnasium",
	"",
	"", "", "", "Boxing"]);
locs.push(["",39.93120,116.44098, "http://faluninfo.net/media/photo/marker-olympics.png",
	"Beijing Workers Stadium",
	"",
	"", "", "", "Football (Soccer)"]);
locs.push(["",39.87104,116.47757, "http://faluninfo.net/media/photo/marker-olympics.png",
	"Beijing University of Technology Gymnasium",
	"",
	"", "", "", "Badminton and Rhythmic Gymnastics"]);
locs.push(["",39.86557,116.27075, "http://faluninfo.net/media/photo/marker-olympics.png",
	"Fengtai Sports Center (Softball)",
	"",
	"", "", "", ""]);



var map;
var points = new Array();
var markers = new Array();
var goverlays = new Array();


function load() {
  	if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map"));
        //http://maps.google.com/maps/ms?ie=UTF8&hl=en&msa=0&msid=105775402461277326433.0004536be4c1a52d2f5e2&ll=39.889192,116.435165&spn=0.374066,0.700378&z=11
        map.setCenter(new GLatLng(39.889192,116.435165), 11);
	 	map.addControl(new GMapTypeControl());
     	//map.addControl(new GSmallMapControl());
     	map.addControl(new GLargeMapControl());
	
		// Create a base icon for all of our markers that specifies the
		// shadow, icon dimensions, etc.
		var baseIcon = new GIcon();
		baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
		baseIcon.iconSize = new GSize(20, 34);
		baseIcon.shadowSize = new GSize(37, 34);
		baseIcon.iconAnchor = new GPoint(9, 34);
		baseIcon.infoWindowAnchor = new GPoint(9, 2);
		baseIcon.infoShadowAnchor = new GPoint(18, 25);
		
	       
		for (var i=0; i<locs.length; i++){
			points[i]=new GLatLng(locs[i][1],locs[i][2]);
			// Create a lettered icon for this point using our icon class
			var letteredIcon = new GIcon(baseIcon);
			letteredIcon.image = locs[i][3];//"http://www.google.com/mapfiles/marker" + locs[i][0] + ".png";
			markerOptions = { icon:letteredIcon };
			markers[i]=new GMarker(points[i], markerOptions);
			markers[i].name = locs[i][0];
			map.addOverlay(markers[i]);
			var index = i;
			GEvent.addListener(markers[i], "click", function(marker) {
				map.openInfoWindowHtml(
					new GLatLng(marker.lat(),marker.lng()),
					getInfoHTMLForMarker(marker),
					{ maxWidth:250 } );	
			});
			
			var prename = markers[i].name;
			if (prename != '')
				prename += ': ';
			document.getElementById("side_bar").innerHTML  += 
				'<a href="javascript:myclick(' + i + ')">' + prename + locs[i][4] + '</a><br><br>';
		}
			
  }
}

function formatLocHTML(loc)
{
	var result = "";

	// has thumbnail?
	if( loc[7] != "" )
		result += "<table align=right><td><td><img border=0 src=/media/maps/" + loc[7] + "></td></tr></table>";

	// address
	result += "<u>" + loc[4].toUpperCase() + "</u><br>" +
		loc[5] + "<br><br>";

	// person
	if( loc[6] != "" )
		result += "<b>" + loc[6] + "</b><br>";
	// description (all points have this )
	result += loc[9];

	// link to case
	if( loc[8] != "")
		result += "<br><br><a href='" + loc[8] + "'><b>View Full Case</b></a><br>";

	return result;
}

// This function picks up the click and tells GGeoXml to open the corresponding info window
function myclick(i) {
   map.openInfoWindowHtml(points[i], formatLocHTML(locs[i]), { maxWidth:250});
}

function getInfoHTMLForMarker(marker){
	for (var i=0; i<locs.length; i++){
		if (locs[i][1] == marker.lat() &&
			locs[i][2] == marker.lng())
				return formatLocHTML(locs[i]);
	}
}


try{
	load();
} catch(error)
{
};
