﻿// JScript File
       
     var tracename =""; 
     var stopDistance ="";
     var isLoggedIn = "false";
     var isGscMember = "false";
     var tldUrl = "";
     var all_stops = new Array();
                      
     // Main controller
     function runroute(trace, sDistance, isComputeStops, loggedIn, gscMember, tldDomain)
     {
        tracename = trace;
        stopDistance = sDistance;
        isLoggedIn = loggedIn;
        isGscMember = gscMember;     
        tldUrl = tldDomain;
               
        try
        {               
            m2i_RDI(selectedStop,tracename,"mapHandler","m", stopDistance); // For map                              
         }
        catch (e)
        {
            //Eat it
            //alert(e.message);	     
         }	
          	       
     }
    
    // Handles the map display and associated elements.
    function mapHandler(data)
     {
     
        if (data.status == 0)
        {
            alert("Cannot determine route, please verify your addresses.");   
             document.getElementById("SpanWaiting").innerHTML = "Please verify your addresses and try again.";         
             document.getElementById("DivMapButton").style.display = 'none'; 
             
	        //alert(data.errormessage);
	        return;
        }
                
        // Map, show/hide button and show map message
        showHide('DivMapButton','block');          
        document.getElementById("MapContainer").style.display = "block";
        document.getElementById("MapHiddenMessage").style.display = "none";
        
        // "Add A Stop" button beneath the map.  Conditional, based on the map display.
        document.getElementById("DivAddStop").style.display = "block";     
        
        try
        {
            createDirectionsHtml(data);
        }
        catch (e)
        {
            alert("Cannot determine route directions.");   
            document.getElementById("SpanWaiting").innerHTML = "Please verify your addresses and try again.";         
            document.getElementById("DivMapButton").style.display = 'none';                   
        }                 	                  
         	
         if (isLoggedIn.toLowerCase() == "true")       
            addlStopsHandler(data);
     }
      
     
     function addlStopsHandler(data)
     {
        // Reverse geocode the suggested stop points.  Required to get the city/region/postal info.
	    // the m2i_RDICallback function formats data.stops in the right format to pass to m2i_geocode, so no further
	    // fiddling with values is needed.

        var suggest_stops = new Array();
	    all_stops = data.stops;
				
		for (var i = 0; i < data.stops.length; i++)
		{
			if (data.stops[i].type == "suggest")
				suggest_stops.push(data.stops[i]);			
		}		    		        
	    m2i_geocode(suggest_stops, 'stopsHandler');
     }
     
     function stopsHandler(data)
     {
          
        if (isLoggedIn.toLowerCase() == "false") 
            return;
                    
        try
        {
            var numSuggesstedStops = 0;
            if (data.addr && data.addr.length > 0)
	            numSuggesstedStops = data.addr.length;  // Computed stop from m2i
	    	  
            document.getElementById("DivStops").innerHTML = getMergedStopHtml(data);
					          
            // Number of suggested stops text
            var divNumstops = document.getElementById("NumStops");           	       	     
	        	      
	       if (numSuggesstedStops > 0)
                htmlout = numSuggesstedStops + ' Mile Markers';
                
            htmlout += '<span class=\"thin\">(See details below to add or remove stops)</span>';
            divNumstops.innerHTML = htmlout;                         
                                          
        }
        catch (e)
        {
            //pbw - 10-26-07 Per GB, don't show anything when stops can't be determined
            //alert("Cannot determine suggested stops.");
            //document.getElementById("SpanWaiting").innerHTML = "Please verify your stop information.";         
            //document.getElementById("DivMapButton").style.display = 'none';         
        }
                                        
     }
     
      function getMergedStopHtml(suggested)
      {
        var htmlout = "";
        var header = "";
      	var isugCnt = 0;
      		
      	for (var i = 1; i < all_stops.length-1; i++) // ignore the 1st and last
		{
	    	var isDup = false;
      
      	    // Don't add stops that are also at the destination
	        if (all_stops[i].type == "route" && all_stops[i].city == all_stops[all_stops.length-1].city && all_stops[i].region == all_stops[all_stops.length-1].region )
				continue;

			// Search for the user specified stops in the selectedStop array			   
		    if (all_stops[i].type == "route")
			{			   
				    header = '<div class=\"lbluebar greensign\" style=\"width:650px\">';
				    header += '<h1><span class=\"green\">SELECTED: </span>'; 
				    
                    htmlout += header;                                                           		   
				    htmlout += createStopHtml(all_stops[i], i);
				    htmlout += '</div></div>';					
			}	
			else
			{
			    
			    // Compare this to see if it's already on the route
	            var sStop = suggested.addr[isugCnt].cand[0];
	            
	            for (var k = 1; k < all_stops.length-2; k++) // ignore the 1st and last
	            {
	                // Compare the suggested stop with all the route stops to see if it already exists as a route stop
	                if (all_stops[k].type == "route" && all_stops[k].city.toUpperCase() == sStop.city.toUpperCase()
	                     && all_stops[k].region == sStop.region.toUpperCase())
	                isDup = true;
		              
    	            if (isDup)
	                   break; // Jump out of this loop
	            }
		            		            
		        
		        if (isDup) 
		        {
		            isugCnt++;
		            continue;  // skip the suggested stop
		        }
		            
			    header = '<div class=\"lbluebar milemarker\" style=\"width:650px\">';
			    // pbw - 08-02-07 change to use GSC Mile Marker per G. Blanco
                header += '<h1><span class=\"red\" style=\"margin-left:15px\">MILE MARKER: </span>';               
                htmlout += header;                                                           
		   
		        htmlout += createStopHtml(suggested.addr[isugCnt].cand[0], i);
		        isugCnt++;
		        htmlout += '</div></div>';	
			}						
			    
		}
		return htmlout; 
      }        
     
         
     function getCampAttrHtml(stop)
     {      
        // NOTE: suggested is not the address of the POI, but of the associated stop.                  
        var htmlout = '';
        for (var i = 0; i < campAttrs.length; i++)
        {	             
			// campAttrs[i] values were not being evaluated in the "if", so I created locals as a workaround,
			// don't have time now to track down why.
		   var city = window.campAttrs[i].city.toLowerCase();  
   		   var state = window.campAttrs[i].state.toLowerCase();
           var country = window.campAttrs[i].country.toLowerCase();
 
		   if (city == stop.city.toLowerCase() && state == stop.region.toLowerCase() && trim(country) == stop.country.toLowerCase())
           {              
                htmlout += '<table><tr><td style="\width:250px;font-size:1.0em\">';
                
                // Campground, Event, Attraction        
                if (campAttrs[i].type.toLowerCase() == "campground") // Campground
                {
                    htmlout += '<a href=\"' + baseUrl + 'travel/campgroundsandrvparks/GeneralInfo.aspx?cgid=';
                    htmlout += campAttrs[i].id + '\" target=_blank>' + campAttrs[i].desc + '</a></td> ' ;               
                }
                else if (campAttrs[i].type.toLowerCase() == "event") // Event
                {
                    if (baseUrl.indexOf('trailer') >= 0)
                        htmlout += '<a href=\"' + baseUrl + 'Explore/EventDetails.aspx?eventid=';
                    else
                        htmlout += '<a href=\"' + baseUrl + 'community/EventDetails.aspx?eventid=';
                        
                    htmlout += campAttrs[i].id + '\" target=_blank>' + campAttrs[i].desc + '</a></td> ' ;               
                }
                //else (campAttrs[i].type.toLowerCase() == "userdefined") // User Defined
                else
                {                   
                    // Dump the description
                    htmlout += campAttrs[i].desc + '</td> ' ;               
                }
                /*
                else 
                {//Don't show hyperlink for NavTeq attractions. Instead, per Aleece (06-21-07 demo), show the address  
                    
                    // Find the POI that matches the campAttr id to get the address
                    for (var j = 0; j < poiData.length; j++)
                    {
                        var poi = poiData[j];
                        if (poi.ownerid == campAttrs[i].id && poi.ownername.toUpperCase() == "NAVTEQ")                    
                        {                                                     
                            // Not all POIs have street, city... info, so we use defaults
		                    var city = (poi.city && poi.region) ? poi.city + ', ' : '';
		                    var state = (poi.region) ? poi.region.toUpperCase() : '';
		                    var street = (poi.street) ? poi.street + ((poi.city) ? ', ' : '') : '';                		    		                    
		                    var phone = (poi.telephone) ? formatPhone(poi.telephone) : '';
                		    
                		    htmlout += poi.description + '<br/>';
                            htmlout += street + city + state + '<br/>';	 
                            htmlout += phone + '</td>';	 
                             
                            break;           
                        }                        	             
                    }                                        
                }   
                */
                // pbw: The JS confirm dialog shows (OK/Cancel).  I searched and could not find a way to change it to Yes/No.
                htmlout += '<td><a href=\"?orig=' + requestorSiteCode + '&a=removeCampAttr&id=' + campAttrs[i].id;
                htmlout += '&type=' + campAttrs[i].type + '\" onclick=\"return confirm(\'Are you sure you want to remove this item?\')\">' ;
                htmlout += 'Remove</a></td>';            
                htmlout += '</tr></table><br/>';
            }
         }
              
         return htmlout;
     }     
     
     function createDirectionsHtml(routeResults)
     {
        var htmlout = '<div><table>';
        var stopIdx = 1;
        var stepCnt = 1;
        	        
        // Create the Directions html
        for (var i = 0; i < routeResults.dir.length-1; i++)
        {
                   
            if (isGscMember == "True" && routeResults.dir[i].text && routeResults.dir[i].type == "Initiate" && i > 1)
            {
                var stop = selectedStop[stopIdx];
                var zip = (stop.postal ? stop.postal : "");
                htmlout += '<tr><td colspan=\"3\"><table class=\"stopbar\" style=\"width:700px\" >';
                
                htmlout += '<tr>';
                htmlout += '<td class="\greensign\" style=\"width:35px\"></td>';
                
                if (selectedStop.length > 2)  // Add user selected stop row
                {
                    htmlout += '<td style=\"width:325px;\">';                 
                    htmlout += '<span style="\font-size:1.1em;font-weight:bold;font-family:arial\">STOP: (' + stopIdx + '): ';
                    htmlout += LStrip(stop.city, 'UNINC ') + ', ' + stop.region + '</span>' ;                
	            }
	            else
	            {
	                htmlout += '<td style=\"width:325px;\">&nbsp;' ;                
	            }
	            
	            htmlout += '<br/><span style=\"font-size:.9em;font-family:arial\">';	            
	            htmlout += '<a target=\"_top\" href=\"'  + baseUrl +  'travel/rvrouteplanner/TripAttractions.aspx?a=&stopId=' + eval(stopIdx+1);
	            htmlout += '&destCity=' + stop.city + '&destState=' + stop.region + '&destCountry=';
	            htmlout += stop.country + '&destZip=' + zip + '\">';	            
	            htmlout += 'Nearby Campgrounds and Attractions</span></a>';
	            	                            
	            htmlout += '</td>';
	            htmlout += '<td style=\"font-size:.9em;vertical-align:top;font-family:arial\">';
				htmlout += '	To edit or remove this stop refer to your <a href=\"javascript:showDirections()\">Trip Itinerary.</a>';			    
			    htmlout += '</td>';			    
			    htmlout += '</tr>';
			    
	            htmlout += '</td><tr></table>';
	            
	            stopIdx++;
            }                
           
            if (routeResults.dir[i].text && (routeResults.dir[i].type != "Leg"))
	        {
	            htmlout += '<tr style=\"font-size:1.0em; \">';
	            htmlout += '<td style=\"width:600px;\">' + stepCnt++ + '. ' 
	            htmlout += routeResults.dir[i].text.replace(/(on unknown)/i,"") + '</td>' ;	
	            
	            if (i > 0 && routeResults.dir[i].distance) {          
	                htmlout += '<td>' +Math.round((routeResults.dir[i].distance/1.609)*100)/100  + ' miles <br/>'
	                htmlout += '(' + routeResults.dir[i].distance  + ' km)</td></tr>' ;	 
	            }
                else
                    htmlout += '<td>&nbsp;</td></tr>' ;	 
                
                htmlout += '<tr><td colspan=\"2\" style=\"border-bottom: #ccc solid 1px;\">&nbsp;</td></tr>' ;	 	                      
	        }
	        
        }
        htmlout += '</table></div>';
             
        document.getElementById('DirectionsText').innerHTML = htmlout;	       
         // The distances are currently returned in kilometers 	      
         var totDistance = Math.round((routeResults.totaldistance)*100)/100; //In Kilometers
        
        // Create the Travel summary html     	     
          htmlout = '<div style=\"height:90px;font-size:1.3em;;font-weight:bold;background-image:url(../../images/tr_dir_summary.gif);background-repeat: no-repeat \">';
          htmlout += '<p style=\"padding-left:70px;padding-top:3px;vertical-align:middle\">Total Miles: ';
          htmlout += Math.round((routeResults.totaldistance/1.609)*100)/100 + " (" + totDistance + " km)";
          htmlout += "<span style=\"margin-left:150px\">Approximate Time: (55 mph) ";
          htmlout += Math.round((routeResults.totaltime/3600)*100)/100 + " (hrs)</span></p>";
          htmlout += "<p style=\"padding-left:80px;\">Approximate Gas Consumption (based on 11 mpg): " + Math.round(((routeResults.totaldistance/1.609)/11)*100)/100 + " Gallons</p>";                 
	      htmlout += "</div>";
          document.getElementById('DirectionsSummary1').innerHTML = htmlout;
          
          // Same as above, but includes the SAVE THIS TRIP button
          htmlout = '<div style=\"height:90px;font-size:1.3em;font-weight:bold;background-image:url(../../images/tr_dir_summary.gif);background-repeat: no-repeat \">';
          htmlout += '<p style=\"padding-left:70px;padding-top:3px;vertical-align:middle\">Total Miles: ';
          htmlout += Math.round((routeResults.totaldistance/1.609)*100)/100 + " (" + totDistance + " km)";
          htmlout += "<span style=\"margin-left:150px\">Approximate Time: (55 mph) ";
          htmlout += Math.round((routeResults.totaltime/3600)*100)/100 + " (hrs)</p>";
          htmlout += "<p style=\"padding-left:80px;\">Approximate Gas Consumption (based on 11 mpg): " + Math.round(((routeResults.totaldistance/1.609)/11)*100)/100 + " Gallons</p>";       
          //htmlout += '<p style=\"float:right;margin-top:5px\"><img src=\"../../images/buttons/save_this_trip_btn.gif\" border=\"0\" /></p>';
	      htmlout += "</div>";
          document.getElementById('DirectionsSummary2').innerHTML = htmlout;
     }
     
	 function createStopHtml(stop, idx)
	 {
   		   var zip = (stop.postal ? stop.postal : "");
		   var htmlout = "";		  	 
	       
	        // Remove UNINC from the city per Aleece												   
		   htmlout += '<span style=\"text-transform:capitalize;\">' + LStrip(stop.city, 'UNINC ') + ', ' + stop.region + '</span></h1>';
		   htmlout += '</div>';
		   
	       // Nearby Camps / Attractions link   
	       htmlout += '\n<div class=\"box\"><div class=\"boxleft\" style="\width:650px\">';
	       htmlout += '<p style=\"margin-bottom:2px\">';
	       htmlout += '<span style="\width:320px\;margin-right:40px">';
	       htmlout += '<a target=\"_top\" href=\"' + baseUrl + 'travel/rvrouteplanner/TripAttractions.aspx?a=&stopId=' + eval(idx+1);
	       htmlout += '&destCity=' + stop.city + '&destState=' + stop.region + '&destCountry=';
	       htmlout += stop.country + '&destZip=' + zip + '\">';
	       htmlout += 'Nearby Campgrounds and Attractions</a></span>\n';
	     /*
	       htmlout += '<span id=\"LblEditStop' + idx + '\"' ;
	       htmlout += 'style="\width:50px;text-align:right;margin-right:80px;font-weight:bold;';
	       htmlout += 'display:none; border-bottom:solid 1px black \">';
	       htmlout += 'EDIT STOP</span><span style=\"width:150px;border-bottom:solid 1px black"\></span> \n';
	       htmlout += '<span id=\"LblMakeNote' + idx + '\"' ;
	       htmlout += 'style="\width:200px;text-align:right;font-weight:bold;display:none;';
	       htmlout += 'border-bottom:solid 1px black \">MAKE A NOTE</span>\n';
	       */
	       htmlout += '</p>';
	       
	       // Add Nearby Camps and Attrs for the suggested stops	          
	      
	       if (campAttrs.length > 0)
	       {
	            htmlout += '<table style="\width:600px;font-size:.9em\"><tr>';       
	            htmlout += '<td style="\width:250px\">';
	            htmlout += getCampAttrHtml(stop);
	            htmlout += '</td>';
	            
	            htmlout += '<td>';
	           // htmlout += getEditStopHtml(stop, idx);
	            htmlout += '</td>';
	            
	            htmlout += '</tr></table>';
	       }
	       /*
	       else
	       {
	            htmlout += '<table style="\width:600px;\"><tr>';       
	            htmlout += '<td style="\width:250px\">&nbsp;</td>';	            	            	            
	            
	            htmlout += '<td style="\font-size:.9em\">';
	            htmlout += getEditStopHtml(stop, idx);
	            htmlout += '</td>';
	            
	            htmlout += '</tr></table>';
	       
	       }
	       */
	       

		return htmlout;
	 }

     function showMap()
     {
       
        var map = document.getElementById("MapContainer");
        map.style.display = mapVisible ? "none" : "block";
      
        // Add A Stop button beneath the map.  This function is used by c CG SearchResults
        // which does not have a DivAddStop, so we check first.
        var divStop = document.getElementById("DivAddStop");
        if (divStop)
            divStop.style.display = mapVisible ? "none" : "block";
        
        // Get the link reference to update the Show/Hide message innerText
        var msg = document.getElementById("MapHiddenMessage");                
        msg.style.display = mapVisible ? "block" : "none";        
        msg.innerHTML = mapVisible ?
        "<br/><br/><img src=\"../../images/icons/usa_icon.gif\" alt=\"\"><b>Your map has been hidden:</b> <a href='javascript:showMap()'>Show Results on Map</a>" :  "";
              
        // Reset
        mapVisible = !mapVisible;
    
        // Change the show/hide button
        var hideLink = document.getElementById("ImgDisplayMap");
        hideLink.src = !mapVisible ? "../../images/buttons/showmap_btn.gif" : "../../images/buttons/hidemap_btn.gif" ;               
     }
         
     function showDirections()
     {
       if (document.getElementById("DivMapButton").style.display == 'none')
          showMap();
        
        showHideStyle('RouteStops', 'block');       	        
        showHideStyle('RouteDirections', 'inline');        
        showHideStyle('SpanViewDirections', 'inline');       	        
        showHideStyle('DirectionsSummary1', 'block');        
        showHideStyle('DirTabs', 'block');
        showHideStyle('TripTabs', 'block');
        showHideStyle('NumStops', 'inline');
        //showHideStyle('DivMapButton', 'block');
     }
     
     
