var $j = jQuery.noConflict();

function createMap (id, zoom, maptype, latLng, disableUI, markers, effects) {
    var myLatlng = new google.maps.LatLng(latLng[0], latLng[1]);
    var styles = new Array();

    var myOptions = {
        zoom: zoom,
        center: myLatlng,
        mapTypeId: maptype,
        disableDefaultUI: disableUI
    };

    var myMap = new google.maps.Map(document.getElementById(id), myOptions);
    
    for(var i = 0; i < markers.length; i++)
    {
        var marker = new google.maps.Marker({
          position: new google.maps.LatLng(markers[i].lat, markers[i].lng),
          map: myMap,
          icon: markers[i].icon
        });
    }

    if ($j.inArray('grayscale', effects) > -1) {
        styles.push({
            featureType: 'all',
            elementType: 'all',
            stylers: [
              { saturation: '-100' }
            ]
      });
    }
    if ($j.inArray('removeRoadLabels', effects) > -1) {
        styles.push({
            featureType: 'road.local',
            elementType: 'labels',
            stylers: [
              { visibility: "off" }
            ]
        });
        styles.push({
            featureType: 'road.arterial',
            elementType: 'labels',
            stylers: [
              { visibility: "off" }
            ]
        });
    }
    if ($j.inArray('removeLandscapeLabels', effects) > -1) {
        styles.push({
            featureType: 'poi',
            elementType: 'labels',
            stylers: [
              { visibility: "off" }
            ]
        });
        styles.push({
            featureType: 'landscape',
            elementType: 'labels',
            stylers: [
              { visibility: "off" }
            ]
        });
        styles.push({
            featureType: 'administrative',
            elementType: 'labels',
            stylers: [
              { visibility: "off" }
            ]
        });
    }

    myMap.setOptions({ styles: styles });
}
