function createMap(map_id, lat, lng, zoom, map, type, scale, overview, map_type) {
    if(lat == undefined) {
    lat = 0.0;
    }
    if(lng == undefined) {
    lng = 0.0;
    }
    if(zoom == undefined) {
    zoom = 0;
    }
    if(map == undefined) {
    map = 'large';
    }
    if(type == undefined) {
    type = 'small';
    }
    if(scale == undefined) {
    scale = false;
    }
    if(overview == undefined) {
    overview = false;
    }
    if(map_type == undefined || map_type == 'map') {
    map_type = G_HYBRID_MAP;
    }
    else if(map_type == 'satellite') {
    map_type = G_SATELLITE_MAP;
    }

    // Create map
    gmap = new GMap2(document.getElementById(map_id));
    // set center
    gmap.setCenter(new GLatLng(lat, lng), zoom, map_type);
    // map control
    if (map == 'large') {
    gmap.addControl(new GLargeMapControl());
    }
    else if (map == 'small') {
    gmap.addControl(new GSmallMapControl());
    }
    else if (map == 'zoom') {
    gmap.addControl(new GSmallZoomControl());
    }
    // map type control
    if (type == 'small') {
    gmap.addControl(new GMapTypeControl(true));
    }
    else if (type) {
    gmap.addControl(new GMapTypeControl());
    }
    // scale control
    if (scale) {
    gmap.addControl(new GScaleControl());
    }
    // overview control
    if (overview) {
    gmap.addControl(new GOverviewMapControl());
    }
    return gmap;
}

url = "http://www.unitus.com"
// Create marker icon
var icon = new GIcon();
icon.image = url + "/gmap_marker.png";
icon.shadow = url + "/gmap_shadow.png";
icon.iconSize = new GSize(20, 34);
icon.shadowSize = new GSize(37, 34);
icon.iconAnchor = new GPoint(9, 34);
icon.infoWindowAnchor = new GPoint(9, 2);

// Create center marker icon
var center_icon = new GIcon();
center_icon.image = url + "/centermarker.png";
center_icon.shadow = url + "/centermarker_shadow.png";
center_icon.iconSize = new GSize( 23 , 23 );
center_icon.shadowSize = new GSize( 29 , 29 );
center_icon.iconAnchor = new GPoint( 11 , 11 );

// Create markers and events
function createMarker(map, mid, lat, lng) {
    var point = new GLatLng(lat, lng);
    var marker = new GMarker(point, icon);
    GEvent.addListener(marker, 'click', function() {
        marker.html = mid
        currentMarker = marker;
        marker.openInfoWindowHtml(marker.html);
    })
    map.addOverlay(marker);
    return marker;
}

function addCenterMarker(map) {
    var center_marker = new GMarker(map.getCenter(), center_icon);
    map.addOverlay(center_marker);

    GEvent.addListener(map , "moveend" , function() {
    map.removeOverlay(center_marker);
        center_marker = new GMarker(map.getCenter(), center_icon);
        map.addOverlay(center_marker);
    });
}

function changeZoom(lat,lon,zoom) {
    gmap.setCenter(new GLatLng(lat,lon), zoom);
}