
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",36.086147,120.354023,"http://www.google.com/mapfiles/markerA.png",
	"Qingdao Haici Hospital",
	"Pingdu City and Qingdao City, Shandong Province",
	"Ms. Xiao Sumin, 46-year-old factory worker",
	"xiaosumin-tn.jpg",
	"/article/765/",
	"Arrested May 30, died from torture June 21, 2008, at Qingdao Haici Hospital and was immediately cremated.  She is survived by a young daughter."]);
locs.push(["B",40.731857,120.99655,"http://www.google.com/mapfiles/markerB.png",
	"Huludao City",
	"Liaoning Province [address correction]",
	"Mr. Fan Dezhen, 33-year-old shopping mall employee",
	"fandezhen-tn.jpg",
	"/article/762/",
	"Arrested February 25, died from torture April 20, 2008. Survived by wife and infant."]);
locs.push(["C",38.36104,116.85608,"http://www.google.com/mapfiles/markerC.png",
	"Cangzhou City",
	"Hebei Province",
	"Mr. Guo Hanpo, 56-year-old jewelry store owner",
	"guohanpo-tn.jpg",
	"/article/768/",
	"Died on April 5th, 2008, while serving 11-year prison sentence for practicing Falun Gong"]);
locs.push(["D",39.02771,121.62964,"http://www.google.com/mapfiles/markerD.png",
	"Dalian City",
	"Liaoning Province",
	"Mr. Gu Qun, 50-year-old, worked in Xigang Industrial and Commercial Bureau",
	"",
	"/article/763/",
	"Arrested March 16 for distributing information about the persecution of Falun Gong.  Died from torture April 8, 2008 at Yaojia Detention Center"]);
locs.push(["E",41.77951,125.92529,"http://www.google.com/mapfiles/markerE.png",
	"Tonghua City",
	"Jilin Province",
	"Mr. Wang Guiming, vendor at Hongyuan Market",
	"wangguiming-tn.jpg",
	"/article/770/",
	"Arrested February 13, taken 4 days later to Chaoyanggou Labor Camp, died Feb 29, 2008, after being shocked with electric batons"]);
locs.push(["F",41.64336243126522,120.4541015625,"http://www.google.com/mapfiles/markerF.png",
	"Chaoyang City",
	"Liaoning Province",
	"Mr. Chen Baofeng, 43-year-old taxi driver",
	"chenbaofeng-tn.jpg",
	"/article/764/",
	"Arrested Feb 24, died March 3, 2008 in Shijiazi Detention Center.  Family saw his body covered in bruises after his death."]);
locs.push(["G",31.48958,121.61041,"http://www.google.com/mapfiles/markerG.png",
	"Shanghai",
	"Pudong New District",
	"Ms. Gu Jianmin, 53-year-old",
	"gujianmin-tn.jpg",
	"/article/760/",
	"Arrested March 1, died March 13, 2008 at Pudong New District after being tortured at Yangjing Police Station.  Husband saw her body just before death."]);
locs.push(["H",42.16340,123.42047,"http://www.google.com/mapfiles/markerH.png",
	"Shenyang City",
	"Liaoning Province",
	"Ms. Gao Rongrong, 37-year-old accountant",
	"gaorongrong-tn.jpg",
	"/article/761/",
	"Arrested March 2, 2005, died June 16, 2005.  Was held in Masanjia Prison Camp, face was disfigured from electric baton torture. Case reported by Amnesty International."]);
locs.push(["I",36.711111,119.108333,"http://www.google.com/mapfiles/markerI.png",
	"Weifang City",
	"Shandong Province",
	"Ms. Zong Xiuxia, 55-year-old",
	"",
	"/article/766/",
	"Arrested Feb 22, 2008, died within 4 hours of being taken to Guangwen Police Station. Detained distributing information about Falun Gong near Jialejia Supermarket"]);
locs.push(["J",38.047222,114.475,"http://www.google.com/mapfiles/markerJ.png",
	"Shijiazhuang City",
	"Hebei Province",
	"Ms. Si Miao, 36-year-old CFO at Chinese Academy of Sciences",
	"simiao-tn.jpg",
	"/article/767/",
	"Detained April 22 at her workplace, now serving 1.5 year term at Shijiazhuang Women's Labor Camp for practing Falun Gong<br>Brother is US citizen living in Los Angeles, remaining family under house arrest in China."]);
locs.push(["K",36.177791,103.8372,"http://www.google.com/mapfiles/markerK.png",
	"Lanzhou City",
	"Gansu Province [needs correction]",
	"Ms. Qing Shizhen, 67-year-old retired professor from Gansu Administration College",
	"",
	"/article/769/",
	"Arrested March 31 in Xinjiang for handing out fliers about the persecution of Falun Gong.  Transfered in May to Gongjiawan brainwashing center, suffering from very high blood pressure."]);

locs.push(["",39.99132,116.39033,"http://faluninfo.net/media/photo/marker-olympics.png",
	"Olympic Stadium (Birds Nest)",
	"", "", "", "", "Track and Field" ]);
locs.push(["",41.78770, 123.45337,"http://faluninfo.net/media/photo/marker-olympics.png",
	"Shenyang Olympic Sports Centre Stadium",
	"", "", "", "", "Football (Soccer)" ]);
locs.push(["",31.18681, 121.43515,"http://faluninfo.net/media/photo/marker-olympics.png",
	"Shanghai Indoor Stadium",
	"", "", "", "", "Football (Soccer)" ]);
locs.push(["",36.05840, 120.38956,"http://faluninfo.net/media/photo/marker-olympics.png",
	"Qingdao International Sailing Centre",
	"", "", "", "", "Sailing" ]);


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(36.432802,118.679884), 5);
	 	map.addControl(new GMapTypeControl());
     	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";
			if (locs[i][0]=="A")
				markerOptions = { icon:letteredIcon, zIndexProcess:increaseZOrder };
			else
    				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]);
	}
}

function increaseZOrder(marker,b) {
    return 10000;
} 



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

