//"; for (var i=0; i"+name_user[i].firstChild.nodeValue+""; } strComment += " "+date[i].firstChild.nodeValue+"
"; strComment += text_comment[i].firstChild.nodeValue+"

"; } strComment += ""; var windowOption = {maxTitle: 'Комментарии', maxContent: strComment }; map.openInfoWindowHtml(map.getCenter(), strComment, windowOption); var infoWindow = map.getInfoWindow(); infoWindow.enableMaximize(); infoWindow.maximize(); } } } /** Посылка запроса: Получить информацию о маркере **/ function getInfoMarker(id) { if (id == null ){ var url = "./catalog/mapscripts/get_info_marker.php?marker_id="+markerSelect.value+"&cid="+cid; } else { var url = "./catalog/mapscripts/get_info_marker.php?marker_id="+id+"&cid="+cid; } request.open("GET", url, true); request.onreadystatechange = getInfoMarkerAnswer; request.send(null); } /** Обработка ответа: Получить информацию о маркере **/ function getInfoMarkerAnswer() { if (request.readyState == 4) { if (request.status == 200) { // получаем информацию в XML var xmlDoc = request.responseXML; //alert(xmlDoc.firstChild.childNodes[1].firstChild.nodeValue); // Извлекаем всю информацию о маркере var marker_id = xmlDoc.getElementsByTagName("marker_id"); var type_marker = xmlDoc.getElementsByTagName("type_marker"); var name_shop = xmlDoc.getElementsByTagName("name_shop"); var phone = xmlDoc.getElementsByTagName("phone"); var url = xmlDoc.getElementsByTagName("url"); var desc = xmlDoc.getElementsByTagName("desc"); var count_comments = xmlDoc.getElementsByTagName("count_comments"); var type = type_marker[0].firstChild.nodeValue; var ftime = xmlDoc.getElementsByTagName("ftime"); var value = ""; // Строка сообщения if (name_shop[0].firstChild != null) { value += "
Название: "+name_shop[0].firstChild.nodeValue+"
"; } if (phone[0].firstChild != null) { value += "Телефон: "+phone[0].firstChild.nodeValue+"
"; } if (url[0].firstChild != null) { value += "Сайт: "+url[0].firstChild.nodeValue+"
"; } if (ftime[0].firstChild != null) { value += "Время работы: "+ ftime[0].firstChild.nodeValue +"
"; } if (desc[0].firstChild != null) { value += "Описание: "+desc[0].firstChild.nodeValue; value += " подробнее
"; } value += "
"; if (count_comments[0].firstChild.nodeValue > 0){ value += "Комментарии ("+count_comments[0].firstChild.nodeValue+")"; } value += "Добавить комментарий
"; if (value.length > 600 ) { var windowOption = {maxTitle: 'Информация о фирме', maxContent: value }; // markerSelect.openInfoWindowHtml(value, windowOption); map.openInfoWindowHtml(map.getCenter(), value, windowOption); var infoWindow = map.getInfoWindow(); infoWindow.enableMaximize(); infoWindow.minimize(); } else { map.openInfoWindowHtml(map.getCenter(), value); // markerSelect.openInfoWindowHtml(value); } } } } /** Функция поиска по организациям **/ function findShops() { var findstr = document.getElementById("find_shops").value; if (findstr != "") { var send = "searchstr="+findstr; var url = "./catalog/mapscripts/find_shop.php"; // alert(send); request.open("POST", url, true); request.onreadystatechange = findShopAnswer; request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); request.send(send); } } function findShopAnswer() { if (request.readyState == 4) { if (request.status == 200) { var xmlDoc = request.responseXML; // alert(xmlDoc.firstChild.childNodes[1].firstChild.nodeValue); // Извлекаем всю информацию о маркере var shops = xmlDoc.getElementsByTagName("shops"); var id_shop = xmlDoc.getElementsByTagName("id_shop"); var name_shop = xmlDoc.getElementsByTagName("name_shop"); var address_shop = xmlDoc.getElementsByTagName("address_shop"); var type_shop = xmlDoc.getElementsByTagName("type_shop"); var lan = xmlDoc.getElementsByTagName("lan"); var lng = xmlDoc.getElementsByTagName("lng"); if (shops.length > 0) { setLoacationLatLng(lan[0].firstChild.nodeValue, lng[0].firstChild.nodeValue, id_shop[0].firstChild.nodeValue, 15); } else { alert("Ничего по запросу не найдено"); } } } } /** ------ Функции добавления комментария ------------------ */ /** Добавить комментарий к метке **/ function addComment(id, user_id, type) { var commentNode = ""; if (user_id == "") { commentNode += "Введите Ваше имя:

"; } commentNode += " "; commentNode += "Введите Ваш комментарий:


"; markerSelect.openInfoWindowHtml(commentNode); } /** Посылка запроса добавления комментария к метке **/ function insertCommentShop(id, user_id, type) { var text_comment = document.getElementById("comment").value; if (text_comment == "") {alert("Вы не ввели комментарий.");} else { commentId = id; commentType = type; if (user_id == "") { var user_id = encodeURIComponent(document.getElementById("name").value); } var send = "id="+id+"&uid="+user_id+"&type="+type+"&text_comment="+encodeURIComponent(text_comment)+"&code=vldmg"; var url = "./catalog/mapscripts/map_insert_comment.php"; request.open("POST", url, true); request.onreadystatechange = insertCommentShopAnswer; request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); request.send(send); } } /** Обработка ответа добавления комментария к метке **/ function insertCommentShopAnswer() { if (request.readyState == 4) { if (request.status == 200) { alert("insertCommentShopAnswer"); alert(request.responseText); getComment(commentId, commentType, 1); } } } /** ------------------------------------------------------- */ //]]>