// JSON callback function for the above.  Given the ordered array of POIs,
// use CanvasHotspots to draw them on the map and fill in the hover/click balloons.
// Hover balloons will only have the names, click balloons will have full details
// as well as a link to a new page.
// pbw - 06-04-07 adapted from the m2i_ version to show different POI icons

var poiData = new Array();  // Global

function agi_POIDetailsOnMap()
{
	var data,city,region,country,idx;
	// determine the arguments.
	switch(arguments.length)
	{
		case 5:
			city = arguments[0];
			region = arguments[1];
			country = arguments[2];
			idx = arguments[3];
			data = eval(arguments[4]);
			break;
		default:
			idx = arguments[0];
			data = eval(arguments[1]);
			break;
	}

	var pointarr = new Array();

    poiData = data.pointofinterest;       
    
	// compute map extent, set it
	for (var i = 0; i < data.pointofinterest.length; i++)
	{
		if ("lon" in data.pointofinterest[i]) {
		pointarr.push(data.pointofinterest[i].lon + ',' + data.pointofinterest[i].lat);
		}
	}
	
	if (pointarr.length == 0)
	{
		// we didn't find anything.  
		if (window.JSON_scripttag)
		    window.JSON_scripttag.removeScriptTag();
		
		m2i_geocode({city:city, region:region, country:country}, 'm2i_geocodeJSONAM3point');
		return;
	}
	
	// invoke Canvas
	m2i_hs = new HotSpotCanvas('hs_'+m2i_clientid);
	var map = eval(m2i_am3name);
	map.addCanvas(m2i_clientid, m2i_hs, 11);
	var S = new Object();
	var bb = map.computebox(pointarr);
	S.Lon = (bb.left+bb.right)/2;
	S.Lat = (bb.top+bb.bottom)/2;
	S.Scale = map.autoscale(bb);

	map.setState(S);

	// build out our hotspots
	for (i = 0; i < data.pointofinterest.length; i++)
	{
		var poi = data.pointofinterest[i];
		var url = m2i_fixurl(poi.url);
		var hoverhtml = '<b>' + poi.name + '</b>';
		var clickhtml = hoverhtml +
			'<br>' + (poi.displaystreet ? poi.displaystreet : '') 
			+ '<br>' + poi.city + ',' + poi.region + ',' + poi.postal
			+ (poi.description ? '<br>' +poi.description + '<br>' : '')
			+ '<a target="_none" href="gsc2007/travel/' + url + '">Location Details</a>';

        // 
        if (poi.custom)
        { // AGI POI
            var custom = data.pointofinterest[i].custom;
            var hasIcon = false;
            
            for (j = 0; j < custom.length; j++)
	        {
	        
                if (custom[j].key == "type" && custom[j].value == "gsc") // GSC Park
                {
       		        m2i_hs.CreateBoth(poi.ownername+poi.ownerid, poi.lon, poi.lat, '../../images/icons/gsc_icon.gif', 15, 15, 150,150,clickhtml,'',100,30,hoverhtml,'');
                    hasIcon = true;
                    break;       		        
                }
                else if (custom[j].key == "type" && custom[j].value == "gsc_dealer") // GSC Dealer
       		    { 
       		        m2i_hs.CreateBoth(poi.ownername+poi.ownerid, poi.lon, poi.lat, '../../images/icons/public_icon.gif', 15, 15, 150,150,clickhtml,'',100,30,hoverhtml,'');
       		        hasIcon = true;       		        
       		        break;
                }                                               
                else if (custom[j].key == "type" && (custom[j].value == "tld_priv")) 
       		    {
       		        m2i_hs.CreateBoth(poi.ownername + poi.ownerid, poi.lon, poi.lat, '../../images/icons/private_icon.gif', 15, 15, 150,150,clickhtml,'',100,30,hoverhtml,'');
       		        hasIcon = true;       		        
       		        break;
                }
                else if (custom[j].key == "type" && (custom[j].value == "tld_pub")) 
                {
       		        m2i_hs.CreateBoth(poi.ownername + poi.ownerid, poi.lon, poi.lat, '../../images/icons/public_icon.gif', 15, 15, 150,150,clickhtml,'',100,30,hoverhtml,'');
       		        hasIcon = true;       		        
       		        break;
                }

                else if (custom[j].key == "type" && custom[j].value == "tld_memb") 
                {
       		        m2i_hs.CreateBoth(poi.ownername + poi.ownerid, poi.lon, poi.lat, '../../images/icons/public_icon.gif', 15, 15, 150,150,clickhtml,'',100,30,hoverhtml,'');
                    hasIcon = true;       		        
       		        break;
                }

                else if (custom[j].key == "type" && custom[j].value == "tld_stpk")
                {
       		        m2i_hs.CreateBoth(poi.ownername+poi.ownerid, poi.lon, poi.lat, '../../images/icons/public_icon.gif', 15, 15, 150,150,clickhtml,'',100,30,hoverhtml,'');
                    hasIcon = true;       		        
                    break;       		        
                }
                else if (custom[j].key == "type" && custom[j].value == "tld_serv") 
       		    {
       		        m2i_hs.CreateBoth(poi.ownername+poi.ownerid, poi.lon, poi.lat, '../../images/icons/public_icon.gif', 15, 15, 150,150,clickhtml,'',100,30,hoverhtml,'');
       		        hasIcon = true;       		        
                    break;
                }   
                else if (custom[j].key == "type" && custom[j].value.indexOf("event") >= 0) 
       		    {
       		        m2i_hs.CreateBoth(poi.ownername+poi.ownerid, poi.lon, poi.lat, '../../images/icons/icon_red_dot.gif', 15, 15, 150,150,clickhtml,'',100,30,hoverhtml,'');       	    
       		        hasIcon = true;       		        
                    break;
                }
                
                hasIcon = false;                
            }
            
            if (!hasIcon)
    		    m2i_hs.CreateBoth(poi.ownername+poi.ownerid, poi.lon, poi.lat, function(){return m2i_hs.CreateIndexedBlob('m2i_hs_square_blue','A')}, 15, 15, 150,150,clickhtml,'',100,30,hoverhtml,'');
       }
       else 
       {                 
             if (poi) 
             {
                if (poi._class == "4493") // marina	        
                    m2i_hs.CreateBoth(poi.ownername + poi.ownerid, poi.lon, poi.lat, '../../images/lightblue.gif', 15, 15, 150,150,clickhtml,'',100,30,hoverhtml,'');                       
    	   
    	        else if (poi._class == "5800") // restaurant	        
                    m2i_hs.CreateBoth(poi.ownername + poi.ownerid, poi.lon, poi.lat, '../../images/lightblue.gif', 15, 15, 150,150,clickhtml,'',100,30,hoverhtml,'');                       
    	   
    	        else if (poi._class == "7389") // tourinst info
                    m2i_hs.CreateBoth(poi.ownername + poi.ownerid, poi.lon, poi.lat, '../../images/lightblue.gif', 15, 15, 150,150,clickhtml,'',100,30,hoverhtml,'');                           	      
    	   
    	        else if (poi._class == "7897") // rest area
                    m2i_hs.CreateBoth(poi.ownername + poi.ownerid, poi.lon, poi.lat, '../../images/lightblue.gif', 15, 15, 150,150,clickhtml,'',100,30,hoverhtml,'');                           	      
    	   
        	    else if (poi._class == "7947") // parks and recreation
                    m2i_hs.CreateBoth(poi.ownername + poi.ownerid, poi.lon, poi.lat, '../../images/lightblue.gif', 15, 15, 150,150,clickhtml,'',100,30,hoverhtml,'');                           	      
    	   
                else if (poi._class == "7996") // amusement park	        
                    m2i_hs.CreateBoth(poi.ownername + poi.ownerid, poi.lon, poi.lat, '../../images/lightblue.gif', 15, 15, 150,150,clickhtml,'',100,30,hoverhtml,'');                       
    	        
	            else if (poi._class == "7985")  // casino	        	        
    	          m2i_hs.CreateBoth(poi.ownername + poi.ownerid, poi.lon, poi.lat, '../../images/lightblue.gif', 15, 15, 150,150,clickhtml,'',100,30,hoverhtml,'');          
    	       
	            else if (poi._class == "7992")  // golf course	        
    	            m2i_hs.CreateBoth(poi.ownername + poi.ownerid, poi.lon, poi.lat, '../../images/lightblue.gif', 15, 15, 150,150,clickhtml,'',100,30,hoverhtml,'');          
    	        
	            else if (poi._class == "5999")  // historical	        	        
                    m2i_hs.CreateBoth(poi.ownername + poi.ownerid, poi.lon, poi.lat, '../../images/lightblue.gif', 15, 15, 150,150,clickhtml,'',100,30,hoverhtml,'');              	        
    	        
                else if (poi._class == "8410")  // museum            
                    m2i_hs.CreateBoth(poi.ownername + poi.ownerid, poi.lon, poi.lat, '../../images/lightblue.gif', 15, 15, 150,150,clickhtml,'',100,30,hoverhtml,'');                         
    	        
                else if (poi._class == "6512")  // shopping            
                    m2i_hs.CreateBoth(poi.ownername + poi.ownerid, poi.lon, poi.lat, '../../images/lightblue.gif', 15, 15, 150,150,clickhtml,'',100,30,hoverhtml,'');          
    	        
                else if (poi._class == "7999")  // tourist attr            
                    m2i_hs.CreateBoth(poi.ownername + poi.ownerid, poi.lon, poi.lat, '../../images/lightblue.gif', 15, 15, 150,150,clickhtml,'',100,30,hoverhtml,'');                          
    	        
	            else if (poi._class == "8231")  // library            
                   m2i_hs.CreateBoth(poi.ownername + poi.ownerid, poi.lon, poi.lat, '../../images/lightblue.gif', 15, 15, 150,150,clickhtml,'',100,30,hoverhtml,'');   	        	             
             }             
                             
       }

	   idx++;
	}
	if (window.JSON_scripttag)
	    window.JSON_scripttag.removeScriptTag();
}

function showHideEditStop(idx)
{
    showHide('EditStop' + idx);
    showHide('LblEditStop' + idx);
    showHide('LblMakeNote' + idx);
}



