jQuery(document).ready(function(){$('input[name="email"]').hide();loadPrice() $('.estNav li').click(function(){$('.estNav li').each(function(){$(this).attr('id','normli');});$(this).attr('id','currli');});$('.estNav li:first').attr('id','currli');$('.shopPrices').click(function(){$('html,body').animate({scrollTop:$('.objectPrices').offset().top-10},'slow');loadPrice();});function loadPrice(){var estateID=$('.showEstateInfo').attr('id');var orderby='f1';var type='asc';$.post("/manage",{getEstatePrices:"yep",estateID:estateID,orderby:orderby,type:type},function(data){$('.objectPrices').html(data);hideAll('.objectPrices');});} $('.shopInfo').click(function(){hideAll('.showEstateInfo');$('html,body').animate({scrollTop:$('.estNav').offset().top},'slow');});$('.closeMapObject').hide();$('.closeMapObject').click(function(){hideAll('.showEstateInfo');$('html,body').animate({scrollTop:$('.estNav').offset().top},'slow');$('.estNav li').attr('id','normli');$('.estNav li:first').attr('id','currli');});$('.closeGallery').click(function(){$('.gallery .img').html('');hideAll('.showEstateInfo');$('html,body').animate({scrollTop:$('.estNav').offset().top},'slow');$('.estNav li').attr('id','normli');$('.estNav li:first').attr('id','currli');});$('.shopGallery').click(function(){hideAll('.gallery');$('html,body').animate({scrollTop:$('.estNav').offset().top},'slow');var albumID=$('.galBtn:first').attr('id');$.post("/manage",{getAlbum:"yep",albumID:albumID},function(data){$('.gallery .img').html(data);});});$('.showVidGal').click(function(){hideAll('.gallery');$('html,body').animate({scrollTop:$('.estNav').offset().top},'slow');var albumID=$(this).attr('data-id');$('.galBtn').each(function(){$(this).attr('class','galBtn');});$(this).attr('class','showVidGal current');$.post("/manage",{getVideoAlbum:"yep",id_development:albumID},function(data){$('.gallery .img').html(data);});});$('.shopMap').click(function(){$('.closeMapObject').show();var z=parseFloat($('#estateMap').attr('z'));var x=parseFloat($('#estateMap').attr('x'));var y=parseFloat($('#estateMap').attr('y'));hideAll('#map_canvas');var HOME=new google.maps.LatLng(x,y);var markers=[];var map;initialize(x,y,z);});function hideAll(show){$('.gallery .img').html('');$('.gallery').hide();$('#map_canvas').hide();$('.estateMap').hide();$(show).show();if(show=='#map_canvas'){$('.estateMap').show();} if(show=='.gallery'){$('.galBtn:first').addClass("current");} else{$('.estateInfo').attr('style','');}} function initialize(x,y,z){if($('#map_canvas').length==1){var HOME=new google.maps.LatLng(x,y);var markers=[];var map;var map_canvas=document.getElementById('map_canvas');var map_options={zoom:z,mapTypeId:google.maps.MapTypeId.ROADMAP,mapTypeControl:true,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.HORIZONTAL_BAR,position:google.maps.ControlPosition.BOTTOM_CENTER},} var map=new google.maps.Map(map_canvas,map_options);var marker=new google.maps.Marker({map:map,draggable:false,animation:google.maps.Animation.DROP,position:HOME});map.setCenter(HOME);map.setZoom(z);google.maps.event.addListener(map,'zoom_changed',function(){this.zoomChanged=true;});}} var rubPrice=parseFloat($('.priceRub').attr('id'));var usdPrice=parseFloat($('.priceDollar').attr('id'));var levPrice=parseFloat($('.priceBGN').attr('id'));var euroPrice=parseFloat($('.priceEuro').attr('id'));$('.priceBGN').click(function(){var price=$('#prc').attr('alt');var hidePrice=$(this).attr('class');priceRangeUpdate(hidePrice);price=price*levPrice;price=Math.round(price);$('#prc').html(price+' лв.');var priceOLD=$('.estPRICEOLD').attr('alt');if(priceOLD!=undefined){priceOLD=priceOLD*levPrice;priceOLD=Math.round(priceOLD);$('.estPRICEOLD').html(priceOLD+' лв.');}});$('.priceEuro').click(function(){var price=$('#prc').attr('alt');var hidePrice=$(this).attr('class');priceRangeUpdate(hidePrice);price=parseFloat(price);price=price*euroPrice;price=Math.round(price);$('#prc').html('€ '+price+'');var priceOLD=$('.estPRICEOLD').attr('alt');if(priceOLD!=undefined){priceOLD=priceOLD*euroPrice;priceOLD=Math.round(priceOLD);$('.estPRICEOLD').html('€ '+priceOLD+'');}});$('.priceDollar').click(function(){var price=$('#prc').attr('alt');var hidePrice=$(this).attr('class');priceRangeUpdate(hidePrice);price=parseFloat(price);price=price*usdPrice;price=Math.round(price);$('#prc').html('$ '+price+'');var priceOLD=$('.estPRICEOLD').attr('alt');if(priceOLD!=undefined){priceOLD=priceOLD*usdPrice;priceOLD=Math.round(priceOLD);$('.estPRICEOLD').html('$ '+priceOLD+'');}});$('.priceRub').click(function(){var price=$('#prc').attr('alt');var hidePrice=$(this).attr('class');priceRangeUpdate(hidePrice);price=parseFloat(price);price=price*rubPrice;price=Math.round(price);$('#prc').html(price+' руб.');var priceOLD=$('.estPRICEOLD').attr('alt');if(priceOLD!=undefined){priceOLD=priceOLD*rubPrice;priceOLD=Math.round(priceOLD);$('.estPRICEOLD').html(priceOLD+' руб.');}});function priceRangeUpdate(hidePrice){$('.priceRub').show();$('.priceDollar').show();$('.priceEuro').show();$('.priceBGN').show();$('.'+hidePrice).hide();} $('#SENDESTATEFORM').click(function(){$.post("/manage",{SENDESTATEFORM:"yep",name:$('input[name="namex"]').val(),phone:$('input[name="phonex"]').val(),msg:$('textarea[name="msgx"]').val(),eml:$('input[name="lastnamex"]').val(),title:$('.estNAME').text(),url:document.URL},function(data){if(data=='1'){alert('Сообщение отправлено!');$('input[name="namex"]').val('');$('input[name="phonex"]').val('');$('textarea[name="msgx"]').val('');$('input[name="lastnamex"]').val('');} else{$('input[name="namex"]').css('border','1px solid red');$('input[name="phonex"]').css('border','1px solid red');alert('Поля отмеченные красным цветом, обязательны для заполнения!');}});});});