$(document).ready(function() {
function finish_load()
{
if($(window).innerHeight() < 750)
{
$("body").css("fontSize", "14px");
}
$("#about").css("left", 715);
$("#about").width($(window).innerWidth() - 760)
$("#about").css("top", $(window).innerHeight() - $("#about").outerHeight() - 50);
$("#arenda-ofisa-map").height($(window).innerHeight() - $("#header").outerHeight() + 10);
$("#panorama_drag_line").css("top", $(window).innerHeight() - 6);
$("#panorama_drag_line").css("marginLeft", $("#poisk-ofisa").outerWidth() + $("#offices-for-rent").outerWidth() - 14 + "px");
$("#panorama_drag_line").width($(window).innerWidth() - $("#poisk-ofisa").outerWidth() - $("#offices-for-rent").outerWidth() + 14);
$("#panorama").width($(window).innerWidth() - $("#poisk-ofisa").outerWidth() - $("#offices-for-rent").outerWidth() + 14);
$("#panorama").height($(window).innerHeight() - $("#arenda-ofisa-map").height() / 2 - $("#header").outerHeight() + 3);
$("#panorama").css("marginLeft", $("#poisk-ofisa").outerWidth() + $("#offices-for-rent").outerWidth() - 14 + "px");
$("#offices-for-rent").height($(window).height() - $("#header").outerHeight() - 20);
$("#offices-for-rent > div").height($("#offices-for-rent").height() - $("#offices-for-rent > span").height() -10);
$("#poisk-ofisa").height($(window).height() - $("#header").outerHeight() + 7);
$("#arenda-ofisa-metro ul").outerHeight($(window).height() - $("#header").outerHeight() - $("#form-search").height() - $("#search-offices-result").height() - 88);
$("#btn_left").css("top", $("#poisk-ofisa").height() / 2 - 22 + $("#header").outerHeight());
$("#btn_left").css("left", $("#offices-for-rent").outerWidth() + $("#poisk-ofisa").outerWidth() - 17);
}
$.getScript("/JS/jquery-ui-1.10.3.custom.min.js", function() {
$.getScript("/JS/jquery.lazyload.js", function() {
$.getScript("/JS/spin_min.js", function() {
$.getScript("http://www.google.com/jsapi").done(function(script, textStatus) {
google.load("maps","3", {"other_params":"sensor=false","callback": function() {
$.get("/metro.asp", function(data) {
$("#dialog_map").html(data);
$(".map > div").click(function() {
if($(this).hasClass("active"))
{
$(this).removeClass("active");
}
else
{
$(this).addClass("active");
}
$("#" + $(this).attr("id_metro")).click();
})
})
$("#select-metro > span").click(function() {
$("#dialog_map").dialog("open");
})
var opts_spin = {
lines: 13, // The number of lines to draw
length: 7, // The length of each line
width: 2, // The line thickness
radius: 10, // The radius of the inner circle
corners: 1, // Corner roundness (0..1)
rotate: 0, // The rotation offset
color: '#fff', // #rgb or #rrggbb
speed: 1, // Rounds per second
trail: 60, // Afterglow percentage
shadow: false, // Whether to render a shadow
hwaccel: false, // Whether to use hardware acceleration
className: 'spinner', // The CSS class to assign to the spinner
zIndex: 2e9, // The z-index (defaults to 2000000000)
top: 'auto', // Top position relative to parent in px
left: 'auto' // Left position relative to parent in px
};
var abc_id_hover;
var show_abc = 0;
var btn_left_click = 0;
var btn_right_click = 0;
var ckeck_load_google_script = 0;
var fenway;
var panoOptions;
var panorama;
var search_pano;
var myGeoObjects = [];
var myMap;
var show_panorama = 0;
var btn_hide_show = 0;
var search_string = "";
var pl1 = 300;
var pl2 = 700;
var price1 = 0;
var price2 = 100000;
var clusterer;
var balloon = null;
$("#search-result ul li img").lazyload({
placeholder : "/img/pre-loading.gif",
container: $("#search-result"),
effect : "fadeIn"
});
jQuery.fn.extend({
getMaxZ : function(){
return Math.max.apply(null, jQuery(this).map(function(){
var z;
return isNaN(z = parseInt(jQuery(this).css("z-index"), 10)) ? 0 : z;
}));
}
// использование
//$("#layer-1,#layer-2,#layer-3,#layer-4").getMaxZ();
});
jQuery.exists = function(selector) {
return ($(selector).length > 0);
}
jQuery.fn.scrollTo = function(elem, speed) {
if($.exists(elem))
{
$(this).animate({
scrollTop: $(this).scrollTop() - $(this).offset().top + $(elem).offset().top
}, speed == undefined ? 1000 : speed);
return this;
}
};
function start_search()
{
if (myMap.balloon.isOpen())
{
balloon.close();
}
$("#arenda-ofisa-map").height($(window).innerHeight() - $("#header").height() + 2);
myMap.container.fitToViewport();
$("#panorama").animate(
{top: $(window).innerHeight() + 7},
500,
function() {
$("#about").hide();
if(btn_left_click != 0)
{
$("#btn_left").css("background-image", "url('/IMG/btn_left_to_left.png')");
$("#panorama").animate({
marginLeft: $("#poisk-ofisa").outerWidth() + $("#offices-for-rent").outerWidth() - 14
},
500,
function() {
}
)
$("#offices-for-rent").animate({
marginLeft: 335
},
500,
function() {
$("#panorama").width($(window).innerWidth() - $("#poisk-ofisa").outerWidth() - $("#offices-for-rent").outerWidth() + 14);
google.maps.event.trigger(search_pano, "resize");
}
)
$("#btn_left").animate({
left: $("#offices-for-rent").outerWidth() + $("#poisk-ofisa").outerWidth() - 17
},
500,
function() {
}
)
$("#arenda-ofisa-map").animate({
marginLeft: 690
},
500,
function() {
$("#arenda-ofisa-map").width($(window).innerWidth() - $("#poisk-ofisa").outerWidth() - $("#offices-for-rent").outerWidth() + 20);
myMap.container.fitToViewport();
}
)
btn_left_click = 0;
}
var opts_spin = {
lines: 13, // The number of lines to draw
length: 7, // The length of each line
width: 2, // The line thickness
radius: 10, // The radius of the inner circle
corners: 1, // Corner roundness (0..1)
rotate: 0, // The rotation offset
color: '#000000', // #rgb or #rrggbb
speed: 1, // Rounds per second
trail: 60, // Afterglow percentage
shadow: false, // Whether to render a shadow
hwaccel: false, // Whether to use hardware acceleration
className: 'spinner', // The CSS class to assign to the spinner
zIndex: 2e9, // The z-index (defaults to 2000000000)
top: 'auto', // Top position relative to parent in px
left: 'auto' // Left position relative to parent in px
};
$("#offices-for-rent div ul").html("");
var spinner_search_result_lot = new Spinner(opts_spin).spin(document.getElementById("search-result"));
var spinner_search_result_map = new Spinner(opts_spin).spin(document.getElementById("arenda-ofisa-map"));
var list_class_bc = "";
$("#business-center li.active").each(function(index) {
list_class_bc = list_class_bc + $(this).attr("bc").toString() + ","
})
if(list_class_bc.length > 1)
{
list_class_bc = list_class_bc.substring(0, list_class_bc.length - 1)
}
var list_metro = "";
$("#arenda-ofisa-metro ul li.active").each(function(index) {
list_metro = list_metro + $(this).attr("id").toString() + ","
})
if(list_metro.length > 1)
{
list_metro = list_metro.substring(0, list_metro.length - 1)
}
clusterer.removeAll();
$.get("/get_content.asp?get_search=1&class_bc=" + list_class_bc + "&metro=" + list_metro + "&pl1=" + pl1 + "&pl2=" + pl2, function(data) {
$("#search-result").html(data);
$("#search-result ul li img").lazyload({
placeholder : "/img/pre-loading.gif",
container: $("#search-result"),
effect : "fadeIn"
});
$("#search-result ul li").each(function(index) {
var tmp_rating = $(this).find("img").attr("data-original");
tmp_rating = tmp_rating.substring(9, tmp_rating.indexOf(".jpg"))
$(this).find(" > b").css("backgroundImage", "url('/img/rating" + tmp_rating + ".png')");
})
$("#offices-for-rent ul li").click(function() {
$("#offices-for-rent ul li").each(function(index) {
$(this).removeClass("active");
})
$(this).addClass("active");
$("#about").hide();
show_marker_baloon($(this).find("img").attr("src").substring($(this).find("img").attr("src").indexOf("./photo/") + 8, $(this).find("img").attr("src").indexOf(".jpg")), 1);
})
})
$.getJSON("/json_map.asp?get_search=1&class_bc=" + list_class_bc + "&metro=" + list_metro + "&pl1=" + pl1 + "&pl2=" + pl2, function(json){
if (json.status == 'OK') {
myGeoObjects = [];
var start_search = 0;
var minLat, maxLat, minLong, maxLong;
$.each(json.markers, function(index, marker) {
if (start_search == 0)
{
minLat = marker.lon;
maxLat = marker.lon;
minLong = marker.lat;
maxLong = marker.lat;
start_search = 1;
}
var myPlacemark = new ymaps.Placemark([marker.lon, marker.lat], {
iconContent: marker.pl + " кв.м.",
id: marker.id
},
{
preset: marker.class_bc
});
myPlacemark.events.add("click", function(e) {
$("#offices-for-rent ul li").each(function(index) {
$(this).removeClass("active");
})
var tmp_img = $("img[src='/photo/" + myPlacemark.properties.get("id") + ".jpg']");
$(tmp_img).parent().addClass("active");
$("#offices-for-rent div").scrollTo($(tmp_img).parent(), 2000);
show_marker_baloon(myPlacemark.properties.get("id"), 0);
})
//myMap.geoObjects.add(myPlacemark);
myGeoObjects.push(myPlacemark);
minLat = Math.min(minLat, marker.lon);
maxLat = Math.max(maxLat, marker.lon);
minLong = Math.min(minLong, marker.lat);
maxLong = Math.max(maxLong, marker.lat);
})
clusterer.add(myGeoObjects);
position = ymaps.util.bounds.getCenterAndZoom(
[[minLat, minLong], [maxLat, maxLong]],
[$("#arenda-ofisa-map").width(), $("#arenda-ofisa-map").height()],
ymaps.projection.wgs84Mercator,
{ precizeZoom: false }
)
myMap.geoObjects.add(clusterer);
spinner_search_result_map.stop();
myMap.setCenter(position.center, position.zoom);
}
else
{
//alert('Произошла ошибка!');
}
myMap.container.fitToViewport();
})
}
)
$("#panorama_drag_line").animate(
{top: $(window).innerHeight() - 6},
500,
function() {
}
)
show_panorama = 0;
}
$("body").append("
");
$("body > div:last-child").after("");
$("#header h1").after("");
$("#offices-for-rent").after("");
$("#search-result ul li").each(function(index) {
var tmp_rating = $(this).find("img").attr("data-original");
tmp_rating = tmp_rating.substring(9, tmp_rating.indexOf(".jpg"))
$(this).find(" > b").css("backgroundImage", "url('/img/rating" + tmp_rating + ".png')");
})
$("#119").addClass("active");
$("#arenda-ofisa-metro ul").scrollTo($("#119"), 2000);
function get_count_search() {
$("#search-offices-result").html(" ");
var spinner_search_result_lot = new Spinner(opts_spin).spin(document.getElementById("search-offices-result"));
var list_class_bc = "";
$("#business-center li.active").each(function(index) {
list_class_bc = list_class_bc + $(this).attr("bc").toString() + ","
})
if(list_class_bc.length > 1)
{
list_class_bc = list_class_bc.substring(0, list_class_bc.length - 1)
}
var list_metro = "";
$("#arenda-ofisa-metro ul li.active").each(function(index) {
list_metro = list_metro + $(this).attr("id").toString() + ","
})
if(list_metro.length > 1)
{
list_metro = list_metro.substring(0, list_metro.length - 1)
}
//$.get("/get_content.asp?get_count_search=1&class_bc=" + list_class_bc + "&metro=" + list_metro + "&pl1=" + pl1 + "&pl2=" + pl2, function(data) {
$.get("/get_content.asp?get_count_search=1&class_bc=" + list_class_bc + "&metro=" + list_metro + "&pl1=" + pl1 + "&pl2=" + pl2 + "&price1=" + price1 + "&price2=" + price2, function(data) {
$("#search-offices-result").html(data);
})
}
$.get("/get_content.asp?get_abc=1", function(data) {
$("#header > div").html(data);
$("#abc > div").hover(function() {
$(abc_id_hover).addClass("active");
show_abc = 1;
},
function() {
show_abc = 0;
//$(abc_id_hover).removeClass("active");
})
$("#header > div").hover(function() {
show_abc = 1;
},
function() {
show_abc = 0;
setInterval(function() {
if(show_abc == 0)
{
$("#header > div > span").removeClass("active");
$("#abc").hide();
}
}, 500);
})
$("#header > div > span").hover(function() {
show_abc = 1;
$("#abc").css("opacity", "1");
$("#abc > div").html("");
$(abc_id_hover).removeClass("active");
$(this).addClass("active");
abc_id_hover = $(this);
$("#abc > div").css("top", $(this).offset().top + $(this).height() + 5);
$("#abc > div").css("left", $(this).offset().left - 25);
$.post(
"/get_content.asp",
{
get_by_abc: $(this).html()
},
function(data) {
$("#abc > div").html(data);
if($("#abc > div a").size() > 15)
{
$(".tmp_scroll").height(400);
$(".tmp_scroll").css("overflow-y", "scroll");
}
else
{
$(".tmp_scroll").css("overflow-y", "none");
}
$("#abc").show();
}
)
},
function() {
//show_abc = 0;
})
})
function CreateButton(text, title, id){
var BtnDiv = document.createElement('DIV');
BtnDiv.className = id;
BtnDiv.id = id;
return BtnDiv;
}
function open_dialog_zakaz()
{
$.get("/get_content.asp?zakaz_call_back=" + $("#offices-for-rent ul li.active").find("img").attr("src").substring($("#offices-for-rent ul li.active").find("img").attr("src").indexOf("./photo/") + 8, $("#offices-for-rent ul li.active").find("img").attr("src").indexOf(".jpg")), function(data) {
$("#dialog_content1").html(data);
$("#dialog1").dialog("open");
})
}
function show_map(map1, map2, heading_val, pitch_val) {
var moscow = new google.maps.LatLng(map1, map2);
var panoramaOptions = {
position: moscow,
panControl: false,
addressControl: false,
zoomControl: false,
pov: {
heading: Math.floor(heading_val),
pitch: Math.floor(pitch_val),
zoom: 1
}
};
search_pano = new google.maps.StreetViewPanorama(document.getElementById("panorama"),panoramaOptions);
google.maps.event.trigger(search_pano, "resize");
var btn_maximize = CreateButton("", "", "btn_panorama_full_screen");
search_pano.controls[google.maps.ControlPosition.RIGHT_TOP].push(btn_maximize);
var btn_hide = CreateButton("", "", "btn_panorama_hide");
search_pano.controls[google.maps.ControlPosition.RIGHT_TOP].push(btn_hide);
if(btn_hide_show == 1)
{
$(".btn_panorama_hide").addClass("btn_panorama_show");
}
google.maps.event.addDomListener(btn_maximize, 'click', function () {
$("#dialog").parent().find("span.ui-dialog-title").html($("#offices-for-rent ul li.active span").html() + ", " + $("#offices-for-rent ul li.active > a").html());
$("#dialog").dialog("open");
var dialog_pano = new google.maps.StreetViewPanorama(document.getElementById("dialog_content"),panoramaOptions);
google.maps.event.trigger(dialog_pano, "resize");
})
google.maps.event.addDomListener(btn_hide, 'click', function () {
if (btn_hide_show == 0)
{
$("#arenda-ofisa-map").height($(window).innerHeight() - $("#header").height() - 85);
myMap.container.fitToViewport();
$("#panorama").animate(
{top: $(window).innerHeight() - 93},
500,
function() {
google.maps.event.trigger(search_pano, "resize");
$(".btn_panorama_hide").addClass("btn_panorama_show");
}
)
$("#panorama_drag_line").animate(
{top: $(window).innerHeight() - 100},
500,
function() {
}
)
btn_hide_show = 1;
}
else
{
$("#panorama").height(($(window).innerHeight() - $("#header").height()) / 2 - 2);
google.maps.event.trigger(search_pano, "resize");
$("#panorama").animate(
{top: ($(window).innerHeight() - $("#header").height()) / 2 + $("#header").height() + 1},
500,
function() {
$("#arenda-ofisa-map").height(($(window).innerHeight() - $("#header").height()) / 2 + 5);
myMap.container.fitToViewport();
//google.maps.event.trigger(search_pano, "resize");
$(".btn_panorama_hide").removeClass("btn_panorama_show");
}
)
$("#panorama_drag_line").animate(
{top: ($(window).innerHeight() - $("#header").height()) / 2 + $("#header").height() - 7},
500,
function() {
}
)
btn_hide_show = 0;
}
})
}
function processSVData(data, status) {
if (status == google.maps.StreetViewStatus.OK)
{
search_pano = new google.maps.StreetViewPanorama(document.getElementById("panorama"), {
visible: true,
panControl: false,
addressControl: false,
zoomControl: false,
pov: {
heading: 270,
pitch: 0,
zoom: 1
}
});
search_pano.setPano(data.location.pano);
search_pano.setPov({
heading: 270,
pitch: 0
});
search_pano.setVisible(true);
//$("#panorama").css("display", "block");
google.maps.event.trigger(search_pano, "resize");
var btn_maximize = CreateButton("", "", "btn_panorama_full_screen");
search_pano.controls[google.maps.ControlPosition.RIGHT_TOP].push(btn_maximize);
var btn_hide = CreateButton("", "", "btn_panorama_hide");
search_pano.controls[google.maps.ControlPosition.RIGHT_TOP].push(btn_hide);
if(btn_hide_show == 1)
{
$(".btn_panorama_hide").addClass("btn_panorama_show");
}
google.maps.event.addDomListener(btn_maximize, 'click', function () {
$("#dialog").parent().find("span.ui-dialog-title").html($("#offices-for-rent ul li.active span").html() + ", " + $("#offices-for-rent ul li.active > a").html());
$("#dialog").dialog("open");
var dialog_pano = new google.maps.StreetViewPanorama(document.getElementById("dialog_content"), {
panControl: false,
addressControl: false,
zoomControl: false
});
dialog_pano.setPano(data.location.pano);
google.maps.event.trigger(dialog_pano, "resize");
})
google.maps.event.addDomListener(btn_hide, 'click', function () {
if (btn_hide_show == 0)
{
$("#arenda-ofisa-map").height($(window).innerHeight() - $("#header").height() - 85);
myMap.container.fitToViewport();
$("#panorama").animate(
{top: $(window).innerHeight() - 93},
500,
function() {
google.maps.event.trigger(search_pano, "resize");
$(".btn_panorama_hide").addClass("btn_panorama_show");
}
)
$("#panorama_drag_line").animate(
{top: $(window).innerHeight() - 100},
500,
function() {
}
)
btn_hide_show = 1;
}
else
{
$("#panorama").height(($(window).innerHeight() - $("#header").height()) / 2 - 2);
google.maps.event.trigger(search_pano, "resize");
$("#panorama").animate(
{top: ($(window).innerHeight() - $("#header").height()) / 2 + $("#header").height() + 1},
500,
function() {
$("#arenda-ofisa-map").height(($(window).innerHeight() - $("#header").height()) / 2 + 5);
myMap.container.fitToViewport();
//google.maps.event.trigger(search_pano, "resize");
$(".btn_panorama_hide").removeClass("btn_panorama_show");
}
)
$("#panorama_drag_line").animate(
{top: ($(window).innerHeight() - $("#header").height()) / 2 + $("#header").height() - 7},
500,
function() {
}
)
btn_hide_show = 0;
}
})
}
else
{
//alert("Панорама не найдена");
}
}
function show_marker_baloon(id, setcenter)
{
$("#about").hide();
$.get("/get_content.asp?get_marker_content=" + id + "&catalog_metro=devyatkin-pereulok", function(data) {
var map1 = data.substring(data.indexOf('map1=') + 6, data.indexOf('"', data.indexOf('map1=') + 6));
var map2 = data.substring(data.indexOf('map2=') + 6, data.indexOf('"', data.indexOf('map2=') + 6));
var pano_map1 = data.substring(data.indexOf('pano_map1=') + 11, data.indexOf('"', data.indexOf('pano_map1=') + 11));
var pano_map2 = data.substring(data.indexOf('pano_map2=') + 11, data.indexOf('"', data.indexOf('pano_map2=') + 11));
var pano_heading = data.substring(data.indexOf('pano_heading=') + 14, data.indexOf('"', data.indexOf('pano_heading=') + 14));
var pano_pitch = data.substring(data.indexOf('pano_pitch=') + 12, data.indexOf('"', data.indexOf('pano_pitch=') + 12));
if(pano_map1.length > 1)
{
if(show_panorama == 0)
{
$("#panorama").animate(
{top: $(window).innerHeight() - $("#arenda-ofisa-map").height() / 2 + 7},
500,
function() {
$("#arenda-ofisa-map").height($(window).innerHeight() - $("#header").height() - $("#panorama").height() + 10);
myMap.container.fitToViewport();
//search_pano = new google.maps.StreetViewPanorama(document.getElementById("panorama"),panoramaOptions);
//google.maps.event.trigger(search_pano, "resize");
show_map(pano_map1, pano_map2, pano_heading, pano_pitch)
if(setcenter == 1)
{
//myMap.panTo([map1, map2], {
// flying: true,
// duration: 3000
//});
myMap.setCenter([map1, map2], 15);
balloon = myMap.balloon.open([map1, map2], data);
}
else
{
balloon = myMap.balloon.open([map1, map2], data);
}
$(".map_marker_balloon > p > u").click(function() {
open_dialog_zakaz();
})
}
)
$("#panorama_drag_line").animate(
{top: $(window).innerHeight() - $("#arenda-ofisa-map").height() / 2},
500,
function() {
$("#panorama_drag_line").draggable({
axis: "y",
drag: function(event, ui) {
var t = ui.position.top;
if(t < $("#header").height() + 100)
{
return false;
}
if(t > $(window).innerHeight() - 100)
{
return false;
}
$("#panorama").height($(window).innerHeight() - t - 7);
$("#panorama").css("top", t + 7);
google.maps.event.trigger(search_pano, "resize");
$("#arenda-ofisa-map").height($(window).innerHeight() - $("#header").height() - $("#panorama").height() + 10);
myMap.container.fitToViewport();
}
});
}
)
show_panorama = 1;
}
else
{
if(setcenter == 1)
{
myMap.panTo([map1, map2], {
flying: true,
duration: 3000
});
//myMap.setCenter([map1, map2], 15);
balloon = myMap.balloon.open([map1, map2], data);
}
else
{
balloon = myMap.balloon.open([map1, map2], data);
}
$(".map_marker_balloon > p > u").click(function() {
open_dialog_zakaz();
})
show_map(pano_map1, pano_map2, pano_heading, pano_pitch)
}
}
else
{
//если панорамы в базе нет
if(show_panorama == 0)
{
$("#panorama").animate(
{top: $(window).innerHeight() - $("#arenda-ofisa-map").height() / 2 + 7},
500,
function() {
$("#arenda-ofisa-map").height($(window).innerHeight() - $("#header").height() - $("#panorama").height() + 10);
myMap.container.fitToViewport();
var tmp_address = data.substring(data.indexOf('address=') + 9, data.indexOf('"', data.indexOf('address=') + 9));
var geocoder = new google.maps.Geocoder();
var results = geocoder.geocode(
{
address: tmp_address
},
function callback(results, status)
{
if (status == google.maps.GeocoderStatus.OK)
{
var map = results[0].geometry.location.toString()
var map1 = map.substring(1, map.indexOf(","))
var map2 = map.substring(map.indexOf(", ") + 2)
map2 = map2.substring(0, map2.indexOf(")"))
var sv = new google.maps.StreetViewService();
click_latLng_pano = new google.maps.LatLng(map1, map2);
sv.getPanoramaByLocation(click_latLng_pano, 500, processSVData)
}
else
{
//alert("Адрес не найден");
}
}
);
if(setcenter == 1)
{
//myMap.panTo([map1, map2], {
// flying: true,
// duration: 3000
//});
myMap.setCenter([map1, map2], 15);
balloon = myMap.balloon.open([map1, map2], data);
}
else
{
balloon = myMap.balloon.open([map1, map2], data);
}
$(".map_marker_balloon > p > u").click(function() {
open_dialog_zakaz();
})
}
)
$("#panorama_drag_line").animate(
{top: $(window).innerHeight() - $("#arenda-ofisa-map").height() / 2},
500,
function() {
$("#panorama_drag_line").draggable({
axis: "y",
drag: function(event, ui) {
var t = ui.position.top;
if(t < $("#header").height() + 100)
{
return false;
}
if(t > $(window).innerHeight() - 100)
{
return false;
}
$("#panorama").height($(window).innerHeight() - t - 7);
$("#panorama").css("top", t + 7);
google.maps.event.trigger(search_pano, "resize");
$("#arenda-ofisa-map").height($(window).innerHeight() - $("#header").height() - $("#panorama").height() + 10);
myMap.container.fitToViewport();
}
});
}
)
show_panorama = 1;
}
else
{
if(setcenter == 1)
{
//myMap.panTo([map1, map2], {
// flying: true,
// duration: 3000
//});
myMap.setCenter([map1, map2], 15);
balloon = myMap.balloon.open([map1, map2], data);
}
else
{
balloon = myMap.balloon.open([map1, map2], data);
}
$(".map_marker_balloon > p > u").click(function() {
open_dialog_zakaz();
})
var tmp_address = data.substring(data.indexOf('address=') + 9, data.indexOf('"', data.indexOf('address=') + 9));
var geocoder = new google.maps.Geocoder();
var results = geocoder.geocode(
{
address: tmp_address
},
function callback(results, status)
{
if (status == google.maps.GeocoderStatus.OK)
{
var map = results[0].geometry.location.toString()
var map1 = map.substring(1, map.indexOf(","))
var map2 = map.substring(map.indexOf(", ") + 2)
map2 = map2.substring(0, map2.indexOf(")"))
var sv = new google.maps.StreetViewService();
click_latLng_pano = new google.maps.LatLng(map1, map2);
sv.getPanoramaByLocation(click_latLng_pano, 500, processSVData)
}
else
{
//alert("Адрес не найден");
}
}
);
}
}
})
}
$("#offices-for-rent ul li").click(function() {
$("#offices-for-rent ul li").each(function(index) {
$(this).removeClass("active");
})
$(this).addClass("active");
$("#about").hide();
show_marker_baloon($(this).find("img").attr("src").substring($(this).find("img").attr("src").indexOf("./photo/") + 8, $(this).find("img").attr("src").indexOf(".jpg")), 1);
})
$( "#price" ).slider({
values: [ 0, 100000 ],
min: 0,
max: 100000,
step: 10000,
range: true,
slide: function( event, ui ) {
if(ui.values[0] == ui.values[1])
{
return false;
}
else
{
price1 = ui.values[0];
price2 = ui.values[1];
$("#range_price span").html(ui.values[0] + "-" + ui.values[1] + " руб/м2 в год");
get_count_search();
}
}
});
$( "#pl" ).slider({
values: [ 0, 1000 ],
min: 0,
max: 1000,
step: 100,
range: true,
slide: function( event, ui ) {
if(ui.values[0] == ui.values[1])
{
return false;
}
else
{
if(ui.values[0] == 0)
{pl1 = 0}
if(ui.values[0] == 100)
{pl1 = 200}
if(ui.values[0] == 200)
{pl1 = 300}
if(ui.values[0] == 300)
{pl1 = 500}
if(ui.values[0] == 400)
{pl1 = 700}
if(ui.values[0] == 500)
{pl1 = 1000}
if(ui.values[0] == 600)
{pl1 = 1500}
if(ui.values[0] == 700)
{pl1 = 2000}
if(ui.values[0] == 800)
{pl1 = 3000}
if(ui.values[0] == 900)
{pl1 = 4000}
if(ui.values[0] == 1000)
{pl1 = 5000}
if(ui.values[1] == 0)
{pl2 = 0}
if(ui.values[1] == 100)
{pl2 = 200}
if(ui.values[1] == 200)
{pl2 = 300}
if(ui.values[1] == 300)
{pl2 = 500}
if(ui.values[1] == 400)
{pl2 = 700}
if(ui.values[1] == 500)
{pl2 = 1000}
if(ui.values[1] == 600)
{pl2 = 1500}
if(ui.values[1] == 700)
{pl2 = 2000}
if(ui.values[1] == 800)
{pl2 = 3000}
if(ui.values[1] == 900)
{pl2 = 4000}
if(ui.values[1] == 1000)
{pl2 = 5000}
if(ui.values[1] == 1000)
{
$("#range-pl span").html(pl1 + "-" + pl2 + " м2 и более");
}
else
{
$("#range-pl span").html(pl1 + "-" + pl2 + " м2");
}
get_count_search();
}
}
});
$('#pl .ui-slider-handle').each(function (index, handle) {
$(this).width(20);
//$(this).css("marginLeft", "-8px");
});
$("#arenda-ofisa-metro ul li").click(function() {
if($(this).hasClass("active"))
{
$(this).removeClass("active")
}
else
{
$(this).addClass("active")
}
get_count_search();
})
$("#select-metro ul li").click(function() {
$("#select-metro ul li").removeClass("active")
$(this).addClass("active")
})
$("#business-center li").click(function() {
if($(this).hasClass("active"))
{
$(this).removeClass("active")
}
else
{
$(this).addClass("active")
}
get_count_search();
})
$("#search-offices-result").click(function() {
start_search();
})
$("body").append("");
$("#arenda-ofisa-map").after("
");
$("#panorama_drag_line").after("");
ymaps.ready(function() {
$.getJSON("/json_map.asp?catalog_street=devyatkin-pereulok", function(json){
if (json.status == 'OK') {
myGeoObjects = [];
var start_search = 0;
var minLat, maxLat, minLong, maxLong;
$.each(json.markers, function(index, marker) {
if (start_search == 0)
{
minLat = marker.lon;
maxLat = marker.lon;
minLong = marker.lat;
maxLong = marker.lat;
start_search = 1;
}
var myPlacemark = new ymaps.Placemark([marker.lon, marker.lat], {
iconContent: marker.pl + " кв.м.",
id: marker.id
},
{
preset: marker.class_bc
});
myPlacemark.events.add("click", function(e) {
$("#offices-for-rent ul li").each(function(index) {
$(this).removeClass("active");
})
var tmp_img = $("img[src='/photo/" + myPlacemark.properties.get("id") + ".jpg']");
$(tmp_img).parent().addClass("active");
$("#offices-for-rent div").scrollTo($(tmp_img).parent(), 2000);
show_marker_baloon(myPlacemark.properties.get("id"), 0);
})
//myMap.geoObjects.add(myPlacemark);
myGeoObjects.push(myPlacemark);
minLat = Math.min(minLat, marker.lon);
maxLat = Math.max(maxLat, marker.lon);
minLong = Math.min(minLong, marker.lat);
maxLong = Math.max(maxLong, marker.lat);
})
clusterer = new ymaps.Clusterer({
maxZoom: 15
});
clusterer.add(myGeoObjects);
position = ymaps.util.bounds.getCenterAndZoom(
[[minLat, minLong], [maxLat, maxLong]],
[$("#arenda-ofisa-map").width(), $("#arenda-ofisa-map").height()],
ymaps.projection.wgs84Mercator,
{ precizeZoom: false }
)
myMap = new ymaps.Map("arenda-ofisa-map", position, {
minZoom: 11,
maxZoom: 16
});
//myMap.setCenter(position.center, position.zoom, {
// checkZoomRange: true
//});
myMap.controls
.add('zoomControl', { right: 20, top: 20 })
myMap.geoObjects.add(clusterer);
}
else
{
myMap = new ymaps.Map("arenda-ofisa-map",
{
center: [55.76, 37.64],
zoom: 15
},
{
minZoom: 1,
maxZoom: 17
}
);
myMap.controls
.add('zoomControl', { right: 20, top: 20 })
//alert('Произошла ошибка!');
}
myMap.container.fitToViewport();
})
});
$("#btn_left").click(function() {
$("#about").hide();
if(btn_left_click == 0)
{
$("#btn_left").css("background-image", "url('/IMG/btn_left_to_right.png')");
var tmp_width = 6;
$("#panorama_drag_line").width($(window).innerWidth() - $("#poisk-ofisa").outerWidth() - tmp_width);
$("#panorama").width($(window).innerWidth() - $("#poisk-ofisa").outerWidth() - tmp_width);
$("#arenda-ofisa-map").width($(window).innerWidth() - $("#poisk-ofisa").outerWidth() - tmp_width + 18);
myMap.container.fitToViewport();
google.maps.event.trigger(search_pano, "resize");
$("#panorama").animate({
marginLeft: $("#poisk-ofisa").outerWidth() + tmp_width
},
500,
function() {
}
)
$("#panorama_drag_line").animate({
marginLeft: $("#poisk-ofisa").outerWidth() + tmp_width
},
500,
function() {
}
)
$("#offices-for-rent").animate({
marginLeft: -8
},
500,
function() {
}
)
$("#btn_left").animate({
left: 346
},
500,
function() {
}
)
$("#arenda-ofisa-map").animate({
marginLeft: 330
},
500,
function() {
}
)
btn_left_click = 1;
}
else
{
$("#btn_left").css("background-image", "url('/IMG/btn_left_to_left.png')");
$("#panorama").animate({
marginLeft: $("#poisk-ofisa").outerWidth() + $("#offices-for-rent").outerWidth() - 14
},
500,
function() {
}
)
$("#offices-for-rent").animate({
marginLeft: 335
},
500,
function() {
$("#panorama").width($(window).innerWidth() - $("#poisk-ofisa").outerWidth() - $("#offices-for-rent").outerWidth() + 14);
google.maps.event.trigger(search_pano, "resize");
}
)
$("#btn_left").animate({
left: $("#offices-for-rent").outerWidth() + $("#poisk-ofisa").outerWidth() - 17
},
500,
function() {
}
)
$("#arenda-ofisa-map").animate({
marginLeft: 690
},
500,
function() {
$("#arenda-ofisa-map").width($(window).innerWidth() - $("#poisk-ofisa").outerWidth() - $("#offices-for-rent").outerWidth() + 20);
myMap.container.fitToViewport();
}
)
btn_left_click = 0;
}
})
show_map(0, 0, 80, 6);
//$("body").append("");
$("#dialog").dialog({
autoOpen: false,
resizable: false,
modal: true,
closeOnEscape: true,
title: "Панорама улиц рядом с бизнес центром",
width: $(window).innerWidth() - 100,
height: $(window).innerHeight() - 100,
open: function() {
$('.ui-dialog').css('z-index', 90000012);
$('.ui-widget-overlay').css('z-index', 90000003);
$('.ui-widget-overlay').css('opacity', 0.2);
$('.ui-widget-overlay').css('background', '#2b2c2f');
$('.ui-widget-header').css("font-size", "18px");
$('.ui-widget-header').css("font-weight", "bold");
$('.ui-widget-header').css("font-family", "Roboto Condensed");
$(".ui-dialog").css("box-shadow","#4D4D4D 0px 0px 50px");
}
});
$("#dialog1").dialog({
autoOpen: false,
resizable: false,
modal: true,
closeOnEscape: true,
title: "Заявка на обратный звонок",
width: "auto",
open: function() {
$('.ui-dialog').css('z-index', 90000012);
$('.ui-widget-overlay').css('z-index', 90000003);
$('.ui-widget-overlay').css('opacity', 0.2);
$('.ui-widget-overlay').css('background', '#2b2c2f');
$('.ui-widget-header').css("font-size", "18px");
$('.ui-widget-header').css("font-weight", "bold");
$('.ui-widget-header').css("font-family", "Roboto Condensed");
$(".ui-dialog").css("box-shadow","#4D4D4D 0px 0px 50px");
$(".ui-dialog").css("box-shadow","#4D4D4D 0px 0px 50px");
$('.ui-widget-overlay').addClass('custom-overlay');
$(this).closest('.ui-dialog').find('.ui-dialog-titlebar-close').show();
},
close: function() {
$('.ui-widget-overlay').removeClass('custom-overlay');
}
});
$("#dialog_map").dialog({
autoOpen: false,
resizable: false,
modal: true,
closeOnEscape: true,
title: "Выберите станции метро",
width: "auto",
open: function() {
$('.ui-dialog').css('z-index', 90000012);
$('.ui-widget-overlay').css('z-index', 90000003);
$('.ui-widget-overlay').css('opacity', 0.2);
$('.ui-widget-overlay').css('background', '#2b2c2f');
$('.ui-widget-header').css("font-size", "18px");
$('.ui-widget-header').css("font-weight", "bold");
$('.ui-widget-header').css("font-family", "Roboto Condensed");
$(".ui-dialog").css("box-shadow","#4D4D4D 0px 0px 50px");
$(".ui-dialog").css("box-shadow","#4D4D4D 0px 0px 50px");
$('.ui-widget-overlay').addClass('custom-overlay');
$(this).closest('.ui-dialog').find('.ui-dialog-titlebar-close').show();
},
close: function() {
$('.ui-widget-overlay').removeClass('custom-overlay');
}
});
finish_load();
}});
})
})
})
})
$(window).load(function() {
finish_load();
})
})