var map;
var geocoder;
var icon_path = 'assets/snippets/googleMaps/markers/';
var custom_icon=[];


function pausecomp(millis)
{
var date = new Date();
var curDate = null;

do { curDate = new Date(); }
while(curDate-date < millis);
}


function load() {
 
 if (GBrowserIsCompatible()) {

        geocoder = new GClientGeocoder();
        map = new GMap2(document.getElementById('map'));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());

var mt = map.getMapTypes();
// Overwrite the getMinimumResolution() and getMaximumResolution()

for (var i=0; i<mt.length; i++) {
	mt[i].getMinimumResolution = function() {return 6;}
	mt[i].getMaximumResolution = function() {return 15;}
}


        map.setCenter(new GLatLng(40, -100), 4);

                            
      }
    }


function loadTeacher() {
      if (GBrowserIsCompatible()) {
        geocoder = new GClientGeocoder();
        map = new GMap2(document.getElementById('map'));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        //map.setCenter(new GLatLng(40, -100), 4);
        

         var address = document.getElementById('addressInput').value;
         
        if(document.getElementById('teacherZipCode').value){
        address = document.getElementById('teacherZipCode').value;
        }
     
  
      var teacherID = document.getElementById('teacherID').value;
     geocoder.getLatLng(address, function(latlng) {
       if (!latlng) {
         alert(address + ' not found');
       } else {
         searchLocationsNear(latlng,teacherID);
       }
     });
     
      }
    }
    
   function searchLocations() {
     var address = document.getElementById('addressInput').value;
     var instrument = document.getElementById('instrumentSelect').value;
     var radius = document.getElementById('radiusSelect').value;
 
     if(address && address != "Enter Zip Code" && instrument !="0" && radius != "0"){
     
     geocoder.getLatLng(address, function(latlng) {
       if (!latlng) {
         alert(address + ' not found');
       } else {
         searchLocationsNear(latlng,'search','');
       }
     });
     
     }
     else
     {
    var error =''; 
    
            if(!address || address == "Enter Zip Code"){
     error = 'Enter Zip/Postal Code';
      }
      
        if(radius == "0"){
      error = 'Select Radius';
      }
      
       if(instrument =="0"){
     error = 'Select Instrument';
      }
      
      

      
      alert(error);
      
     }
   }

 function searchSessionLocations() {

 geocoder = new GClientGeocoder();
        map = new GMap2(document.getElementById('map'));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
     var address = document.getElementById('addressInput').value;
     
      
     geocoder.getLatLng(address, function(latlng) {
       if (!latlng) {
         alert(address + ' not found');
       } else {
         searchLocationsNear(latlng,'search','');
       }
     });
   }


 function searchExternalLocations() {

 geocoder = new GClientGeocoder();
        map = new GMap2(document.getElementById('map'));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
     var address = document.getElementById('addressInput').value;

     geocoder.getLatLng(address, function(latlng) {
       if (!latlng) {
         alert(address + ' not found');
       } else {
         searchLocationsNear(latlng,'search','');
       }
     });
   }
  
 function searchLocationsPages(page){
 
   window.scroll(0,0);
   var address = document.getElementById('addressInput').value;
     geocoder.getLatLng(address, function(latlng) {
       if (!latlng) {
         alert(address + ' not found');
       } else {
         searchLocationsNear(latlng,'search',page);
       }
     });
     
 }
 
 
  function searchLocationsPagesSEO(page){
 
   window.scroll(0,0);
   var address = document.getElementById('addressInput').value;
     geocoder.getLatLng(address, function(latlng) {
       if (!latlng) {
         alert(address + ' not found');
       } else {
         searchLocationsNearSEO(latlng,'search',page);
       }
     });
     
 }


function searchTeacherLocations() {
     var address = document.getElementById('addressInput').value;
     

        
     geocoder.getLatLng(address, function(latlng) {
       if (!latlng) {
         alert(address + ' not found');
       } else {
         searchLocationsNear(latlng);
       }
     });
   }
 
 
 

