var polyline;
function getMaxValue(str)
{   
    var array = str.split(";"); 
    var maxValue = parseFloat(array[0]);
	for (var i=0; i<array.length; i++)    
    {
    	var value = parseFloat(array[i]);
    	if(value > maxValue)
    	{
    		maxValue = value;
    	}
	}
	return maxValue;
}
function getMinValue(str)
{   
    var array = str.split(";"); 
    var minValue = parseFloat(array[0]);
	for (var i=0; i<array.length; i++)    
    {
    	var value = parseFloat(array[i]);
    	if(value < minValue)
    	{
    		minValue = value;
    	}
	}
	return minValue;
}
function addListener(marker,objId)
{
     GEvent.addListener(marker, "mousedown", function(){
    	for(var i=0;i<tourMarkers.length;i++)
    	{
    		var imagName = tourMarkers[i].getIcon().image;
    		imagName = imagName.replace("red", "blue");
    		tourMarkers[i].setImage(imagName);
    	} 
	    var dayNo = parseInt(objId);
		var dayMarkers = makerArray[dayNo-1];   	
    	for(var i=0;i<dayMarkers.length;i++)
    	{
    		var imagName = dayMarkers[i].getIcon().image;
    		imagName = imagName.replace("blue", "red");
    		dayMarkers[i].setImage(imagName);
    	} 
    	scroller(objId, 800); }); 
}
function getCenterpoint(strlat,strlng)
{   
	var maxlat = getMaxValue(strlat);
	var maxlng = getMaxValue(strlng);
	var minlat = getMinValue(strlat);
	var minlng = getMinValue(strlng);						
	var cenlat = (maxlat + minlat)/2;
	var cenlng = (maxlng + minlng)/2;
	return {lat: cenlat, lng:cenlng};			
}
function getZoom(strlat,strlng) { 
	var maxlat = getMaxValue(strlat);
	var minlat = getMinValue(strlat);				  
	var maxlng = getMaxValue(strlng);
	var minlng = getMinValue(strlng);						
	var btwlat = (maxlat - minlat);
	var btwlng = (maxlng - minlng);	
	var distance = btwlat > btwlng ? btwlat:btwlng;
	var thetime = 360/distance;
	var c = Math.log(thetime)/Math.log(2);
	var num = Math.floor(c); 
	return num;
}
function closemap()
{   
    document.getElementById("mapbox").style.display="none";   
}
function open_map(ev)
{
	var doc = (!document.compatMode || document.compatMode == 'CSS1Compat') ? document.documentElement : document.body;
	var e = ev || window.event;
	var win_s = (!!window.opera || navigator.userAgent.indexOf('AppleWebKit/') > -1) ? {x: window.innerWidth, y: window.innerHeight} : {x: doc.clientWidth, y: doc.clientHeight};	
	var mou_s = {x: e.pageX || (e.clientX + doc.scrollLeft),y: e.pageY || (e.clientY + doc.scrollTop)};
	var mou_c = {x: e.clientX || e.pageX - window.pageXOffset,y: e.clientY || e.pageY - window.pageYOffset};
	var mapbox=document.getElementById("mapbox");		
	mapbox.style.display = "block";
	mapbox.style.left = mou_s.x + 10 + 'px';
	mapbox.style.top =  mou_s.y + 10 + 'px';
}
function addMouseDownListener(marker,objId)
{
    GEvent.addListener(marker, "mousedown", function(){
    	for(var i=0;i<tourFixedMarkers.length;i++)
    	{
    		var imagName = tourFixedMarkers[i].getIcon().image;
    		imagName = imagName.replace("red", "blue");
    		tourFixedMarkers[i].setImage(imagName);
    	}  
		var dayNo = parseInt(objId);
		var dayMarkers = makerArrayFixed[dayNo-1];    	  	
    	for(var i=0;i<dayMarkers.length;i++)
    	{
    		var imagName = dayMarkers[i].getIcon().image;
    		imagName = imagName.replace("blue", "red");
    		dayMarkers[i].setImage(imagName);
    	}
		var map_nav = document.getElementById("map_nav");
		var linkArray = map_nav.getElementsByTagName('a');
		for(var i=0;i<linkArray.length;i++)
		{
			linkArray[i].className="";
		}
		var temp = parseInt(objId);
		linkArray[temp-1].className="selected";   	
    	var dc_description = document.getElementById("dc_description");
    	if(dc_description != null)
    	{
    		dc_description.style.display="none";
    	}
    	for(var i=1;i<=totalDay;i++)
    	{
    		if(document.getElementById("daily_content"+i) != null)
    		{
    			document.getElementById("daily_content"+i).style.display="none";
    		}
    	} 
		if(document.getElementById("dc_other") != null)
		{
			document.getElementById("dc_other").style.display="none";  
		}
		if(document.getElementById("con_one_1") != null)
		{
    		document.getElementById("con_one_1").style.display="block";
		}
		if(document.getElementById("daily_content"+objId) != null)
		{
    		document.getElementById("daily_content"+objId).style.display="block"; 	
		}
    	}); 
}

