$(document).ready(function() {
    
    (function($) {
      var cache = [];
      $.preLoadImages = function() {
        var args_len = arguments.length;
        for (var i = args_len; i--;) {
          var cacheImage = document.createElement('img');
          cacheImage.src = arguments[i];
          cache.push(cacheImage);
        }
      }
    })(jQuery)    
    
    jQuery.preLoadImages('/images/investmentSearchSelected.png','/images/rentalSearch.png', '/images/investmentFormBack.png');

    $('#searchButtonLeft').click(function() {
        $('#propertySearch').css('background-image','url(/images/rentalFormBack.png)');
        $('#propertyDBSearch').attr('action','/propertySearch.php');

        $('#minPrice').load('/includes/rentalPricesMin.html');
        $('#maxPrice').load('/includes/rentalPricesMax.html');
    });
    
    $('#searchButtonRight').click(function() {
        $('#propertySearch').css('background-image','url(/images/investmentFormBack.png)'); 
        $('#propertyDBSearch').attr('action','/investmentPropertySearch.php');

        $('#minPrice').load('/includes/investmentPricesMin.html');
        $('#maxPrice').load('/includes/investmentPricesMax.html'); 
    });
    
    
    
    $('#goBack').click(function() {
        history.go(-1);
    });
    
    jQuery('.imageLink').hover(function(e){
        var dispImage = jQuery(this).siblings('.hiddenImage').html();
        jQuery('#galleryPlaceHolder').html('');
        jQuery('#galleryPlaceHolder').css('display','none'); 
        jQuery('#galleryPlaceHolder').html(dispImage);       
        jQuery('#galleryPlaceHolder').fadeIn();        
    });
    
    /*
    $(".individualPropertyListing").click(function(){
         window.location=$(this).find("a").attr("href");
         return false;
    });
    */


})