// SEARCH RESULT AND PROFILE
   function searchLocationsNear(center,type,page) {

     var radius = document.getElementById('radiusSelect').value;
     var instrument = document.getElementById('instrumentSelect').value;
     var zip = document.getElementById('addressInput').value;
     var searchType = document.getElementById('typeSelect').value;
      var seoSearch = document.getElementById('seoSearch').value;

     var searchUrl = 'gmap-ajax-search.html?get_locations=1&lat=' + center.lat() + '&lng=' + center.lng() + '&radius=' + radius +'&instrument='+instrument+'&zip='+zip+'&searchType='+searchType+'&searchDisplay='+type+'&page='+page+'&uid='+type+'&seoSearch='+seoSearch;

 GDownloadUrl(searchUrl, function(data) {
       var xml = GXml.parse(data);
       var markers = xml.documentElement.getElementsByTagName('marker');
       map.clearOverlays();

		 if(type == "search"){
		
		   var sidebar = document.getElementById('sidebar');
		   sidebar.innerHTML = '';
		
		   if (markers.length == 2) {
			 sidebar.innerHTML = '<div class="whitebox"><div id="no_search_result"><h2>Thank You for Visiting NAMTA,</h2><p>Our membership of music teachers and schools is growing steadily; however, there are no members that match your search criteria at this time. </p><p>Please try again using a wider search area (greater distance). If no results match your search criteria, please check back with us at a later date to see if NAMTA has added new teachers and / or schools in your area.</p><p>Regards,</p><p>NAMTA Online Support Team </p></div></div>';
			document.getElementById('map').style.display = 'none';
			 map.setCenter(new GLatLng(40, -100), 4);
			 return;
		   }
		   else
		   {
				document.getElementById('map').style.display = 'block';
		   }
		}
		else
		{
		   var profile_sidebar = document.getElementById('profile_sidebar');
			   profile_sidebar.innerHTML = '';
		
		}

  var navigation = markers[0].getAttribute('name');
  
 if(type == "search"){
 document.getElementById('navigation_top').innerHTML = navigation;
  document.getElementById('navigation_bottom').innerHTML = navigation;  
  }
       var bounds = new GLatLngBounds();
       for (var i = 1; i < markers.length; i++) {
         var name = markers[i].getAttribute('name');
         var address = markers[i].getAttribute('address');
         var icon = markers[i].getAttribute('icon');
         var distance = parseFloat(markers[i].getAttribute('distance'));
         var window_infos = markers[i].getAttribute('window_infos');
     	 var sidebar_infos  = markers[i].getAttribute('sidebar_infos');
         var point = new GLatLng(parseFloat(markers[i].getAttribute('lat')), parseFloat(markers[i].getAttribute('lng')));
          
         var marker = createMarker(point, name, address, icon ,window_infos );
         map.addOverlay(marker);

    if(type == "search"){
         var sidebarEntry = createSidebarEntry(marker, name, address, distance, sidebar_infos);
            if(address){
        		 sidebar.appendChild(sidebarEntry);
         	}
    } 
    else
    {
    var sidebarEntry = createSidebarEntry(marker, name, address, distance, sidebar_infos);
            if(address){
        		 profile_sidebar.appendChild(sidebarEntry);
         	}
    
    }
         bounds.extend(point);

       }

       var center = bounds.getCenter();
       var zoom = map.getBoundsZoomLevel(bounds);

	   var mt = map.getMapTypes();
		// Overwrite the getMinimumResolution() and getMaximumResolution()

for (var i=0; i<mt.length; i++) {
	mt[i].getMinimumResolution = function() {return 7;}
	mt[i].getMaximumResolution = function() {return 13;}
}

       map.setCenter(center, zoom);
       
     });
}