function navdaychange(dayid,obj)
{
	var map_nav = document.getElementById("map_nav");
	var linkArray = map_nav.getElementsByTagName('a');
	for(var i=0;i<linkArray.length;i++)
	{
		linkArray[i].className="";
	}
	obj.className="selected";
	for(var i=1;i<=totalDay;i++)
	{
		document.getElementById("daily_content"+i).style.display="none";
	}
	document.getElementById("daily_content"+dayid).style.display="block"; 
	for(var i=0;i<tourFixedMarkers.length;i++)
	{
		var imagName = tourFixedMarkers[i].getIcon().image;
		imagName = imagName.replace("red", "blue");
		tourFixedMarkers[i].setImage(imagName);
	}
	var dayNo = parseInt(dayid);
	var dayMarkers = makerArrayFixed[dayNo-1];
	for(var i=0;i<dayMarkers.length;i++)
	{
		var imagName = dayMarkers[i].getIcon().image;
		imagName = imagName.replace("blue", "red");
		dayMarkers[i].setImage(imagName);
	}
}
function day_click(el)
{
	if(document.getElementById("con_one_6").style.display == "block")
	{
		return;
	}
	var mapbox=document.getElementById("mapbox").style.display="block";
	map.checkResize();
	for(var i=0;i<tourMarkers.length;i++)
	{
		var imagName = tourMarkers[i].getIcon().image;
		imagName = imagName.replace("red", "blue");
		tourMarkers[i].setImage(imagName);
	} 
    var dayNo = parseInt(el);
	var dayMarkers = makerArray[dayNo-1];   	
	for(var i=0;i<dayMarkers.length;i++)
	{
		var imagName = dayMarkers[i].getIcon().image;
		imagName = imagName.replace("blue", "red");
		dayMarkers[i].setImage(imagName);
	} 	
	scroller(el,800);
}
function getTilt(latArray,lngArray,temp)
{
	var subscript = parseInt(temp);
	var num = 0;
	for(var i=0;i<subscript;i++)
	{
		if(latArray[i]==latArray[subscript] && lngArray[i]==lngArray[subscript] )
		{
			num++;
		}
	}
	if(num==0)
	{
		return "";
	}
	else if(num==1)
	{
		return "tiltr";
	}
	else
	{
		return "tiltl";
	}
}
var clolor = new Array("#cc00cc","#cc00cc","#cc00cc","#cc00cc","#cc00cc");
var tempcolor = 0;
function addPolyline(pointArray,countArray,theMap)
{
	var tag=0;
	for(var i=0; i<countArray.length;i++)
	{
		var tempArray = [];
		var nextTag = tag + parseInt(countArray[i]);
		for(var j=tag;j<=nextTag;j++)
		{
			if(pointArray[j] != null)
			{
				tempArray.push(pointArray[j]);
			}
		}
		tag = nextTag;
		if(tempArray.length>1)
		{
			var polyline = new GPolyline(tempArray, clolor[tempcolor], 2, 0.6,{clickable: false, geodesic: true});
	    	theMap.addOverlay(polyline);
	    	tempcolor = (tempcolor+1)%5;
    	}   	
	}
}
function getPoint(start,end)
{
	var point = end;
	return point;
}
function GArrow(map,start,end,p)
{
	this.map=map;
	this.start=start;
	this.end=end;
	this.point = p;
}
GArrow.prototype.redraw=function()
{
	var b=this.map;
	var d=this.getAngle();
	var img = getImageSrcByAngle(d);
    var e=Math.floor(8+8*Math.cos(d));
    var f=Math.floor(8+8*Math.sin(d));
	SetPosition(b,new GPoint(e,f),img,this.point);
};
GArrow.prototype.getAngle=function()
{
	var a=this.map;
	var b=a.fromLatLngToContainerPixel(this.start);
	var c=a.fromLatLngToContainerPixel(this.end); 
	return Math.atan2(c.y-b.y,c.x-b.x);
};
function getImageSrcByAngle(a)
{ 
	var b=Math.round(a*60/Math.PI)*3+90;
	while(b>=120)b-=120; 
	while(b<0)b+=120;
	return "/images/dir_"+b+".png";		
}
function SetPosition(map,anchor,img,point)
{ 
	var icon = new GIcon();
	var config ={image: img,
	iconSize : new GSize(16, 16),
	iconAnchor : anchor
	};	
	for (var key in config) {
		icon[key] = config[key];
	}
	var marker = new GMarker(point,{icon:icon});
	map.addOverlay(marker);
	
}

