var MARKER_TYPE = ''; var map; var MARKER = new Array(); var nMARKER = new Array(); var MKP = new Array(); var RK; var mLat = 0; var mLng = 0; var mapStat = 0; var count = 0; var mCount = 0; var MapWidth = 0; var MapHeight = 0; waitimg = new Image(); waitimg.src="imgs/wait.gif"; waitimg2 = new Image(); waitimg2.src="imgs/wait2.gif"; AB1 = new Image(); AB1.src="imgs/AddButton1.png"; AB2 = new Image(); AB2.src="imgs/AddButton2.png"; AB3 = new Image(); AB3.src="imgs/AddButton3.png"; AB4 = new Image(); AB4.src="imgs/AddButton4.png"; window.addEvent('domready', function() { StartMT(); }); function apost(divs,vals) { rndv=Math.random(); $(divs).set('html',''); $('wimg'+rndv).set('src',waitimg2.src); nww = new Request.HTML({ async: false, method: 'post', data: vals, url: '../inc/javaset.php', onSuccess: function(responseTree, responseElements, responseHTML, responseJavaScript) { $(divs).set('html',responseHTML); } }).send(); } function bpost(divs,vals) { rndv=Math.random(); $(divs).set('html',''); $('wimg'+rndv).set('src',waitimg2.src); nww = new Request.HTML({ async: true, method: 'post', data: vals, url: '../inc/javaset.php', onSuccess: function(responseTree, responseElements, responseHTML, responseJavaScript) { $(divs).set('html',responseHTML); } }).send(); } function xpost(vals) { nww = new Request.HTML({ method: 'post', data: vals, url: '../inc/javaset.php' }).send(); } function StartMT() { window.addEvent('domready', function() { var size = $('SpbNuBody').getSize(); MapWidth = size.x - 300; MapHeight = size.y - 8; $('YMapsID').setStyle('width', MapWidth + 'px'); $('YMapsID').setStyle('height', MapHeight + 'px'); }); map = new YMaps.Map(document.getElementById("YMapsID")); var StartPoint = new YMaps.GeoPoint(30.31605044379832,59.93898858875901); map.setCenter(StartPoint,15); map.addControl(new YMaps.TypeControl()); map.addControl(new YMaps.ToolBar()); map.addControl(new YMaps.Zoom()); map.addControl(new YMaps.ScaleLine()); map.addControl(new YMaps.SearchControl()); // ============ Маркеры ============================================================================== for (i=1; i<=317; i++) { //> MARKER[i] = new YMaps.Style(); MARKER[i].iconStyle = new YMaps.IconStyle(); MARKER[i].iconStyle.href = "/imgs/markers/mark" + i + ".png"; MARKER[i].iconStyle.size = new YMaps.Point(16, 16); MARKER[i].iconStyle.offset = new YMaps.Point(-8, -8); YMaps.Styles.add("MARKER["+i+"]",MARKER[i]); } for (i=1; i<=2; i++) { //> nMARKER[i] = new YMaps.Style(); nMARKER[i].iconStyle = new YMaps.IconStyle(); nMARKER[i].iconStyle.href = "/imgs/markers/marker" + i + ".png"; nMARKER[i].iconStyle.size = new YMaps.Point(10, 10); nMARKER[i].iconStyle.offset = new YMaps.Point(-5, -5); YMaps.Styles.add("nMARKER["+i+"]",nMARKER[i]); } // =================================================================================================== map.addControl(new PointAdder()); $('ABI').addEvent('mouseover',function() { $('ABI').set('class', 'AB2'); }); $('ABI').addEvent('mouseout',function() { $('ABI').set('class', 'AB1'); }); $('ABI2').addEvent('mouseover',function() { $('ABI2').set('class', 'AB2'); }); $('ABI2').addEvent('mouseout',function() { $('ABI2').set('class', 'AB1'); }); // =================================================================================================== } function PointAdder() { this.onAddToMap = function (map, position) { this.container = YMaps.jQuery("
"); this.map = map; this.position = position || new YMaps.ControlPosition(YMaps.ControlPosition.TOP_LEFT, new YMaps.Size(10, 10)); this.container.css({ position: "absolute", zIndex: YMaps.ZIndex.CONTROL, listStyle: 'none', margin: '30px 0px 0px -5px', }); AddButton = YMaps.jQuery("
Авторизация
Регистрация
"); AddButton.appendTo(this.container); this.position.apply(this.container); this.container.appendTo(this.map.getContainer()); } this.onRemoveFromMap = function () { this.container.remove(); this.container = this.map = null; }; } function POPcreate(winX,winY,POPname,topContent,params,CloseFunc) { if ($(POPname+'['+count+']')) { RemoveDiv(POPname+'['+count+']'); } count++; ForOpen = "true"; for (i=0;i < count; i++) { if (document.getElementById(POPname + "[" + i + "]") != null) { ForOpen = "false"; } } popID = POPname + '[' + count + "]"; if (ForOpen == "true") { desc_content = ''; var popWin = new dWindow({ id:popID, content: desc_content, width: winX, height: winY, minWidth: 180, minHeight: 160, left: 200, top: 100, topContent: topContent, NewCount: count, params: params, CloseFunc: CloseFunc }).open($(document.body)); } } function RemoveDiv(divs){ var h2 = document.getElementById(divs); var el; el=h2; while(true){ if(el.tagName=="DIV"){ el.parentNode.removeChild(el); return; } el = el.parentNode; } } function CloseDivEvent(RemoveDivID,CloseFunc) { eval(CloseFunc); RemoveDiv(RemoveDivID); } function Authorize() { POPcreate(300,200,"AuthForm","Авторизация","do=AuthForm"); } function RegForm() { POPcreate(400,500,"AuthForm","Регистрация нового пользователя","do=RegForm","CloseRegForm()"); } function SetRegPosition() { POPcreate(300,500,"RegPositionForm","Местоположение","do=RegPositionForm"); } function SetRegLocation(CountryID,RegionID,CityID) { for (i=1;i < count + 1; i++) { if ($('RegPositionForm['+i+']')) { RemoveDiv('RegPositionForm['+i+']'); } } nww = new Request.HTML({ async: false, method: 'post', data: 'do=GetFullPositionNameByCityID&CityID=' + CityID, url: '../inc/javaset.php', onSuccess: function(responseTree, responseElements, responseHTML, responseJavaScript) { RegPositionName = responseHTML; } }).send(); $('RegPositionDiv').set('html',RegPositionName); var geocoder = new YMaps.Geocoder(RegPositionName, { prefLang : "ru" } ); YMaps.Events.observe(geocoder, geocoder.Events.Load, function() { geoResult = this.get(0); MoveTO = new YMaps.GeoPoint(geoResult._point.__lng, geoResult._point.__lat); map.setCenter(MoveTO,10); FindLNG = geoResult._point.__lng; FindLAT = geoResult._point.__lat; $('RegLng').set('value',FindLNG); $('RegLat').set('value',FindLAT); RegGP = new YMaps.GeoPoint(FindLNG,FindLAT); RK = new YMaps.Placemark(RegGP, {style: nMARKER[2], draggable: true, hideIcon: false}); map.addOverlay(RK); YMaps.Events.observe(RK, RK.Events.DragEnd, function(rMKP) { rgp = rMKP.getGeoPoint(); mLat = rgp.getLat(); mLng = rgp.getLng(); }); }); $('UserPositionName').set('value',RegPositionName); } function JForm(formID, resID) { $(formID).addEvent('submit', function(e) { rndv=Math.random(); var container = $(resID); container.set("html", ""); var wimg = $("wimg"+rndv); wimg.set("src", waitimg.src); new Event(e).stop(); this.set('send', { update: resID, onComplete: function(html) { container.set('html', html); } }).send(); }); return false; } function RegCheck() { rndv=Math.random(); $('RegResultDiv').set('html', ''); $('wimg['+rndv+']').set('src', waitimg.src); if ($('username').get('value') != "") { if ($('password1').get('value') != "") { if ($('password1').get('value') == $('password2').get('value')) { err = '22'; } else if ($('password2').get('value') == "") { err = '
Не заполнено поле \"Подтверждение пароля\"!
'; } else { err = '
Пароль и подтверждение не совпадают!
'; } } else { err = '
Не заполнено поле \"Пароль\"!
'; } } else { err = '
Не заполнено поле \"Имя пользователя\"!
'; } if (err != "") { $('RegResultDiv').set('html',err); } // JForm('RegistrationForm', 'RegResultDiv'); } function CloseRegForm() { for (i=1;i < count + 1; i++) { if ($('RegPositionForm['+i+']')) { RemoveDiv('RegPositionForm['+i+']'); } } map.removeOverlay(RK); }