/////// SEO SERCH
 

  function searchSeoInst(){

  geocoder = new GClientGeocoder();
        map = new GMap2(document.getElementById('map'));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
     var address = "64106";


     geocoder.getLatLng(address, function(latlng) {
       if (!latlng) {
         alert(address + ' not found');
       } else {
  
         searchSeo(latlng,'searchInst','');
       }
     });
     
 }
 
 
  function searchSeoCity(){
 
  geocoder = new GClientGeocoder();
        map = new GMap2(document.getElementById('map'));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
     var address = document.getElementById('cityZipCode').value;


     geocoder.getLatLng(address, function(latlng) {
       if (!latlng) {
         alert(address + ' not found');
       } else {
 
         searchSeo(latlng,'search','');
       }
     });
     
 }

  function searchSeoCityDev(){
 
  geocoder = new GClientGeocoder();
        map = new GMap2(document.getElementById('map'));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
     var address = document.getElementById('cityZipCode').value;

     geocoder.getLatLng(address, function(latlng) {
       if (!latlng) {
         alert(address + ' not found');
       } else {
         searchSeoDev(latlng,'search','');
       }
     });
     

 
 }

// SEARCH RESULT AND PROFILE
   function searchLocationsNearSEO(center,type,page) {

        var radius = document.getElementById('radiusSEO').value;
        var instrument = document.getElementById('instrumentSEO').value;
        var zip = document.getElementById('cityZipCode').value;
        var searchType = document.getElementById('typeSelect').value;
     
        var searchUrl = 'gmap-ajax-search-seo.html?get_locations=1&lat=' + center.lat() + '&lng=' + center.lng() + '&radius=' + radius +'&instrument='+instrument+'&zip='+zip+'&searchType='+searchType+'&searchDisplay='+type+'&page='+page;


 GDownloadUrl(searchUrl, function(data) {
       var xml = GXml.parse(data);
       var markers = xml.documentElement.getElementsByTagName('marker');
       map.clearOverlays();

		 if(type == "search"){
		
		   var sidebar = document.getElementById('sidebar');
		   sidebar.innerHTML = '';
		
		   if (markers.length == 2) {
			 sidebar.innerHTML = '<div class="whitebox"><div id="no_search_result"><h2>Thank You for Visiting NAMTA,</h2><p>Our membership of music teachers and schools is growing steadily; however, there are no members that match your search criteria at this time. </p><p>Please try again using a wider search area (greater distance). If no results match your search criteria, please check back with us at a later date to see if NAMTA has added new teachers and / or schools in your area.</p><p>Regards,</p><p>NAMTA Online Support Team </p></div></div>';
			document.getElementById('map').style.display = 'none';
			 map.setCenter(new GLatLng(40, -100), 4);
			 return;
		   }
		   else
		   {
				document.getElementById('map').style.display = 'block';
		   }
		}
		else
		{
		   var profile_sidebar = document.getElementById('profile_sidebar');
			   profile_sidebar.innerHTML = '';
		
		}

  var navigation = markers[0].getAttribute('name');
  
 if(type == "search"){
 document.getElementById('navigation_top').innerHTML = navigation;
  document.getElementById('navigation_bottom').innerHTML = navigation;  
  }
       var bounds = new GLatLngBounds();
       for (var i = 1; i < markers.length; i++) {
         var name = markers[i].getAttribute('name');
         var address = markers[i].getAttribute('address');
         var icon = markers[i].getAttribute('icon');
         var distance = parseFloat(markers[i].getAttribute('distance'));
         var window_infos = markers[i].getAttribute('window_infos');
     	 var sidebar_infos  = markers[i].getAttribute('sidebar_infos');
         var point = new GLatLng(parseFloat(markers[i].getAttribute('lat')), parseFloat(markers[i].getAttribute('lng')));
          
         var marker = createMarker(point, name, address, icon ,window_infos );
         map.addOverlay(marker);

    if(type == "search"){
         var sidebarEntry = createSidebarEntry(marker, name, address, distance, sidebar_infos);
            if(address){
        		 sidebar.appendChild(sidebarEntry);
         	}
    } 
    else
    {
    var sidebarEntry = createSidebarEntry(marker, name, address, distance, sidebar_infos);
            if(address){
        		 profile_sidebar.appendChild(sidebarEntry);
         	}
    
    }
         bounds.extend(point);

       }

       var center = bounds.getCenter();
       var zoom = map.getBoundsZoomLevel(bounds);

	   var mt = map.getMapTypes();
		// Overwrite the getMinimumResolution() and getMaximumResolution()

for (var i=0; i<mt.length; i++) {
	mt[i].getMinimumResolution = function() {return 7;}
	mt[i].getMaximumResolution = function() {return 13;}
}

       map.setCenter(center, zoom);
       
     });
}

 function searchSeoDev(center,type) {

        var radius = document.getElementById('radiusSEO').value;
        var instrument = document.getElementById('instrumentSEO').value;
        var zip = document.getElementById('cityZipCode').value;
        var searchType = document.getElementById('typeSelect').value;
     
        var searchUrl = 'gmap-ajax-search-seo-dev.html?get_locations=1&lat=' + center.lat() + '&lng=' + center.lng() + '&radius=' + radius +'&instrument='+instrument+'&zip='+zip+'&searchType='+searchType+'&searchDisplay='+type;

 GDownloadUrl(searchUrl, function(data) {
       var xml = GXml.parse(data);
       var markers = xml.documentElement.getElementsByTagName('marker');
       map.clearOverlays();

       var sidebar = document.getElementById('sidebar');
       sidebar.innerHTML = '';
    
       if (markers.length == 2) {
         sidebar.innerHTML = '<div class="whitebox"><div id="no_search_result"><h2>Thank You for Visiting NAMTA,</h2><p>Our membership of music teachers and schools is growing steadily; however, there are no members that match your search criteria at this time. </p><p>Please try again using a wider search area (greater distance). If no results match your search criteria, please check back with us at a later date to see if NAMTA has added new teachers and / or schools in your area.</p><p>Regards,</p><p>NAMTA Online Support Team </p></div></div>';
		document.getElementById('map').style.display = 'none';
         map.setCenter(new GLatLng(40, -100), 4);
         return;
       }
		else
		{
			document.getElementById('map').style.display = 'block';
		}

		var navigation = markers[0].getAttribute('name'); 
        var bounds = new GLatLngBounds();
        
       for (var i = 1; i < markers.length; i++) {

         var name = markers[i].getAttribute('name');
         var address = markers[i].getAttribute('address');
        
         if(i == "1"){
           var icon = markers[i].getAttribute('icon');
           }
           else
           {
           var icon = markers[i].getAttribute('icon');
            //var icon = 'button-plain.png';
           }
         var distance = parseFloat(markers[i].getAttribute('distance'));
         var window_infos = markers[i].getAttribute('window_infos');
         var sidebar_infos  = markers[i].getAttribute('sidebar_infos');
         var point = new GLatLng(parseFloat(markers[i].getAttribute('lat')), parseFloat(markers[i].getAttribute('lng')));             
         var marker = createMarker(point,name,address,icon,window_infos );
         map.addOverlay(marker);

         var sidebarEntry = createSidebarEntryDev(marker,name,address,distance,sidebar_infos);
            if(address){
        		 sidebar.appendChild(sidebarEntry);
         	}
   
         bounds.extend(point);

       }

       var center = bounds.getCenter();
       var zoom = map.getBoundsZoomLevel(bounds);

		var mt = map.getMapTypes();
		// Overwrite the getMinimumResolution() and getMaximumResolution()

		for (var i=0; i<mt.length; i++) {
			mt[i].getMinimumResolution = function() {return 7;}
			mt[i].getMaximumResolution = function() {return 13;}
		}

       map.setCenter(center, zoom);     
     });
}

 function searchSeo(center,type) {

        var radius = document.getElementById('radiusSEO').value;
        var instrument = document.getElementById('instrumentSEO').value;
        var zip = document.getElementById('cityZipCode').value;
        var searchType = document.getElementById('typeSelect').value;
     
        var searchUrl = 'gmap-ajax-search-seo.html?get_locations=1&lat=' + center.lat() + '&lng=' + center.lng() + '&radius=' + radius +'&instrument='+instrument+'&zip='+zip+'&searchType='+searchType+'&searchDisplay='+type;

 GDownloadUrl(searchUrl, function(data) {
       var xml = GXml.parse(data);
       var markers = xml.documentElement.getElementsByTagName('marker');
       map.clearOverlays();

       var sidebar = document.getElementById('sidebar');
       sidebar.innerHTML = '';
    
       if (markers.length == 2) {
         sidebar.innerHTML = '<div class="whitebox"><div id="no_search_result"><h2>Thank You for Visiting NAMTA,</h2><p>Our membership of music teachers and schools is growing steadily; however, there are no members that match your search criteria at this time. </p><p>Please try again using a wider search area (greater distance). If no results match your search criteria, please check back with us at a later date to see if NAMTA has added new teachers and / or schools in your area.</p><p>Regards,</p><p>NAMTA Online Support Team </p></div></div>';
		document.getElementById('map').style.display = 'none';
         map.setCenter(new GLatLng(40, -100), 4);
         return;
       }
		else
		{
			document.getElementById('map').style.display = 'block';
		}

		var navigation = markers[0].getAttribute('name'); 
	//	alert(navigation);
	 document.getElementById('navigation_top').innerHTML = navigation;
  document.getElementById('navigation_bottom').innerHTML = navigation;  
	
        var bounds = new GLatLngBounds();
        
       for (var i = 1; i < markers.length; i++) {

         var name = markers[i].getAttribute('name');
         var address = markers[i].getAttribute('address');
        
         if(i == "1"){
           var icon = markers[i].getAttribute('icon');
           }
           else
           {
           var icon = markers[i].getAttribute('icon');
            //var icon = 'button-plain.png';
           }
         var distance = parseFloat(markers[i].getAttribute('distance'));
         var window_infos = markers[i].getAttribute('window_infos');
         var sidebar_infos  = markers[i].getAttribute('sidebar_infos');
         var point = new GLatLng(parseFloat(markers[i].getAttribute('lat')), parseFloat(markers[i].getAttribute('lng')));             
         var marker = createMarker(point,name,address,icon,window_infos );
         map.addOverlay(marker);

         var sidebarEntry = createSidebarEntry(marker,name,address,distance,sidebar_infos);
            if(address){
        		 sidebar.appendChild(sidebarEntry);
         	}
   
         bounds.extend(point);

       }

       var center = bounds.getCenter();
       var zoom = map.getBoundsZoomLevel(bounds);

		var mt = map.getMapTypes();
		// Overwrite the getMinimumResolution() and getMaximumResolution()

if(type == "searchInst"){
		for (var i=0; i<mt.length; i++) {
			mt[i].getMinimumResolution = function() {return 1;}
			mt[i].getMaximumResolution = function() {return 13;}
		}
}
else
{
		for (var i=0; i<mt.length; i++) {
			mt[i].getMinimumResolution = function() {return 7;}
			mt[i].getMaximumResolution = function() {return 13;}
		}
}

       map.setCenter(center, zoom);     
     });
}