function addArrows(points,map)
{
    for (var i=1; i < points.length; i++)
    {
        var p1=points[i-1];
        var p2=points[i];
        if(p1.lat() == p2.lat() && p1.lng() == p2.lng())
        {
        	continue;
        }
		var point =  getPoint(p1, p2);
		var arrow = new GArrow(map,p1,p2,point);
		arrow.redraw();
    }
}
function addStartMarker(points,map)
{
	var icon = new GIcon();
    var imageName = "/images/mapstart.png";				    	    
    var	size = new GSize(40, 25);
    var anchor = new GPoint(40, 0); 				
	var config ={image: imageName,
	iconSize : size,
	iconAnchor : anchor
	};	
	for (var key in config) {
		icon[key] = config[key];
	}
	var marker = new GMarker(points[0],{clickable: false, title: 'Start', icon:icon,zIndexProcess:markerOrder});
	map.addOverlay(marker);
}
function addEndMarker(points,map)
{
	var icon = new GIcon();
    var imageName = "/images/mapend.png";				    	    
    var	size = new GSize(34, 25);
    var anchor = new GPoint(0, 0); 				
	var config ={image: imageName,
	iconSize : size,
	iconAnchor : anchor
	};	
	for (var key in config) {
		icon[key] = config[key];
	}
	var marker = new GMarker(points[points.length-1],{clickable: false, title: 'End', icon:icon,zIndexProcess:markerOrder});
	map.addOverlay(marker);
}
function markerOrder()    
{   
	return 1;
} 

