

	function gm_setCookie( name, value, expires, path, domain, secure ) {
		var today = new Date();
		today.setTime( today.getTime() );
		if ( expires ) {
			expires = expires * 1000 * 60 * 60 * 24;
		}
		var expires_date = new Date( today.getTime() + (expires) );
		document.cookie = name+"="+escape( value ) +
			( ( expires ) ? ";expires="+expires_date.toGMTString() : "" ) + //expires.toGMTString()
			( ( path ) ? ";path=" + path : "" ) +
			( ( domain ) ? ";domain=" + domain : "" ) +
			( ( secure ) ? ";secure" : "" );
	}


	function startup_disable_stylesheet() {
	  var i, a;
	  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) 
	  {
	  
		if(a.getAttribute("rel").indexOf("style") != -1	//10
		   && a.getAttribute("rel").indexOf("alt") == 0	//0
		   && a.getAttribute("title")
		   ) 
		   {
				a.disabled = true;
		   }
	  }
	  return null;
	}
	
	
	
	function toggle_ash(title) 
	{
		var i, a, main;
		for(i=0; (a = document.getElementsByTagName("link")[i]); i++)
		{
			
			if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) 
			{
				
				if(a.getAttribute("title") == title) 	//we act on this one
				{
					
					a.disabled = a.disabled ? false : true;
					
				}
				
			}
		}
	}
	
	function set_ash(title, disable) 
	{
		var i, a, main;
		disable = disable ? true : false;
		for(i=0; (a = document.getElementsByTagName("link")[i]); i++)
		{
			
			if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) 
			{
				if(a.getAttribute("title") == title) 	//we act on this one
				{
					a.disabled = disable;
					//alert('disabled of ' + title + ' becomes ' + a.disabled);
				}
				
			}
		}
	}
	
	function set_zoom_ss(zoom, j, k)
	{
		for(i=j; i <= k; i++)
		{
			if(i == zoom)
				set_ash('zoom' + i, false);
			else
				set_ash('zoom' + i, true);
		
		
		}
	}

	function getActiveStyleSheet() {
	  var i, a;
	  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
		if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
	  }
	  return null;
	}
	
	function getPreferredStyleSheet() {
	  var i, a;
	  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
		if(a.getAttribute("rel").indexOf("style") != -1
		   && a.getAttribute("rel").indexOf("alt") == -1
		   && a.getAttribute("title")
		   ) return a.getAttribute("title");
	  }
	  return null;
	}

	function getSelectedId(text, li) {
		document.getElementById("place_id").value=li.id;
	}
	
	
			function start_train_journey(station_id, finish)
		{
				
				/*
				/www/vhosts/bloxi.jp/htdocs/wp-content/mu-plugins/google/trains/journey_planner.php
				*/
				if(station_id && ! finish)
				{
					journey_planner_start = station_id;
				alert('Now navigate to another train station and click it.');
			
				
			}else if(station_id && finish){
				//journey_planner_start = station_id;
				alert('Alert: click and wait a few seconds which we plan your journey.');
				
				 train_search(station_id, finish);
			
			}else{
			
				//we cancel
			
			}
			
			
			/*
			mmo.removeMarker(gmarkersst12);

			
			//updateMarkers();
			alert('mm clear');
			*/
			var bounds = map.getBounds();
  			var sw = bounds.getSouthWest();
  			var ne = bounds.getNorthEast();
  		
  			var sw = bounds.getSouthWest();
  			var ne = bounds.getNorthEast();
  			var center = map.getCenter();
  			var zoom = map.getZoom();
  			
			update_list(center, sw, ne, 'gm_map_output', zoom, '', 'train');
			
		}
		
		function train_search(start, finish)
		{
		
			var request = GXmlHttp.create();
			
			//alert("/wp-content/mu-plugins/google/trains/journey_planner.php?start="+start+"&finish="+finish);
			
			request.open("GET", "/wp-content/mu-plugins/google/trains/journey_planner.php?start="+start+"&finish="+finish, true);
						
			request.onreadystatechange = function()
			{
				
				if (request.readyState == 4)
				{
				
					
					
					var xmlDoc = request.responseXML;
					
					
					 // obtain the array of markers and loop through it
					var searchresult = xmlDoc.documentElement.getElementsByTagName("t");
					
					/*
					
					<trains>
<t id="1141543" lat="36.57811737" lon="136.64816284" ne="Kanazawa Station"/>
<t id="1141542" lat="36.55321121" lon="136.62123108" ne=""/>
</trains>
					*/
					
					
					for (var i = 0; i < searchresult.length; i++) 
					{
						var lng2 = 0;
						var lat2 = 0;
						var lat1 = parseFloat(searchresult[i].getAttribute("lat1"));
						var lng1 = parseFloat(searchresult[i].getAttribute("lon1"));
						var lat2 = parseFloat(searchresult[i].getAttribute("lat2"));
						var lng2 = parseFloat(searchresult[i].getAttribute("lon2"));
						var a = searchresult[i].getAttribute("a");
						var lc = searchresult[i].getAttribute("color");
						
						var train_id = searchresult[i].getAttribute("id");
						
						lc = lc ? '#'+lc : '#333333';
						
						if(a == 'stay')
						{
						
							var polyline = new GPolyline
							([
								new GLatLng( lat2, lng2 ),
								new GLatLng( lat1, lng1 )
							], lc, 5, 1
							);
							map.addOverlay(polyline);
						}
						
					}
					
					//this causes the map to be centred which updates the data through the listener anyway
					//which we don't want
					
					//we should update the marker though
					
					
				}
				
			}
			request.send(null);
			return;
		
		}
		
		
      
      function gm_process(form) {
        // == obtain the data
        var description = form.description.value;
        var marker_type = form.marker_type.value;
        var address_id = form.address_id.value;
        var english = form.english.value;
        var kanji = form.kanji.value;
        var romaji = form.romaji.value;
        
        if(marker_type == '')
        {
        	alert("You must choose a value from the drop down menu!");
        	return false;
        
        }
        
       	if(english == '')
        {
        	alert("You must enter a name for this place/object!");
        	return false;
        
        }
        
       
		var jfid = form.jfoto_id.value;
		
		var optional_type = form.optional_type.value;
		var address = form.the_address.value;
        
        var lat = lastmarker.getPoint().lat();
        var lng = lastmarker.getPoint().lng();
        var url = "/wp-content/mu-plugins/google/ajax/process_form.php";

	 	GDownloadUrl
	 	( url, function(doc){},
			"address_id=" + address_id + "&address=" + address + "&optional_type=" + optional_type + "&english=" + english + "&romaji=" + romaji + "&kanji=" + kanji + "&lat=" +lat+ "&lng=" +lng+ "&description="+description+"&marker_type="+marker_type+"&jfoto_id="+jfid
		);
        
        

        // == remove the input marker and replace it with a completed marker
        map.closeInfoWindow();
        /*
        var marker = createMarkertmp(lastmarker.getPoint(),details);
        GEvent.trigger(marker,"click");
        */
        
       	var bounds = map.getBounds();
  		var sw = bounds.getSouthWest();
  		var ne = bounds.getNorthEast();
  		
  		var sw = bounds.getSouthWest();
  		var ne = bounds.getNorthEast();
  		
  		
  		var zoom = '';
  		nomove = 1;	//stop the listener updating with update_list()
  		map.setCenter(new GLatLng(lat, lng), 14);	
  		nomove = 0;
  		
  		
  		custom_open = 0;
  		toggle_single_click('off');
  		map.removeOverlay(lastmarker);
  		
		//update_list(center, sw, ne, 'gl_output', zoom, '', 'custom_added');
		update_list(-2, 0, 0, 'gm_map_output', '', '', 'custom_added');

      }
      

      
 function custom_action(point)
 {

 	
 	if(journey_planner_start > 0)
 	{
 		/* we start at this station */
 	
 	}
 	else if(singleclickadd == 1)
 	{
 		
 		createInputMarker(point);

 	}else{
 	
 		
 		return false;
 	
 	}
 
 
 }
 
 function clearMarkers2() {
  	mm.clearMarkers();
}