function createMarker(point,name,address,icon,window_infos) {
  
      var location_icon = custom_icon[icon];    	
   
      var marker = new GMarker(point,{icon:location_icon});
      var html = window_infos;
      if(window_infos){
      GEvent.addListener(marker, 'click', function() {
        marker.openInfoWindowHtml(html);
      });
      }
      return marker;
    }


custom_icon['button-plain.png'] = new GIcon();
custom_icon['button-plain.png'].shadow = icon_path + "button-00_shadow.png";
custom_icon['button-plain.png'].image = icon_path + "button-plain.png";
custom_icon['button-plain.png'].iconSize = new GSize(28.0, 28.0);
custom_icon['button-plain.png'].shadowSize = new GSize(43.0, 28.0);
custom_icon['button-plain.png'].iconAnchor = new GPoint(10.0, 28.0);
custom_icon['button-plain.png'].infoWindowAnchor = new GPoint(0.0, 28.0);
custom_icon['button-plain.png'].infoShadowAnchor = new GPoint(0.0, 28.0);

custom_icon['manual_marker.png'] = new GIcon();
custom_icon['manual_marker.png'].shadow = icon_path + "button-00_shadow.png";
custom_icon['manual_marker.png'].image = icon_path + "manual_marker.png";
custom_icon['manual_marker.png'].iconSize = new GSize(28.0, 28.0);
custom_icon['manual_marker.png'].shadowSize = new GSize(43.0, 28.0);
custom_icon['manual_marker.png'].iconAnchor = new GPoint(10.0, 28.0);
custom_icon['manual_marker.png'].infoWindowAnchor = new GPoint(0.0, 28.0);
custom_icon['manual_marker.png'].infoShadowAnchor = new GPoint(0.0, 28.0);

