var mixmap_url = mixmap_host+"?request=map";

if (typeof mixmap_mapwidth == "undefined") var mixmap_mapwidth = 350;
if (typeof mixmap_mapheight == "undefined") var mixmap_mapheight = 350;
mixmap_mapwidth = mixmap_range_check(mixmap_mapwidth,50,2000,350);
mixmap_mapheight = mixmap_range_check(mixmap_mapheight,50,2000,350);

function mixmap_range_check(v,min,max,defaultval) {
    if (isNaN(v)) { v = defaultval}
    else if (v > max) {v = max}
    else if (v < min) {v = min}
    return v;
}

addParam('width',mixmap_mapwidth);
addParam('height',mixmap_mapheight);
if (typeof cid != "undefined") addParam('cid',cid);
if (typeof num_markers != "undefined") addParam('num_markers',num_markers);
if (typeof zoom != "undefined") addParam('zoom',zoom);
if (typeof lat != "undefined") addParam('lat',lat);
if (typeof lon != "undefined") addParam('lon',lon);
if (typeof map_ctrl != "undefined") addParam('map_ctrl',map_ctrl);
if (typeof type_ctrl != "undefined") addParam('type_ctrl',type_ctrl);

function quoted(str) {
  return (str != null) ? '"' + str + '"' : '""';
}

function addParam(name,val) {
  mixmap_url+=("&"+name+"="+val);
}

document.write('<ifr' + 'ame' +
               ' id="mixmap_mapwidget_frame"' +
               ' height=' + quoted(mixmap_mapheight) +
               ' width=' + quoted(mixmap_mapwidth) +
               ' frameborder="0"' +
               ' src=' + quoted(mixmap_url) +
               ' marginwidth="0"' +
               ' marginheight="0"' +
               ' vspace="0"' +
               ' hspace="0"' +
               ' allowtransparency="true"' +
               ' scrolling="no"></iframe>');