function toggle_elabel3()
	 {
		toggle_ash('labeloff');
	
	}
	
	function toggle_tt(doit, which)
	{
	
	
	
	}
 
	 function toggle_single_click(doit, which)
	 {
		which = which ? which : 'custom-add-help';
		target = document.getElementById( which );
		if(doit == 'off')
		{
			target.style.display = "none";
			singleclickadd = 0;
			return;
		}
		else if(doit == 'on')
		{
			target.style.display = "";
			singleclickadd = 1;
			return;
		}
		
		
		if (target.style.display == "none"){
				target.style.display = "";
				singleclickadd = 1;
		} else {
			target.style.display = "none";
			singleclickadd = 0;
		}
		
		
	 }
     
      // == creates a "normal" marker
      function createMarkertmp(point,text) {
        var marker = new GMarker(point);
        GEvent.addListener(marker,"click", function() {
          marker.openInfoWindow(document.createTextNode(text));
        });
        map.addOverlay(marker);
        return marker;
      }
      
      function fitMap( map, points ) {
		   var bounds = new GLatLngBounds();
		   for (var i=0; i< points.length; i++) {
			  bounds.extend(points[i]);
		   }
		   map.setZoom(map.getBoundsZoomLevel(bounds));
		   map.setCenter(bounds.getCenter());
		}
		
			function createTabbedMarker(point,htmls,labels,icon) {
        var marker = new GMarker(point,icon);
        GEvent.addListener(marker, "click", function() {
          // adjust the width so that the info window is large enough for this many tabs
          if (htmls.length > 2) {
            htmls[0] = '<div style="width:'+htmls.length*88+'px">' + htmls[0] + '</div>';
          }
          var tabs = [];
          for (var i=0; i<htmls.length; i++) {
            tabs.push(new GInfoWindowTab(labels[i],htmls[i]));
          }
          marker.openInfoWindowTabsHtml(tabs);
        });
        return marker;
      }

	function entitymarker(lat,lng,title,type,marker,info,tooltip,zoomlevel,mid)
	{
		this.lat = lat;
		this.lng = lng; 
		this.title = title; 
		this.type = type; 
		this.marker = marker; 
		this.info = info;
		this.tooltip = tooltip;
		this.zoomlevel = zoomlevel;
		this.mid = mid;
	}

	function highlight_data(mid, color)
	{
		document.getElementById('place'+mid).style.background=color;
	
	}
	
	function do_search(q, place_id)
	{
	
		var request = GXmlHttp.create();
		request.open("GET", "/wp-content/mu-plugins/google/xml/romaji_map.php?place_id="+place_id+"&q="+q, true);
		
		//alert("/wp-content/mu-plugins/google/xml/romaji_map.php?place_id="+place_id+"&q="+q);
		
		request.onreadystatechange = function()
		{
			
			if (request.readyState == 4)
			{
			
				
				
				var xmlDoc = request.responseXML;
				
				
				 // obtain the array of markers and loop through it
				var searchresult = xmlDoc.documentElement.getElementsByTagName("m");
				
				
				
				for (var i = 0; i < searchresult.length; i++) 
				{
					var lat = parseFloat(searchresult[i].getAttribute("y"));
					var lng = parseFloat(searchresult[i].getAttribute("x"));
					var location_id = searchresult[i].getAttribute("i");
					//alert(location_id);
				}
				if(location_id > 0)
				{
				
					search_return = location_id;
					map.setCenter(new GLatLng(lat, lng), 16);
				}
				//this causes the map to be centred which updates the data through the listener anyway
				
				
				//we should update the marker though
				
				
			}
			
		}
		request.send(null);
		return;
	
	}


	function update_status_div(state, msg2)
	{
		var msg = '';
		if(is_defined(status_div)){
			
			switch(state)
			{

				case "PRUNED":msg="Too many locations to display. Zoom in to see more.";break;
	
				case "LOADING":msg="<div class='gmstatus'><img height='10' src='/manage/pics/loading_circle.gif' alt = 'loading' /> Loading data.</div>";break;
				
				case "LOADING2":msg="-- Loading data.";break;
				
				case "LOADINGB":msg="-- Loading data (B).";break;
				
				case "DEBUG":msg=msg2;break;
	
				case "NORESULTS":msg="<strong>Sorry: No results returned.</strong>";break;
	
				case "NOEXACTMATCH":msg="<strong>Error: </strong> Could not find your exact location. Try revising your search.";break;
	
				case "":msg="";
				
				break;
			
			}

			document.getElementById(status_div).innerHTML=msg;
			
		}
	
	
	}
	
	function is_defined(i){

		return(typeof i!='undefined');
		
	}
	
	function icon_update(zoom)
	{
		return;
	}
	
	function gdebug (obj, look)
	{
		var temp;
		var newlook;
		
		for (var x in obj)
		{
			temp += obj[x];
		
			
			//newlook = look.replace('test', '');
			//alert(newlook);
			if(newlook != look)
			{
				temp += x + ": " + look + "\n";
				//alert(look);
			}
		}
		alert(temp)
	}
	
	function gurlencode(str) {
		str = escape(str);
		str = str.replace('+', '%2B');
		str = str.replace('%20', '+');
		str = str.replace('*', '%2A');
		str = str.replace('/', '%2F');
		str = str.replace('@', '%40');
		return str;
	}

	
	function clearmarkers(zl)
	{
		var keeplist = [];
		
		for (var i=0;i<gmarkers.length;i++) {
		if (gmarkers[i].zoomlevel == zl) {
			
			map.removeOverlay(gmarkers[i].marker);
		
		
		} else {
		
			keeplist.push(gmarkers[i]);
		
		
		}
		}
		gmarkers = [];
		for (var i=0;i<keeplist.length;i++) {
		gmarkers.push(keeplist[i]);
		}
	}
	
	 String.prototype.replaceAll = function(
		 strTarget, // The substring you want to replace
		 strSubString // The string you want to replace in.
		 ){
		 var strText = this;
		 var intIndexOfMatch = strText.indexOf( strTarget );
		  
		 // Keep looping while an instance of the target string
		 // still exists in the string.
		 while (intIndexOfMatch != -1){
		 // Relace out the current instance.
		 strText = strText.replace( strTarget, strSubString )
		  
		 // Get the index of any next matching substring.
		 intIndexOfMatch = strText.indexOf( strTarget );
		 }
		  
		 // Return the updated string with ALL the target strings
		 // replaced out with the new substring.
		 return( strText );
 }
 
 
 	var iconBlue = new GIcon(); 
    iconBlue.image = 'http://labs.google.com/ridefinder/images/mm_20_blue.png';
    iconBlue.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iconBlue.iconSize = new GSize(12, 20);
    iconBlue.shadowSize = new GSize(22, 20);
    iconBlue.iconAnchor = new GPoint(6, 20);
    iconBlue.infoWindowAnchor = new GPoint(5, 1);
    
    var iconGray = new GIcon(); 
    iconGray.image = 'http://labs.google.com/ridefinder/images/mm_20_gray.png';
    iconGray.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iconGray.iconSize = new GSize(12, 20);
    iconGray.shadowSize = new GSize(22, 20);
    iconGray.iconAnchor = new GPoint(6, 20);
    iconGray.infoWindowAnchor = new GPoint(5, 1);

    var iconRed = new GIcon(); 
    iconRed.image = 'http://labs.google.com/ridefinder/images/mm_20_red.png';
    iconRed.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iconRed.iconSize = new GSize(12, 20);
    iconRed.shadowSize = new GSize(22, 20);
    iconRed.iconAnchor = new GPoint(6, 20);
    iconRed.infoWindowAnchor = new GPoint(5, 1);

	var iconGreen = new GIcon(); 
    iconGreen.image = 'http://labs.google.com/ridefinder/images/mm_20_green.png';
   iconGreen.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iconGreen.iconSize = new GSize(12, 20);
    iconGreen.shadowSize = new GSize(22, 20);
    iconGreen.iconAnchor = new GPoint(6, 20);
    iconGreen.infoWindowAnchor = new GPoint(5, 1);
    
     var iconOrange = new GIcon(); 
    iconOrange.image = 'http://labs.google.com/ridefinder/images/mm_20_orange.png';
    iconOrange.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iconOrange.iconSize = new GSize(12, 20);
    iconOrange.shadowSize = new GSize(22, 20);
    iconOrange.iconAnchor = new GPoint(6, 20);
    iconOrange.infoWindowAnchor = new GPoint(5, 1);
    
    var iconYellow = new GIcon(); 
    iconYellow.image = 'http://labs.google.com/ridefinder/images/mm_20_yellow.png';
    iconYellow.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iconYellow.iconSize = new GSize(12, 20);
    iconYellow.shadowSize = new GSize(22, 20);
    iconYellow.iconAnchor = new GPoint(6, 20);
    iconYellow.infoWindowAnchor = new GPoint(5, 1);
    

    
	var iconPurple = new GIcon(); 
    iconPurple.image = 'http://labs.google.com/ridefinder/images/mm_20_purple.png';
    iconPurple.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iconPurple.iconSize = new GSize(12, 20);
    iconPurple.shadowSize = new GSize(22, 20);
    iconPurple.iconAnchor = new GPoint(6, 20);
    iconPurple.infoWindowAnchor = new GPoint(5, 1);
    
    var iconBlack = new GIcon(); 
    iconBlack.image = 'http://labs.google.com/ridefinder/images/mm_20_black.png';
    iconBlack.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iconBlack.iconSize = new GSize(12, 20);
    iconBlack.shadowSize = new GSize(22, 20);
    iconBlack.iconAnchor = new GPoint(6, 20);
    iconBlack.infoWindowAnchor = new GPoint(5, 1);
    
    var iconStation = new GIcon(); 
    iconStation.image = '/manage/googlemaps_icons/transport/train2sm.gif';
    iconStation.iconSize = new GSize(10, 15);
    iconStation.iconAnchor = new GPoint(3, 5);
    iconStation.infoWindowAnchor = new GPoint(5, 1);
    
    var iconCY10 = new GIcon(); 
    iconCY10.image = '/manage/googlemaps_icons/transport/circle-yellow-10.gif';
    iconCY10.iconSize = new GSize(10, 10);
    iconCY10.iconAnchor = new GPoint(5, 5);
    iconCY10.infoWindowAnchor = new GPoint(5, 1);
    
    var iconRG10 = new GIcon(); 
    iconRG10.image = '/manage/googlemaps_icons/transport/ring-green-10.gif';
    iconRG10.iconSize = new GSize(10, 10);
    iconRG10.iconAnchor = new GPoint(5, 5);
    iconRG10.infoWindowAnchor = new GPoint(5, 1);
    
     var iconCB10 = new GIcon(); 
    iconCB10.image = '/manage/googlemaps_icons/transport/circle-blue-10.gif';
    iconCB10.iconSize = new GSize(10, 10);
    iconCB10.iconAnchor = new GPoint(5, 5);
    iconCB10.infoWindowAnchor = new GPoint(5, 1);
    
     var iconCG10 = new GIcon(); 
    iconCG10.image = '/manage/googlemaps_icons/transport/circle-green-10.gif';
    iconCG10.iconSize = new GSize(10, 10);
    iconCG10.iconAnchor = new GPoint(5, 5);
    iconCG10.infoWindowAnchor = new GPoint(5, 1);
    
	var iconSL10 = new GIcon(); 
    iconSL10.image = '/manage/googlemaps_icons/transport/square-lime-10.gif';
    iconSL10.iconSize = new GSize(10, 10);
    iconSL10.iconAnchor = new GPoint(5, 5);
    iconSL10.infoWindowAnchor = new GPoint(5, 1);
    
    var iconSUBWAY = new GIcon(); 
    iconSUBWAY.image = '/manage/googlemaps_icons/transport/trains/red.gif';
    iconSUBWAY.iconSize = new GSize(12, 12);
    iconSUBWAY.iconAnchor = new GPoint(5, 5);
    iconSUBWAY.infoWindowAnchor = new GPoint(5, 1);
    
    
    var iconRE = new GIcon(); 
    iconRE.image = '/manage/googlemaps_icons/transport/trains/ring/re.gif';
    iconRE.iconSize = new GSize(12, 12);
    iconRE.iconAnchor = new GPoint(5, 5);
    iconRE.infoWindowAnchor = new GPoint(5, 1);
    
    
    

	var iconSK = new GIcon(); 
    iconSK.image = '/manage/googlemaps_icons/transport/trains/ring/sk.gif';
    iconSK.iconSize = new GSize(12, 12);
    iconSK.iconAnchor = new GPoint(5, 5);
    iconSK.infoWindowAnchor = new GPoint(5, 1);

	var iconSI = new GIcon(); 
    iconSI.image = '/manage/googlemaps_icons/transport/trains/ring/si.gif';
    iconSI.iconSize = new GSize(12, 12);
    iconSI.iconAnchor = new GPoint(5, 5);
    iconSI.infoWindowAnchor = new GPoint(5, 1);
    
     var iconRU = new GIcon(); 
    iconRU.image = '/manage/googlemaps_icons/transport/trains/ring/ru.gif';
    iconRU.iconSize = new GSize(12, 12);
    iconRU.iconAnchor = new GPoint(5, 5);
    iconRU.infoWindowAnchor = new GPoint(5, 1);
    
	var iconRO = new GIcon(); 
    iconRO.image = '/manage/googlemaps_icons/transport/trains/ring/ro.gif';
    iconRO.iconSize = new GSize(12, 12);
    iconRO.iconAnchor = new GPoint(5, 5);
    iconRO.infoWindowAnchor = new GPoint(5, 1);
    
    var iconRE = new GIcon(); 
    iconRE.image = '/manage/googlemaps_icons/transport/trains/ring/re.gif';
    iconRE.iconSize = new GSize(12, 12);
    iconRE.iconAnchor = new GPoint(5, 5);
    iconRE.infoWindowAnchor = new GPoint(5, 1);
    
    var iconREMINI = new GIcon(); 
    iconREMINI.image = '/manage/googlemaps_icons/transport/trains/ring/re-mini.gif';
    iconREMINI.iconSize = new GSize(8, 8);
    iconREMINI.iconAnchor = new GPoint(5, 5);
    iconREMINI.infoWindowAnchor = new GPoint(5, 1);
    
	var iconRETINY = new GIcon(); 
    iconRETINY.image = '/manage/googlemaps_icons/transport/trains/ring/re-tiny.gif';
    iconRETINY.iconSize = new GSize(6, 6);
    iconRETINY.iconAnchor = new GPoint(3, 3);
    iconRETINY.infoWindowAnchor = new GPoint(5, 1);
    
     var iconPU = new GIcon(); 
    iconPU.image = '/manage/googlemaps_icons/transport/trains/ring/pu.gif';
    iconPU.iconSize = new GSize(12, 12);
    iconPU.iconAnchor = new GPoint(5, 5);
    iconPU.infoWindowAnchor = new GPoint(5, 1);
    
     var iconPI = new GIcon(); 
    iconPI.image = '/manage/googlemaps_icons/transport/trains/ring/pi.gif';
    iconPI.iconSize = new GSize(12, 12);
    iconPI.iconAnchor = new GPoint(5, 5);
    iconPI.infoWindowAnchor = new GPoint(5, 1);
    
     var iconOR = new GIcon(); 
    iconOR.image = '/manage/googlemaps_icons/transport/trains/ring/or.gif';
    iconOR.iconSize = new GSize(12, 12);
    iconOR.iconAnchor = new GPoint(5, 5);
    iconOR.infoWindowAnchor = new GPoint(5, 1);
    
     var iconLE = new GIcon(); 
    iconLE.image = '/manage/googlemaps_icons/transport/trains/ring/le.gif';
    iconLE.iconSize = new GSize(12, 12);
    iconLE.iconAnchor = new GPoint(5, 5);
    iconLE.infoWindowAnchor = new GPoint(5, 1);
    
     var iconGR = new GIcon(); 
    iconGR.image = '/manage/googlemaps_icons/transport/trains/ring/gr.gif';
    iconGR.iconSize = new GSize(12, 12);
    iconGR.iconAnchor = new GPoint(5, 5);
    iconGR.infoWindowAnchor = new GPoint(5, 1);
    
     var iconGO = new GIcon(); 
    iconGO.image = '/manage/googlemaps_icons/transport/trains/ring/go.gif';
    iconGO.iconSize = new GSize(12, 12);
    iconGO.iconAnchor = new GPoint(5, 5);
    iconGO.infoWindowAnchor = new GPoint(5, 1);
    
     var iconEM = new GIcon(); 
    iconEM.image = '/manage/googlemaps_icons/transport/trains/ring/em.gif';
    iconEM.iconSize = new GSize(12, 12);
    iconEM.iconAnchor = new GPoint(5, 5);
    iconEM.infoWindowAnchor = new GPoint(5, 1);
    
     var iconBR = new GIcon(); 
    iconBR.image = '/manage/googlemaps_icons/transport/trains/ring/br.gif';
    iconBR.iconSize = new GSize(12, 12);
    iconBR.iconAnchor = new GPoint(5, 5);
    iconBR.infoWindowAnchor = new GPoint(5, 1);
    
     var iconBL = new GIcon(); 
    iconBL.image = '/manage/googlemaps_icons/transport/trains/ring/bl.gif';
    iconBL.iconSize = new GSize(12, 12);
    iconBL.iconAnchor = new GPoint(5, 5);
    iconBL.infoWindowAnchor = new GPoint(5, 1);
    
   
      var iconOL = new GIcon(); 
    iconOL.image = '/manage/googlemaps_icons/transport/trains/train/ol.gif';
   iconOL.iconSize = new GSize(10, 15);
    iconOL.iconAnchor = new GPoint(3, 5);
    iconOL.infoWindowAnchor = new GPoint(5, 1);
   

    var customIcons = [];
    //customIcons["accurate"] = iconBlue;
	
	customIcons["major"] = iconPurple;
	customIcons["big"] = iconRed;
	customIcons["city"] = iconRed;
	
	customIcons["small"] = iconYellow;
	customIcons["town"] = iconGreen;
	customIcons["village"] = iconGray;
	customIcons["none"] = iconBlue;
	//customIcons["search"] = iconRed;
	//customIcons["city"] = iconCircle;
	customIcons["prefecture"] = iconGray;
	//customIcons["search"] = iconGreen;
	customIcons["station"] = iconStation;
	customIcons["station2"] = iconRed;
	customIcons["iconGreen"] = iconGreen;
	customIcons["iconRed"] = iconRed;
	
	customIcons["show10"] = iconCY10;
	customIcons["show9"] = iconCY10;
	customIcons["city1011"] = iconCY10;
	
	customIcons["district"] = iconCG10;
	
	customIcons["iconCB10"] = iconCB10;
	
	customIcons["show8"] = iconCY10;
	customIcons["show7"] = iconCY10;
	customIcons["show6"] = iconCY10;
	
	customIcons["iconOrange"] = iconOrange;
	
	customIcons["default"] = iconCG10;
	
	customIcons["sl10"] = iconSL10;
	
	customIcons["sw"] = iconSUBWAY;
	
	customIcons["bl"] = iconBL;
	customIcons["br"] = iconBR;
	customIcons["em"] = iconEM;
	customIcons["go"] = iconGO;
	customIcons["gr"] = iconGR;
	customIcons["le"] = iconLE;
	customIcons["or"] = iconOR;
	customIcons["pi"] = iconPI;
	customIcons["pu"] = iconPU;
	customIcons["re"] = iconRE;
	customIcons["remini"] = iconREMINI;
	customIcons["retiny"] = iconRETINY;
	customIcons["ro"] = iconRO;
	customIcons["ru"] = iconRU;
	customIcons["si"] = iconSI;
	customIcons["sk"] = iconSK;
	
	customIcons["ol"] = iconStation;
		
	customIcons["er"] = iconRE;	//yyy change this - red for error
	
	
	function gm_user_form(address, id, redirect_to)
	{
		
		if(!id)
		{
			
			return '<div style="color: #900; font-size: 14px;">You need to <a href="/wp-login.php?redirect_to='+redirect_to+'">Login</a> to use this feature.</div>';
			
	
		}
		 var iwform =     		
		'<div id="custom-info-add" style = "margin-bottom: 4px"><form action="#" onsubmit="gm_process(this); return false"><div>This is a <select id="marker_type" name="marker_type">'
		+ '<option value="" id="selectone">Select One:</option>'
		+ '<optgroup label="Eating and Drinking">'
		+ '<option value ="eat-bar">Bar</option>'
		+ '<option value ="eat-gaijinbar">\'Gaijin Bar\'</option>'
		+ '<option value ="eat-japanese">Restaurant (Japanese)</option>'
		+ '<option value ="eat-international">Restaurant (International)</option>'
		+ '<option value ="eat-western">Restaurant (Western)</option>'
		+ '<option value ="eat-izakaya">Izakaya</option>'
		+ '<option value ="eat-other" class = "other">Other</option>'
		+ '</optgroup>'
		+ '<optgroup label="Places to Stay">'
		+ '<option value ="stay-hotel">Hotel</option>'
		+ '<option value ="stay-ryokan">Ryokan</option>'
		+ '<option value ="stay-hostel">Hostel</option>'
		+ '<option value ="stay-other"  class = "other">Other</option>'
		+ '</optgroup>'
		+ '<optgroup label="Sightseeing">'
		+ '<option value ="ss-museum">Museum</option>'
		+ '<option value ="ss-castle">Castle</option>'
		+ '<option value ="ss-temple">Temple (Tera)</option>'
		+ '<option value ="ss-shrine">Shrine (Jinja)</option>'
		+ '<option value ="ss-garden">Garden</option>'
		+ '<option value ="ss-gallery">Gallery</option>'
		+ '<option value ="ss-nature">Nature</option>'
		+ '<option value ="ss-poi">Place of Interest</option>'
		+ '<option value ="ss-other"  class = "other">Other</option>'
		+ '</optgroup>'
		+ '<optgroup label="Shopping">'
		+ '<option value ="shop-electronics">Electronics</option>'
		+ '<option value ="shop-souvenir">Souvenir</option>'
		+ '<option value ="shop-dept">Department Store</option>'
		+ '<option value ="shop-food">Food</option>'
		+ '<option value ="shop-other"  class = "other">Shopping other...</option>'
		+ '</optgroup>'
		/*
		+ '<optgroup label="Events etc">'
		+ '<option value ="event-festival">Festival</option>'
		+ '<option value ="event-major">Major Event</option>'
		+ '<option value ="event-local">Local Event</option>'
		+ '<option value ="event-small">Small Event</option>'
		+ '<option value ="event-private">Private Event</option>'
		+ '<option value ="event-other"  class = "other">Event Other...</option>'
		+ '</optgroup>'
		*/
		+ '<optgroup label="Map Items">'
		+ '<option value ="map-junction">Junction</option>'
		+ '<option value ="map-building">Building</option>'
		+ '<option value ="map-other"  class = "other">Other</option>'
		+ '</optgroup>'
		+ '<optgroup label="Other">'
		+ '<option value ="other-info">Useful Info</option>'
		+ '<option value ="other-other"  class = "other">Miscellaneous</option>'
		+ '</optgroup>'
		+ '</select><strong class="required">*</strong>'
		+ '<div>Type (optional) <input name="optional_type" type="text" size="10" maxlength="80" /> ex. <strong style = "color:#900;">Yakitori</strong></div>'
		+ '</div>'
		/*
		+ '<div>Date (if event) <input name="event_date" type="text" size="10" maxlength="80" value = "yyyy-mm-dd" /> (till <input name="event_date_till" type="text" size="10" maxlength="80" value = "yyyy-mm-dd" />)</div>'
		+ '</div>'
		*/
		+ '<table><tr><td><h3>Name / Title<strong class="required">*</strong></h3><p><input name="english" type="text" size="10" value = "" /></p></td><td><h3>Romaji (Fujisan)</h3><p><input name="romaji" type="text" size="10"   value = "" /></p></td><td><h3>Kanji (富士山)</h3><p><input name="kanji" type="text" size="10"  value = "" /></p></td></tr></table>'
		+ address 
		+ '<div style="margin-left: 2em;"><strong>Optional Building Number for address </strong> (ex 1-3-17): <input name="the_address" id = "the_address" type="text" size="5" maxlength="20" /></div>'
		+ '<div><h3>Description</h3>'
		+ '<div class="p"><textarea name="description" rows="5" cols="40"></textarea></div></div>'
		
		;
		
		
		
		if(id)
		{
	
			iwform += '<div><p><strong>J-Foto Picture ID</strong> (optional) Separate multiple pics with spaces:</p><div class="p">http://j-foto.com/username/photos/<input name="jfoto_id" id="jfoto_id" type="text" size="14" />/ </div></div>'
	
	
		}
		else
		{
			iwform += '<div style="color: #900; font-size: 14px;">You should <a href="/wp-login.php">Login</a> to ensure your additions are added quickly, and to view more options.</div>'
			iwform +=  '<input name="jfoto_id" id="jfoto_id"  type="hidden" value="0" />'
	
		}
		
		iwform +=  '<div><input class="button-primary" type="submit" value="Submit" /></div>'
		iwform +=  '</form>';
		
		
		
		if(id)
		{
			/*
			iwform += "<p><span onclick=\"lastmarker.closeInfoWindow(); Modalbox.show($('gm_settings'), {title: 'The Settings' }) ;return false;\">SHOW MORE OPTIONS</span></p>";
			*/
		
		
		}
		
		
		
		iwform += '</div>';
		
		return iwform;
		
	}
	
	function clean_cdata(text)
	{
		if(!text)
			return '';
		text = text.replace('<![CDA'+'TA[','');
     	text = text.replace(']'+']>','');
	
		return text;
	}
	
	