// Square Markers
custom_icon['button-00.png'] = new GIcon();
//custom_icon['button-00.png'].shadow = icon_path + "button-00_shadow.png";
custom_icon['button-00.png'].image = icon_path + "button-00.png";
custom_icon['button-00.png'].iconSize = new GSize(28.0, 28.0);
custom_icon['button-00.png'].shadowSize = new GSize(43.0, 28.0);
custom_icon['button-00.png'].iconAnchor = new GPoint(10.0, 28.0);
custom_icon['button-00.png'].infoWindowAnchor = new GPoint(14.0, 2.0);
custom_icon['button-00.png'].infoShadowAnchor = new GPoint(28.0, 15.0);

custom_icon['button-01.png'] = new GIcon();
//custom_icon['button-01.png'].shadow = icon_path + "button-00_shadow.png";
custom_icon['button-01.png'].image = icon_path + "button-01.png";
custom_icon['button-01.png'].iconSize = new GSize(28.0, 28.0);
custom_icon['button-01.png'].shadowSize = new GSize(43.0, 28.0);
custom_icon['button-01.png'].iconAnchor = new GPoint(10.0, 28.0);
custom_icon['button-01.png'].infoWindowAnchor = new GPoint(14.0, 2.0);
custom_icon['button-01.png'].infoShadowAnchor = new GPoint(28.0, 15.0);

