WM.addFav = function(id)
{
	if(WM.getCookie("cwiki_autologin_user") == null)
    {
		alert("Save this Gmapwiki to favorites, you have to log in");
        return false;
    }
	var url = "/bookmark.php";
	var pars = "act=add&mapid=" + id;
	var myAjax = new Ajax.Request(url, {method: 'get', parameters: pars, onComplete: WM.showAddFavTip, onFailure: showError});
}

WM.showAddFavTip = function(xmlHttp)
{
	var xml = xmlHttp.responseXML;
	var result = WM.getXmlData(xml, "result");
	if(result == 1)
	{
		WM.showTip("Save this Gmapwiki to favorites successfully!");
	}
	else if(result==2)
	{
		WM.showTip("This Gmapwiki had been saved!");
	}
	else
	{
		WM.showTip("Save this Gmapwiki to favorites failed!");
	}
}