﻿
  function initialize() 
  {

  	if (GBrowserIsCompatible()) 
  	{	
		var map = new GMap2(document.getElementById("mapss"));
		map.setCenter(new GLatLng(30, 110), 4);
		map.addControl(new GLargeMapControl());
		//map.addControl(new GMapTypeControl());
		//map.getMapTypes().length = 0;
		//map.setMapType(G_PHYSICAL_MAP)
		
	}
	

	var icon1=new GIcon();
	icon1.image="http://www.chinatraveldepot.com/PubImages/Images/flight1.gif";
	icon1.iconSize = new GSize(29, 29);
	icon1.iconAnchor = new GPoint(0,0);
	var icon2=new GIcon();
	icon2.image="http://www.chinatraveldepot.com/PubImages/Images/flight2.gif";
	icon2.iconSize = new GSize(29, 29);
	icon2.iconAnchor = new GPoint(0,0);
	

	if(document.getElementById("LngList").value.length>0)
	{
		var str=document.getElementById("LngList").value.split("|");
		
		var _glat="";

		for(var i=0;i<str.length;i++)
		{
			if(i==0)
			{
				map.addOverlay(new GMarker(new GLatLng(parseFloat(str[i].split(",")[1]),parseFloat(str[i].split(",")[0])),icon1));
				
					_glat+="new GLatLng("+str[i].split(",")[1]+","+str[i].split(",")[0]+"),";	
			}
			else if((i+1)==str.length)
			{
				map.addOverlay(new GMarker(new GLatLng(str[i].split(",")[1],str[i].split(",")[0]),icon2));
				_glat+="new GLatLng("+str[i].split(",")[1]+","+str[i].split(",")[0]+")";
			}
			else
			{
				_glat+="new GLatLng("+str[i].split(",")[1]+","+str[i].split(",")[0]+"),";
			}
			var Cityname=str[i].split(",")[2].toString();
			var CityID=str[i].split(",")[3].toString();
			map.addOverlay(createMarker(new GLatLng(str[i].split(",")[1],str[i].split(",")[0]),Cityname,CityID));
		}
		
		var polyline =eval(" new GPolyline(["+ _glat +"], \"#0000FF\", 3)");
		map.addOverlay(polyline);
	}

}

function createMarker(point, CityName,CityID)
{
var opts = new Object(); 
opts.maxWidth = 30; 
var blueIcon = new GIcon(G_DEFAULT_ICON);
blueIcon.image="http://www.chinatraveldepot.com/PubImages/Images/blue-dot.png";
blueIcon.iconSize=new GSize(32,32);
opts.icon=blueIcon;
opts.title="Click to View";
var marker = new GMarker(point,opts);
var cityDetails="<iframe   frameborder='0' style='width:430px; height:230px; border-style: none'   src='/Destinations/gMapDetail.aspx?Type=1&CityID="+CityID+""+"&CityName="+CityName+"'></iframe>";
GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(cityDetails); });
return marker;
}