custom_icon['button-02.png'] = new GIcon();
//custom_icon['button-02.png'].shadow = icon_path + "button-00_shadow.png";
custom_icon['button-02.png'].image = icon_path + "button-02.png";
custom_icon['button-02.png'].iconSize = new GSize(28.0, 28.0);
custom_icon['button-02.png'].shadowSize = new GSize(43.0, 28.0);
custom_icon['button-02.png'].iconAnchor = new GPoint(10.0, 28.0);
custom_icon['button-02.png'].infoWindowAnchor = new GPoint(14.0, 2.0);
custom_icon['button-02.png'].infoShadowAnchor = new GPoint(28.0, 15.0);

custom_icon['button-03.png'] = new GIcon();
//custom_icon['button-03.png'].shadow = icon_path + "button-00_shadow.png";
custom_icon['button-03.png'].image = icon_path + "button-03.png";
custom_icon['button-03.png'].iconSize = new GSize(28.0, 28.0);
custom_icon['button-03.png'].shadowSize = new GSize(43.0, 28.0);
custom_icon['button-03.png'].iconAnchor = new GPoint(10.0, 28.0);
custom_icon['button-03.png'].infoWindowAnchor = new GPoint(14.0, 2.0);
custom_icon['button-03.png'].infoShadowAnchor = new GPoint(28.0, 15.0);

custom_icon['button-04.png'] = new GIcon();
//custom_icon['button-04.png'].shadow = icon_path + "button-00_shadow.png";
custom_icon['button-04.png'].image = icon_path + "button-04.png";
custom_icon['button-04.png'].iconSize = new GSize(28.0, 28.0);
custom_icon['button-04.png'].shadowSize = new GSize(43.0, 28.0);
custom_icon['button-04.png'].iconAnchor = new GPoint(10.0, 28.0);
custom_icon['button-04.png'].infoWindowAnchor = new GPoint(14.0, 2.0);
custom_icon['button-04.png'].infoShadowAnchor = new GPoint(28.0, 15.0);

