var point = new Array();
var map = null;
var remove_line1 = null;
var remove_line1_2 = null;
var remove_line2 = null;
var remove_line2_2 = null;
var s1=1;
var x1=-1;
var y1=0;
var z1=point_arr.length;
for (i=0; i<z1; i++){
	point[i] = new GLatLng(point_arr[i][0], point_arr[i][1]);
}

var markerIcon = new GIcon();
markerIcon.iconAnchor = new GPoint(0, 0);
var markerIcon2 = new GIcon();
var markerIcon2 = MapIconMaker.createLabeledMarkerIcon({width: 32, height: 32, primaryColor: "#EB1F2B"});
markerIcon2.image = "http://www.bellesalle.co.jp/common/images/bellesalle.png";
markerIcon2.shadow = "";
markerIcon2.iconSize = new GSize(52, 50);
markerIcon2.iconAnchor = new GPoint(30, 30);
markerIcon2.printImage = "http://www.bellesalle.co.jp/common/images/bellesalle.png";
	
var buildingMaker = null;
	
function map_rendering(){
  if (GBrowserIsCompatible()) {
	if(x1>-6){
		if(z1>y1){
			var points = [];
			for (i=0; i<y1+1; i++){
				points.push(point[i]);
			}
			var point1_to_p2_lat=(point_arr[y1][0]-point_arr[y1+1][0])/5;
			var point1_to_p2_lng=(point_arr[y1][1]-point_arr[y1+1][1])/5;
			var point1_2_lat=point_arr[y1][0]+(point1_to_p2_lat*x1);
			var point1_2_lng=point_arr[y1][1]+(point1_to_p2_lng*x1);
			var point1_2 = new GLatLng(point1_2_lat, point1_2_lng);
			points.push(point1_2);
			if (remove_line1_2 != null){
				map.removeOverlay(remove_line1_2);
			}
			if (remove_line2_2 != null){
				map.removeOverlay(remove_line2_2);
			}
			var line1 = new GPolyline(points, "#ff0000", 10, 1);
			map.addOverlay(line1);
			remove_line1_2 = remove_line1;
			remove_line1 = line1;
			var line2 = new GPolyline(points, "#ff0000", 10, 1);
			map.addOverlay(line2);
			remove_line2_2 = remove_line2;
			remove_line2 = line2;
		}
		x1--;
	}else{
		x1=-1;
		y1++;
	}
	
	if(z1>y1+1){
		setTimeout("map_rendering()",80);
	}else{
		clearTimeout();
	}
  }
}
function map_load() {
	map = new GMap2(document.getElementById("mapArea"));
	map.addControl(new GMapTypeControl());
	map.addControl(new GLargeMapControl());
	map.setCenter(new GLatLng(map_center[0], map_center[1]), map_zoom);
	map.addOverlay(new GMarker(point[0], {icon:markerIcon}));
	buildingMaker =new GMarker(point[map_location_count - 1], {icon:markerIcon2}); 
	map.addOverlay(buildingMaker);
	map_rendering();
}
function map_load_ex(msg){
	map_load();
	buildingMaker.openInfoWindowHtml(msg);
}