function bus_search_map_area_select(area_range, init_div)
{
	var map = new GMap2(document.getElementById("map"));
    var customUI = map.getDefaultUI();
    customUI.maptypes.hybrid = false;
	customUI.maptypes.physical = false;
	customUI.maptypes.satellite = false;
    map.setUI(customUI);
	var icon1 = new GIcon();
	icon1.image = "/images/ico_gg1.png";
	icon1.shadow = "/images/ico_shadow.png";
	icon1.iconSize = new GSize(13, 22);
	icon1.shadowSize = new GSize(22, 20);
	icon1.iconAnchor = new GPoint(5, 5);
	icon1.infoWindowAnchor = new GPoint(5, 1);
	var icon3 = new GIcon();
	icon3.image = "/images/ico_gg3.png";
	icon3.shadow = "/images/ico_shadow.png";
	icon3.iconSize = new GSize(16, 27);
	icon3.shadowSize = new GSize(22, 20);
	icon3.iconAnchor = new GPoint(5, 5);
	icon3.infoWindowAnchor = new GPoint(5, 1);	
    map.clearOverlays();
    var added_points = new Array
    if (area_range != "")
    {
    	added_points = depart_area[area_range];
    }
    else
	{
		added_points = b_cities;
	}
    var max_lati = Number(0);
	var min_lati = Number(0);
	var max_long = Number(0);
	var min_long = Number(0);
	for (var i=0; i<added_points.length; i++)
	{
		var depart_name = added_points[i];
		latitude = latitudes[depart_name];
		longitude = longitudes[depart_name];
		var depart_id = city_ids[depart_name];							
		if (latitude && longitude && latitude != "" && latitude != "0.000" && longitude != "" && longitude != "0.000")
		{
			if (i == 0)
			{
				max_lati = latitude;
				min_lati = latitude;
				max_long = longitude;
				min_long = longitude;
			}
			else
			{
				if (latitude > max_lati)
				{
					max_lati = latitude;
				}
				if (latitude < min_lati)
				{
					min_lati = latitude;
				}
				if (longitude > max_long)
	{
					max_long = longitude;
				}
				if (longitude < min_long)
	{
					min_long = longitude;
				}
			}
			if (is_special_city(depart_name))
			{
				var point = new GLatLng(latitude, longitude);
				map.addOverlay(createMarker(map,point,icon3, depart_name, 1, depart_id));
			}
			else
			{
			var point = new GLatLng(latitude, longitude);
			map.addOverlay(createMarker(map,point,icon1, depart_name, 1, depart_id));
		}
	}
	}
	var center_lati = (Number(max_lati)+Number(min_lati))/2;
	var center_long = (Number(max_long)+Number(min_long))/2;
	map.setCenter(new GLatLng(center_lati,center_long+2), 18);
	var flag = true;
	var south_west_point = new GLatLng(min_lati, min_long);
	var north_east_point = new GLatLng(max_lati, max_long);
    while (flag)
    {
     	var temp_bound = map.getBounds();
     	flag = !(temp_bound.containsLatLng(south_west_point) && temp_bound.containsLatLng(north_east_point));
     	if (flag)
        {
     		map.zoomOut();
    	}
	}
    var init_div_obj = document.getElementById(init_div);
    if (init_div_obj)
	{
		init_div_obj.style.left = 365 + 'px';
		init_div_obj.style.top = 160 + 'px';
		init_div_obj.style.display = "";
		GEvent.addListener(map, "click", function()
		{
				init_div_obj.style.display = "none";
		var depart_click_obj = document.getElementById("depart_click");
	 	var arrival_selected_tips_obj = document.getElementById("arrival_selected_tips");
	 	if (depart_click_obj)
	 	{
	 		if (arrival_selected_tips_obj && depart_click_obj.value == "")
			{
				arrival_selected_tips_obj.style.display = "none";
			}
			depart_click_obj.value = "";
	 	}
	     });
	}
	init_map_option_depart();
}

function close_submit_div(div_name)
{
	var div_obj = document.getElementById(div_name);
	if (div_obj)
	{
		div_obj.style.display = "none";	
	}			
}


function depart_name_to_id(depart_name, js_string)
{
	var depart_xml;
	var eval_js  = document.getElementById(js_string).value
	if(window.XMLHttpRequest) 
	{
		depart_xml = new XMLHttpRequest();
	} else
	{
		depart_xml = new ActiveXObject("MSXML2.XMLHTTP");
	}
	var flag = 0;
	var action_url = "/cgi-bin/ajax.cgi?type=depart_name_to_id&name=" + depart_name;
	depart_xml.open("GET", action_url, true);	
	depart_xml.onreadystatechange = function get_depart_id()
    {
        if (depart_xml.readyState == 4)
        {        
            depart_id=depart_xml.responseText;
            eval(eval_js);
        }
    };
    depart_xml.setRequestHeader("If-Modified-Since","0");
	depart_xml.send("");
}