custom_icon['button-05.png'] = new GIcon();
//custom_icon['button-05.png'].shadow = icon_path + "button-00_shadow.png";
custom_icon['button-05.png'].image = icon_path + "button-05.png";
custom_icon['button-05.png'].iconSize = new GSize(28.0, 28.0);
custom_icon['button-05.png'].shadowSize = new GSize(43.0, 28.0);
custom_icon['button-05.png'].iconAnchor = new GPoint(10.0, 28.0);
custom_icon['button-05.png'].infoWindowAnchor = new GPoint(14.0, 2.0);
custom_icon['button-05.png'].infoShadowAnchor = new GPoint(28.0, 15.0);

custom_icon['button-06.png'] = new GIcon();
//custom_icon['button-06.png'].shadow = icon_path + "button-00_shadow.png";
custom_icon['button-06.png'].image = icon_path + "button-06.png";
custom_icon['button-06.png'].iconSize = new GSize(28.0, 28.0);
custom_icon['button-06.png'].shadowSize = new GSize(43.0, 28.0);
custom_icon['button-06.png'].iconAnchor = new GPoint(10.0, 28.0);
custom_icon['button-06.png'].infoWindowAnchor = new GPoint(14.0, 2.0);
custom_icon['button-06.png'].infoShadowAnchor = new GPoint(28.0, 15.0);

custom_icon['button-07.png'] = new GIcon();
//custom_icon['button-07.png'].shadow = icon_path + "button-00_shadow.png";
custom_icon['button-07.png'].image = icon_path + "button-07.png";
custom_icon['button-07.png'].iconSize = new GSize(28.0, 28.0);
custom_icon['button-07.png'].shadowSize = new GSize(43.0, 28.0);
custom_icon['button-07.png'].iconAnchor = new GPoint(10.0, 28.0);
custom_icon['button-07.png'].infoWindowAnchor = new GPoint(14.0, 2.0);
custom_icon['button-07.png'].infoShadowAnchor = new GPoint(28.0, 15.0);

custom_icon['button-08.png'] = new GIcon();
//custom_icon['button-08.png'].shadow = icon_path + "button-00_shadow.png";
custom_icon['button-08.png'].image = icon_path + "button-08.png";
custom_icon['button-08.png'].iconSize = new GSize(28.0, 28.0);
custom_icon['button-08.png'].shadowSize = new GSize(43.0, 28.0);
custom_icon['button-08.png'].iconAnchor = new GPoint(10.0, 28.0);
custom_icon['button-08.png'].infoWindowAnchor = new GPoint(14.0, 2.0);
custom_icon['button-08.png'].infoShadowAnchor = new GPoint(28.0, 15.0);

custom_icon['button-09.png'] = new GIcon();
//custom_icon['button-09.png'].shadow = icon_path + "button-00_shadow.png";
custom_icon['button-09.png'].image = icon_path + "button-09.png";
custom_icon['button-09.png'].iconSize = new GSize(28.0, 28.0);
custom_icon['button-09.png'].shadowSize = new GSize(43.0, 28.0);
custom_icon['button-09.png'].iconAnchor = new GPoint(10.0, 28.0);
custom_icon['button-09.png'].infoWindowAnchor = new GPoint(14.0, 2.0);
custom_icon['button-09.png'].infoShadowAnchor = new GPoint(28.0, 15.0);

