jQuery(document).ready( function($){ setSearchTitles(); setNavigation(); boldSubNav(); initGmap(); }); $( window ).load(function() {ForceListingGrid();}); //hack to fix issue with grid view not resizing correctly function ForceListingGrid(){ if ($('.boat-slip-list').length){ myrsol_grid_view(); } else if ($('#listings').length){ if($.totalStorage('listings_view')==='grid_view'){ myrsol_grid_view(); } } } function SetNavItemActive(elemid) { $('#'+elemid).addClass("active"); } function GetPathName() { var pathname = window.location.pathname; // returns path only alert(pathname); return pathname; //var url = window.location.href; // returns full url } function setNavigation() { var path = window.location.pathname; var mlssearch = ['/search-by-area.html', '/search-by-map.html', '/search-by-subdivision.html', '/search-by-mls-address.html', '/search-by-school.html', '/search-by-zipcode.html']; var ishome = false; path = path.replace(/\/$/, ""); path = decodeURIComponent(path); if (path.length===0){ ishome=true; path="/"; } $('.navbar-nav a').each(function () { var href = $(this).attr('href'); if (path.substring(0, href.length) === href) { if (href!=="/" || (ishome && href==="/")){ //alert('adding active for' + path.substring(0, href.length) + ' === ' + href); $(this).closest('li').addClass('active'); } } else if (path==='/featured-listings.html' && href==='/homes-for-sale') //hack for featured listings link { $(this).parent().addClass('active'); } else if (path==='/agents.html' && href==='/company') //hack for meet the team (agents page) { $(this).parent().addClass('active'); } else if (path==='/contact.html' && href==='/company') //hack for contact page { $(this).parent().addClass('active'); } else if (path==='/blog' && href==='/company') //hack blog { $(this).parent().addClass('active'); } else if (mlssearch.indexOf(path) !==-1 && href==='/property-search.html' && $(this).attr('class')==='dropdown-toggle') { $(this).parent().addClass('active'); } }); } function boldSubNav(){ var path = window.location.pathname; $('#related-links a').each(function () { var href = $(this).attr('href'); if (path.substring(0, href.length) === href) { if (href!=="/" || (ishome && href==="/")){ $(this).addClass('sunset-bold'); } } }); } function setSearchTitles() { //$('#qs_propcity option:first').text('Select a City'); var path = window.location.pathname; var selValue; if($('#qs_form').length && path !=='/'){ //$('#qs_propclass').prepend(new Option('Select Property Type', '0', false, false)); selValue = $('#qs_propcity').val(); if(selValue===''){$('#qs_propcity').val([]);} $('#qs_propcity').prepend(new Option('Select a City', '', false, false)); if(selValue===''){ $('#qs_propcity option:first').attr('selected', 'selected');} selValue = $('#qs_lowprice').val(); if(selValue==='0'){$('#qs_lowprice').val([]);} $('#qs_lowprice').prepend(new Option('Min $', '', false, false)); if(selValue==='0'){ $('#qs_lowprice option:first').attr('selected', 'selected');} selValue = $('#qs_highprice').val(); if(selValue==='999999999999'){$('#qs_highprice').val([]);} $('#qs_highprice').prepend(new Option('Max $', '999999999999', false, false)); if(selValue==='999999999999'){ $('#qs_highprice option:first').attr('selected', 'selected');} selValue = $('#qs_beds').val(); if(selValue==='0'){$('#qs_beds').val([]);} $('#qs_beds').prepend(new Option('Beds', '0', false, false)); if(selValue==='0'){ $('#qs_beds option:first').attr('selected', 'selected');} selValue = $('#qs_baths').val(); if(selValue==='0'){$('#qs_baths').val([]);} $('#qs_baths').prepend(new Option('Baths', '0', false, false)); if(selValue==='0'){ $('#qs_baths option:first').attr('selected', 'selected');} } } function initGmap(){ if ($('#map-canvas').length){ var myLatlng = new google.maps.LatLng(36.64352778, -93.21992448); var mapCanvas = document.getElementById('map-canvas'); var mapOptions = { center: myLatlng, zoom: 17, mapTypeId: google.maps.MapTypeId.HYBRID, scrollwheel: false, mapTypeControl:true, streetViewControl:false } var map = new google.maps.Map(mapCanvas, mapOptions); var image = new google.maps.MarkerImage("http://assets.sunsetrealtyservices.com/images/marker-sunset.png", null, null, null, new google.maps.Size(75,39)); // Create a variable for our marker image. var marker = new google.maps.Marker({ // Set the marker position: myLatlng, // Position marker to coordinates //icon:image, //use our image as the marker map: map, // assign the marker to our map variable title: 'Click to get directions to our office' // Marker ALT Text }); // google.maps.event.addListener(marker, 'click', function() { // Add a Click Listener to our marker // window.location='http://www.snowdonrailway.co.uk/shop_and_cafe.php'; // URL to Link Marker to (i.e Google Places Listing) // }); var infowindow = new google.maps.InfoWindow({ // Create a new InfoWindow content:"