    jQuery(function(){
        jQuery('ul.sf-menu').superfish();
		});
    $(function() {
        $("img.callout").mouseover(function() {
            $(this).next().fadeIn('fast');
           })
        $("img.callout-hover").mouseout(function() {
            $(this).fadeOut('slow');
           })
    $(function() {
        $('div.location-map-thumb a').lightBox();
    });
    $(document).ready(function() {
       $("div.callback").hide();
	   if (window.location.hash == 'property-view') {
		$("div.callback").show();
	   }
	   else if (window.location.hash != '') {
		$(window.location.hash + ' div.callback').show();
	   }
       $("a.callback-link").show();
       $("a.callback-link").click(function() {
         $(this).parent().next().next().next().slideToggle();
         return false;
       });
		
	   $(".detail-block-content").hide();
	   
	   /* $("h3.detail-block-title serif").click(function(){
		$(this).next(".detail-block-content").slideToggle("slow");
		}); */
	   
       /* $("a.expandable-toggle").each(function() {
           $(this).parent().next().hide();
         }); */
		
       $("a.expandable-toggle").click(function() {
         //hideAll();
         $(this).parent().next().slideToggle();
         return false;
       });
	   
	   $("a#error-friend").click(function() {
         $("h3#expand-friend").next().slideDown();
       });
	   
	    $("a#error-callback").click(function() {
         $("h3#expand-callback").next().slideDown();
       });
	   
       $("a.portal").click(function(){
         var id = this.id.replace('-btn', '');
         hideAll();
         $('#' + id).next().slideDown();
       });
       $("a#expand-specs-details-btn").click(function(){
         hideAll();
         $("h3#expand-specs").next().slideDown();
       });
       $("a#expand-specs-details-btn").click(function(){
         $("h3#expand-specs").next().slideDown();
       });
       $("a#expand-callback-foot-btn").click(function(){
         hideAll();
         $("h3#expand-callback").next().slideDown();
       });

       function hideAll(){
         $("a.expandable-toggle").each(function() {

           if($(this).hasClass("open")){
             click(function() {
               $this().parent().next().slideDown();
             });
           };
           $(this).parent().next().slideUp();
         });
       };
    });

    });
$(document).ready(function() {
       $("a.search-result-thumb").mouseover(function(){
         $(this).next().toggle();
       });
       $("a.search-result-hover").mouseout(function(){
         $(this).hide();
       });

	$('#banner-images img').css({opacity: 0.0});
	$('#banner-images img:first').css({opacity: 1.0});
	setInterval('gallery()',5000);
        gallery();
});
function gallery() {
	var current = ($('#banner-images img.show')?  $('#banner-images img.show') : $('#banner-images img:first'));

       if (current.next().length){
          if (current.next().hasClass('homeGallery')){
             var next = current.next();
          } else {
            var next = $('#banner-images img:first')
          }
       } else {
         var next = $('#banner-images img:first')
       }
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 2000);

	current.animate({opacity: 0.0}, 2000)
	.removeClass('show');
}
function proptypeBoxes(index)
  {
	var type_checkboxes = document.getElementsByName("prop_type[]");
	for (var i = 0; i < type_checkboxes.length; i++)
	{
	  if(index.value!='')
	  {
		document.getElementById('all_proptypes').checked = false;
	  }
	  else if(index.value=='')
	  {
		type_checkboxes[i].checked = false;
	  }
	}
  }
  
function locationBoxes(index)
{
	var type_checkboxes = document.getElementsByName("location[]");
	for (var i = 0; i < type_checkboxes.length; i++)
	{
	  if(index.value!='')
	  {
		document.getElementById('all_locations').checked = false;
	  }
	  else if(index.value=='')
	  {
		type_checkboxes[i].checked = false;
	  }
	}
}

function clearText(field)
{
	if (field.defaultValue == field.value) field.value = '';
	else if (field.value == '') field.value = field.defaultValue;
}