// Round Markers
custom_icon['button-10.png'] = new GIcon();
//custom_icon['button-10.png'].shadow = icon_path + "button-10_shadow.png";
custom_icon['button-10.png'].image = icon_path + "button-10.png";
custom_icon['button-10.png'].iconSize = new GSize(28.0, 28.0);
custom_icon['button-10.png'].shadowSize = new GSize(43.0, 28.0);
custom_icon['button-10.png'].iconAnchor = new GPoint(14.0, 28.0);
custom_icon['button-10.png'].infoWindowAnchor = new GPoint(14.0, 2.0);
custom_icon['button-10.png'].infoShadowAnchor = new GPoint(28.0, 15.0);

 function createSidebarEntryDev(marker, name, address, distance, sidebar_infos) {
      var div = document.createElement('div');
     // var html = '<b>' + name + '</b> (' + distance.toFixed(1) + ')<br/>' + address;
      
      var html = sidebar_infos;
      div.innerHTML = html;

/*      
var endFirstDiv = document.createElement("div");
//  this.setButtonStyle_(endFirstDiv);
  div.appendChild(endFirstDiv);
  endFirstDiv.appendChild(document.createTextNode(""));
  endFirstDiv.style.cursor = 'pointer';
   endFirstDiv.style.color = '#ffffff';
  endFirstDiv.style.position= 'relative';
  endFirstDiv.style.top= '-25px';
  endFirstDiv.style.left= '430px';
  endFirstDiv.style.width= '70px';
   endFirstDiv.style.height= '10px';
  GEvent.addDomListener(endFirstDiv, "click", function() {  GEvent.trigger(marker, 'click');} );
*/



    // var link = div.innerHTML.getElementById("view-on-map").style.color ='red';
    // link.style.color ='red';
  div.style.cursor = 'pointer';
  div.style.backgroundImage= 'url(assets/templates/namta/images/sr-result-box.gif)';
  div.style.backgroundRepeat='no-repeat';
    //  div.style.marginBottom = '5px'; 
      GEvent.addDomListener(div, 'click', function() {
    //    GEvent.trigger(marker, 'click');
      });
      GEvent.addDomListener(div, 'mouseover', function() {
       div.style.backgroundImage= 'url(assets/templates/namta/images/sr-result-box-over.gif)';
      });
      GEvent.addDomListener(div, 'mouseout', function() {
       div.style.backgroundImage= 'url(assets/templates/namta/images/sr-result-box.gif)';
      });
      
  //    appendChild(div);
      
      return div;
    }
    
    
    
    function createSidebarEntry(marker, name, address, distance, sidebar_infos) {
      var div = document.createElement('div');
     // var html = '<b>' + name + '</b> (' + distance.toFixed(1) + ')<br/>' + address;
      
      var html = sidebar_infos;
      div.innerHTML = html;
      
var endFirstDiv = document.createElement("div");
//  this.setButtonStyle_(endFirstDiv);
  div.appendChild(endFirstDiv);
  endFirstDiv.appendChild(document.createTextNode(""));
  endFirstDiv.style.cursor = 'pointer';
   endFirstDiv.style.color = '#ffffff';
  endFirstDiv.style.position= 'relative';
  endFirstDiv.style.top= '-25px';
  endFirstDiv.style.left= '430px';
  endFirstDiv.style.width= '70px';
   endFirstDiv.style.height= '10px';
  GEvent.addDomListener(endFirstDiv, "click", function() {  GEvent.trigger(marker, 'click');} );




    // var link = div.innerHTML.getElementById("view-on-map").style.color ='red';
    // link.style.color ='red';
    //  div.style.cursor = 'pointer';
    //  div.style.marginBottom = '5px'; 
      GEvent.addDomListener(div, 'click', function() {
    //    GEvent.trigger(marker, 'click');
      });
      GEvent.addDomListener(div, 'mouseover', function() {
       // div.style.backgroundColor = '#eee';
      });
      GEvent.addDomListener(div, 'mouseout', function() {
       // div.style.backgroundColor = '#fff';
      });
      
  //    appendChild(div);
      
      return div;
    }
    
    
    function click_track(id,type){
 

	var pars = 'click_track=1&id='+id+'&type='+type;


	new Request({
		method: 'post',
		url:'assets/snippets/custom/ajax/tracking.php', 
		data: pars
	}).send();
	
	
				
    }
    
