//, {size: new GSize(650,450), passivelogo:true, suppresscopyright:true}
var map = new GMap2(document.getElementById("map"),{size: new GSize(650,450), passivelogo:true, suppresscopyright:true});
//map.addControl(new GSmallMapControl());
//map.addControl(new GScaleControl());
map.disableDragging();
map.setCenter(new GLatLng(40,-3.8), 6);
centers =[]; zooms = [];
centers["es"] = new GLatLng(40,-3.8); zooms["es"] = 6;
centers["gb"] = new GLatLng(55,-5); zooms["gb"] = 5;
centers["sa"] = new GLatLng(-26,-63.8); zooms["sa"] = 3;
//map.enableDoubleClickZoom();
ico = new GIcon();
ico.image = "http://www.cazacoches-robados.com/info.png";
ico.iconSize = new GSize(32, 32);
ico.iconAnchor = new GPoint(16, 16);
ico.infoWindowAnchor = new GPoint(16, 1);
function cm(point,ico,name){
	mker = new GMarker(point, {icon:ico, title:name});
	map.addOverlay(mker);
	return mker;
}
function ip(mker, html){
	GEvent.addListener(mker, 'click', function(){document.getElementById("info").innerHTML = html});
}
GDownloadUrl("distribuidores.txt?nc="+new Date().getTime(), function(doc){
	lines = doc.split("**");
	for(i=2; i<lines.length; i++){
		lines[i] = lines[i].replace("\r\n", "");
		p = lines[i].split("|");
		lat = p[0];
		lng = p[1];
		name = p[2];
		add = p[3];
		misc = p[4];
		pt = new GLatLng(lat,lng);
		html = "<div align='left'><p><b>"+name+"</b></p><p class='style2'><b>"+add+"</b></p><p class='style2'>"+misc+"</p></div>";
		marker = cm(pt,ico,name);
		ip(marker, html);
	}
});
function center(coun){
	map.setCenter(centers[coun]);
	map.setZoom(zooms[coun]);
}