function fresh_map_by_depart(depart_name, depart_div_name, depart_div_tips_name, arrival_selected_tips)
{
		     	
 	var depart_id = city_ids[depart_name];
 	if (depart_id > 0)
 	{
 		var map = new GMap2(document.getElementById("map"));
		 var customUI = map.getDefaultUI();
	    customUI.maptypes.hybrid = false;
		customUI.maptypes.physical = false;
		customUI.maptypes.satellite = false;
	    map.setUI(customUI);
		var icon1 = new GIcon();
		icon1.image = "/images/ico_gg1.png";
		icon1.shadow = "/images/ico_shadow.png";
		icon1.iconSize = new GSize(13, 22);
		icon1.shadowSize = new GSize(22, 20);
		icon1.iconAnchor = new GPoint(5, 5);
		icon1.infoWindowAnchor = new GPoint(5, 1);
		var icon2 = new GIcon();
		icon2.image = "/images/marker1.png";
		icon2.shadow = "/images/ico_shadow.png";
		icon2.iconSize = new GSize(13, 22);
		icon2.shadowSize = new GSize(22, 20);
		icon2.iconAnchor = new GPoint(5, 5);
		icon2.infoWindowAnchor = new GPoint(5, 1);
		var icon3 = new GIcon();
		icon3.image = "/images/ico_gg3.png";
		icon3.shadow = "/images/ico_shadow.png";
		icon3.iconSize = new GSize(20, 30);
		icon3.shadowSize = new GSize(22, 20);
		icon3.iconAnchor = new GPoint(5, 5);
		icon3.infoWindowAnchor = new GPoint(5, 1);
		var icon4 = new GIcon();
		icon4.image = "/images/ico_gg4.png";
		icon4.shadow = "/images/ico_shadow.png";
		icon4.iconSize = new GSize(16, 27);
		icon4.shadowSize = new GSize(22, 20);
		icon4.iconAnchor = new GPoint(5, 5);
		icon4.infoWindowAnchor = new GPoint(5, 1);
		map.clearOverlays();
		var max_lati = Number(0);
		var min_lati = Number(0);
		var max_long = Number(0);
		var min_long = Number(0);
		var latitude = Number(latitudes[depart_name]);
		var longitude = Number(longitudes[depart_name]);
		if (latitude && longitude && latitude != "" && latitude != "0.000" && longitude != "" && longitude != "0.000")
		{
			max_lati = latitude;
			min_lati = latitude;
			max_long = longitude;
			min_long = longitude;
			if (is_special_city(depart_name))
			{
				var point = new GLatLng(latitude, longitude);						
				map.addOverlay(createMarker(map,point,icon3, depart_name, 1, depart_id));
			}
			else
			{
			var point = new GLatLng(latitude, longitude);						
			map.addOverlay(createMarker(map,point,icon1, depart_name, 1, depart_id));
		}
		}
		for (var i=0; i<g_bus[depart_name].length; i++)
		{					
				var arrival_name = g_bus[depart_name][i];
				latitude = latitudes[arrival_name];
				longitude = longitudes[arrival_name];
				var arrival_id = city_ids[arrival_name];							
				if (latitude && longitude && latitude != "" && latitude != "0.000" && longitude != "" && longitude != "0.000")
				{
					if (latitude > max_lati)
					{
						max_lati = latitude;
					}
					if (latitude < min_lati)
					{
						min_lati = latitude;
					}
					if (longitude > max_long)
					{
						max_long = longitude;
					}
					if (longitude < min_long)
					{
						min_long = longitude;
					}
					if (is_special_city(arrival_name))
					{
						var point = new GLatLng(latitude, longitude);
						map.addOverlay(createMarker(map,point,icon4, arrival_name, 0, arrival_id));
					}
					else
					{
					var point = new GLatLng(latitude, longitude);
					map.addOverlay(createMarker(map,point,icon2, arrival_name, 0, arrival_id));
					}
				}
		}
		var center_lati = (Number(max_lati)+Number(min_lati))/2;
		var center_long = (Number(max_long)+Number(min_long))/2;
		map.setCenter(new GLatLng(center_lati,center_long+2), 18);
		var flag = true;
		var south_west_point = new GLatLng(min_lati, min_long);
		var north_east_point = new GLatLng(max_lati, max_long);
	    while (flag)
	    {
	     	var temp_bound = map.getBounds();
	     	flag = !(temp_bound.containsLatLng(south_west_point) && temp_bound.containsLatLng(north_east_point));
	     	if (flag)
	     	{
	     		map.zoomOut();
	    	}
		}
		
		var depart_div_tips = document.getElementById(depart_div_tips_name);
		var depart_div_obj = document.getElementById(depart_div_name);
		var arrival_selected_tips_obj = document.getElementById(arrival_selected_tips);
		if (arrival_selected_tips_obj)
		{
			arrival_selected_tips_obj.style.display = "";
		}
		if (depart_div_tips && depart_div_obj)
		{			
			depart_div_tips.innerHTML = depart_name;
	 		var depart_id_latitude = Number(latitudes[depart_name]);
			var depart_id_longitude = Number(longitudes[depart_name]);
	 		var depart_from = new GLatLng(depart_id_latitude,depart_id_longitude);		
			var depart_point = map.fromLatLngToContainerPixel(depart_from);					
			depart_div_obj.style.left = depart_point.x - 40 + 'px';
			depart_div_obj.style.top = depart_point.y - 72 + 'px';
	 		depart_div_obj.style.display = "";
	 		GEvent.addListener(map, "move", function()
			{
				if (depart_div_obj.style.display == "")				
				{
					var depart_from = new GLatLng(depart_id_latitude,depart_id_longitude);
					var depart_point = map.fromLatLngToContainerPixel(depart_from);
					depart_div_obj.style.left = depart_point.x - 40 + 'px';
					depart_div_obj.style.top = depart_point.y - 72 + 'px';
				}
			});
			var depart_click_obj = document.getElementById("depart_click");
			GEvent.addListener(map, "click", function()
			{
			 	var arrival_selected_tips_obj = document.getElementById("arrival_selected_tips");
			 	if (depart_click_obj)
			 	{
			 		if (arrival_selected_tips_obj && depart_click_obj.value == "")
					{
						arrival_selected_tips_obj.style.display = "none";
					}
					depart_click_obj.value = "";
			 	}			
		     });
	 	}
	 	return map;
	}
	return '';
}

