function servicePointsDetails(latLng, string, map, init, infowindow) 
{    
  var center = new google.maps.LatLng(init[1],init[2]);
  map.setZoom(init[0]);
  map.setCenter(center);    
  var marker = new google.maps.Marker({
    map: map, 
    position: latLng, 
    clickable: true
  });  
  /*
   * marker click event
   */
  google.maps.event.addListener(marker, 'click', function(){  
    /*
     * clearing selected class
     */    
    $('.servicePointsList ul li').each(function() {
      if($(this).hasClass('selected')) {          
        $(this).removeClass('selected').addClass(previousClass);
      }
    });  
    map.setZoom(13);        
    map.setCenter(latLng);
    infowindow.content = string;
    infowindow.open(map, marker);   
    /*
     * checking whether selected infowindow matches id from services div
     * and sets new class to that element
     */
    var regex = infowindow.content.match(/<+ul id="g_(.*)">/)[1];
    var selectedLi = document.getElementById(regex);
    previousClass = selectedLi.className;
    selectedLi.className = 'selected';
    var selectedVoivod = regex.split('_')[1];
    showHideServicePoints(selectedVoivod);
    api.reinitialise();
    scrollToSelected(regex);
  });
  return marker;
}


function showHideServicePoints(voivodshipId) {
  for(var i in list) {
    for (var j in list[i]) {
      var v = i.split('_')[1];
      var id = i + '_' + j;
      $('#voivod').val(voivodshipId);
      v == voivodshipId ? 
        $('#'+id).show() : voivodshipId == 0 ? 
        $('#'+id).show() : $('#'+id).hide();
    }
  }
}
