var Ad_View = function(){ } Ad_View.prototype.print = function(id){ } Ad_View.prototype.showCommentDialog = function(){ $(".js-comment-author").val($(".js-comment-author").attr("data-author")); $(".js-comment-email").val($(".js-comment-email").attr("data-email")); $(".js-comment-phone").val(""); $(".js-comment-content").val(""); $(".js-comment-alert").addClass("hidden"); $(".js-comment-alert .js-message").html(''); $('.js-comment-dialog').modal('show'); } Ad_View.prototype.showMap = function() { $('.js-map-dialog .js-no-results').hide(); $('.js-map-dialog').modal('show'); $("#map_canvas").html('').hide(); $('.js-map-dialog .js-loading').show(); setTimeout(function(){ geocoder = new google.maps.Geocoder(); geocoder.geocode({ 'address': $('.js-ad-address').val() },function(results, status){ $('.js-map-dialog .js-loading').hide(); if (results.length == 0) { $("#map_canvas").hide(); $('.js-map-dialog .js-no-results').show(); } else { $("#map_canvas").show(); var mapCanvas = document.getElementById('map_canvas'); var mapOptions = { center : results[0].geometry.location, zoom: 90, mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new google.maps.Map(mapCanvas, mapOptions); var marker = new google.maps.Marker({ position: results[0].geometry.location, map: map, title: $('.js-ad-address').val() }); } }); }, 3000); } var View = null; $(document).ready(function(){ if(typeof addthis !== 'undefined' && addthis) { addthis.init(); } View = new Ad_View(); $('.js-comment-dialog').modal({ 'show': false }); $('.js-map-dialog').modal({ 'show': false }); $('.js-map-ok').click(function(){ $('.js-map-dialog').modal('hide'); }); $('.js-comment-cancel').click(function(){ $('.js-comment-dialog').modal('hide'); }); $('.js-comment-ok').click(function(){ $(".js-comment-form").submit(); }); $(".js-comment-form").ajaxForm({ beforeSubmit : function(){ }, success : function(response){ var res = eval(response); if (res.error == 0) { $('.js-comment-dialog').modal('hide'); App.alert(res.msg, 350, 150); } else { $(".js-comment-alert .js-message").html(''); for (var i=0;i"); } $(".js-comment-alert").removeClass("hidden"); } } }); $('.js-sec-img img').mouseenter(function(){ $('.js-big-pic img').attr('src', $(this).attr('data-big-pic')); }); });