function init_map_tips_div(mark_tips, mark_tip_show, depart_tips, arrival_tips, init_map_div, arrival_selected_tip)
{
	var mark_tips_obj = document.getElementById(mark_tips);
	var mark_tip_show_obj = document.getElementById(mark_tip_show);
	if (mark_tips_obj && mark_tip_show_obj)
	{
		mark_tip_show_obj.innerHTML = "";
		mark_tips_obj.style.left=0;
		mark_tips_obj.style.top=-280 + 'px';
        mark_tip_show_obj.style.backgroundColor= "";
		mark_tip_show_obj.style.border = "";
	}
	var depart_tips_obj = document.getElementById(depart_tips);
	if (depart_tips_obj)
	{
		depart_tips_obj.style.display="none";
	}
	var arrival_tips_obj = document.getElementById(arrival_tips);
	if (arrival_tips_obj)
	{
		arrival_tips_obj.style.display="none";
	}
	var init_map_div_obj = document.getElementById(init_map_div);
	if (init_map_div_obj)
	{
		init_map_div_obj.style.display="none";
	}
	var arrival_selected_tip_obj = document.getElementById(arrival_selected_tip);
	if (arrival_selected_tip_obj)
	{
		arrival_selected_tip_obj.style.display="none";
	}
	
}

function depart_to_arrival_arrows(depart_id, arrival_id, map, arrival_id_old)
{
	var depart_id_obj = document.getElementById("depart_id");
	var arrival_id_obj = document.getElementById("arrival_id");
	if (arrival_id_old > 0)
	{
		
	}
	if (depart_id_obj && arrival_id_obj)
	{
		var depart_id_value = depart_id_obj.value;
		var arrival_id_value = arrival_id_obj.value;
		var depart_name = id_citys[depart_id_value];
		var arrival_name = id_citys[arrival_id_value];
		var depart_id_latitude = Number(latitudes[depart_name]);
		var depart_id_longitude = Number(longitudes[depart_name]);
		var arrival_id_latitude = Number(latitudes[arrival_name]);
		var arrival_id_longitude = Number(longitudes[arrival_name]);
		if (arrival_id_old > 0 && polyline)
		{
			map.removeOverlay(polyline)			
		}
		var polyOptions = {geodesic:true};	         	
		var line_from = new GLatLng(depart_id_latitude,depart_id_longitude);
		var line_to = new GLatLng(arrival_id_latitude,arrival_id_longitude);
		polyline = new GPolyline([line_from, line_to], "#ff0000", 2, 1, polyOptions);
		map.addOverlay(polyline);
		//var points = [];
		//points.push(line_from);
		//points.push(line_to);		
		//addArrows(points,map);
	}
}


