﻿var map, boyicon, girlicon, showll, showinfo;
function getWindowHeight() {
    if (window.self && self.innerHeight) return self.innerHeight;
    if (document.documentElement && document.documentElement.clientHeight) return document.documentElement.clientHeight;
    return 0
}
function mapresize() {
    th = getWindowHeight() - 90;
    document.getElementById("map").style.height = th + "px"
}
function addmember(H, K, J, $, B, C, I, G, IndexNum, DIS) {
    var A = new GLatLng(J, K),
    D,
    E,
    _;
    if ($ == 1) {
        D = "网站上传";
        markerOptions = {
            icon: girlicon
        };
        _ = "http://www.gravatar.com/avatar/" + I + "?d=http%3A%2F%2Fwww.earthol.org%2Fstyle%2Fghead.jpg&s=96"
    } else {
        D = "网友上传";
        markerOptions = {
            icon: boyicon
        };
        _ = "http://m8.mayax.cn/UploadPhotos/" + I + ".jpg";
    }
    if (DIS == "ShowPic") {
    E = "<table width=\"269\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td class=\"hico\"><a href=\"" + _ + "\" target=\"_blank\"><img src=\"" + _ + "\" class=\"hi\" alt=\"点击查看大图\" border=\"0\" /></a></td><td class=\"iright\"><font color=\"#FF9900\" size=\"3\">" + D + "</font><br /><font  color=\"#999999\" size=\"-1\">男&nbsp;&nbsp;20岁<br />" + C + "</font><br /><br /><a href=\"javascript:alert('此功能正在紧张的开发中，请随时关注');\">认领图片更新心情</a></td></tr><tr><td colspan=\"2\"><b>心情描述：</b><br />暂未填写心情<font color=\"#999999\" size=\"2\">(" + H + "前上传)</font><br /></td></tr></table>";
    } else {
    E = "网友" + H + "前在" + C + "路过...";
    }
    var F = new GMarker(A, markerOptions);
    F.bindInfoWindowHtml(E);
    if (randomn == G) {
        showll = A;
        showinfo = E
    }
    map.addOverlay(F)
}
function addAddressToMap($) {
    if (!$ || $.Status.code != 200) map.openInfoWindowHtml(map.getCenter(), "无法获悉这一地点请确保所有城市、街道和地点名称无错别字。请确保您的地址包含省、自治区、市、县、乡镇的名称。试试去掉街道和街号后面过于冗长的部分。");
    else {
        place = $.Placemark[0];
        point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]);
        map.setCenter(point, 14);
        map.openInfoWindowHtml(point, place.address)
    }
}
function gothere($) {
    geocoder.getLocations($, addAddressToMap)
}
window.onresize = function() {
    mapresize()
};
if (top.location != self.location) top.location = self.location;
function loadmap() {
    mapresize();
    map = new GMap2(document.getElementById("map"));
    map.addControl(new GLargeMapControl());
    map.addControl(new GMapTypeControl());
    map.addControl(new GScaleControl());
    geocoder = new GClientGeocoder();
    geocoder.setBaseCountryCode("CN");
    var $ = new GLatLng(33.431, 109.775);
    map.setCenter($, 5, G_NORMAL_MAP);
    boyicon = new GIcon();
    boyicon.image = "http://preview.zcool.com.cn/png_download/016/tabicons_014.gif";
    boyicon.iconSize = new GSize(20, 20);
    boyicon.iconAnchor = new GPoint(10, 20);
    boyicon.infoWindowAnchor = new GPoint(10, 10);
    girlicon = new GIcon();
    girlicon.image = "http://preview.zcool.com.cn/png_download/016/tabicons_137.gif";
    girlicon.iconSize = new GSize(20, 20);
    girlicon.iconAnchor = new GPoint(10, 20);
    girlicon.infoWindowAnchor = new GPoint(10, 10)
}