function init_map_option_depart()
{
	var depart_obj = document.getElementById("sbus_from_id");
	var arrival_obj = document.getElementById("sbus_to_id");
	var depart_select_obj = document.getElementById("bus_from");
	var arrival_select_obj = document.getElementById("bus_to");	
	var onfoucs_value_obj = document.getElementById('onfoucs_value');
	if (depart_obj)
	{
		depart_obj.value = "Departure City";
	}
	if (arrival_obj)
	{
		arrival_obj.value = "Arrival City";
	}
	if (depart_select_obj)
	{
		depart_select_obj.options[0].selected=true;
	}
	if (arrival_select_obj)
	{
		arrival_select_obj.options[0].selected=true;
	}
	if (onfoucs_value_obj)
	{
		onfoucs_value_obj.value = "";
	}
	update_bus_to("");
}

function loadfixedmap(latitudestr,longitudestr,namestr,nthdaystr)
{
	if (GBrowserIsCompatible())
	{							
		var latArray = latitudestr.split(";");
		var lngArray = longitudestr.split(";"); 
		var nameArray = namestr.split(";"); 
		var nthdayArray = nthdaystr.split(";");
		mapFixed = new GMap2(document.getElementById("fiexdtourmap"));			
		var center = getCenterpoint(latitudestr,longitudestr);
		var point = new GLatLng(center['lat'], center['lng']);
		var zoom = getZoom(latitudestr,longitudestr);			
		mapFixed.setCenter(point,zoom);
		mapFixed.disableDoubleClickZoom();
        mapFixed.addControl(new GLargeMapControl());
		mapFixed.addControl(new GMapTypeControl());	
		mapFixed.disableDoubleClickZoom();
		var points = [];
	    var icons = [];
		for (var i=0; i<latArray.length; i++)    
	    {
		    points.push(new GLatLng(parseFloat(latArray[i]),parseFloat(lngArray[i])));
		    var tilt = getTilt(latArray,lngArray,i);
		    var imageName = "/images/mapbitblue" + tilt + nthdayArray[i] + ".png";				    	    
		    var	size = new GSize(18, 30);
		    var anchor = new GPoint(8, 30); 
		    if(tilt!=null && tilt == "tiltr")
		    {
		    	size = new GSize(30, 22);
		    	anchor = new GPoint(1, 21); 
		    }
		    if(tilt!=null && tilt == "tiltl")
		    {
		    	size = new GSize(30, 22);
		    	anchor = new GPoint(29, 21); 
		    } 				     				    	
			var icon = new GIcon();
			var config ={image: imageName,
			iconSize : size,
			iconAnchor : anchor
			};	
			for (var key in config) {
				icon[key] = config[key];
			}	
			icons.push(icon);		      
	    }
		for (var i=0; i<points.length; i++)    
	    {
	    	var day = parseInt(nthdayArray[i]);			    	
        	var marker = new GMarker(points[i],{clickable: true, title: nameArray[i], icon:icons[i]});
			makerArrayFixed[day-1].push(marker);
			tourFixedMarkers.push(marker);
	    }
		addArrows(points,mapFixed);				    
		for (var i=0; i<totalDay; i++)
	    {
	    	for(var j=0; j<makerArrayFixed[i].length; j++)
	    	{
				addMouseDownListener(makerArrayFixed[i][j],i+1);
				mapFixed.addOverlay(makerArrayFixed[i][j]);
			}
	    }
	    var pointNumArray = [];
		for (var i=0; i<totalDay; i++)
	    {
	    	var  count = makerArrayFixed[i].length;
			pointNumArray.push(count);
	    }
		addPolyline(points,pointNumArray,mapFixed);	
		addStartMarker(points,mapFixed);
		addEndMarker(points,mapFixed);
	}
	document.getElementById("con_one_6").style.display="none";
}
function loadMap()
{
	if(window.addEventListener)
	{		
		window.addEventListener("load",loadfixedmapinter,true);		
		window.addEventListener("unload",GUnload,true);
	}
	if(window.attachEvent)
	{	
		window.attachEvent("onload",loadfixedmapinter);	
		window.attachEvent("onunload",GUnload);
	}
}
