$(document).ready(function () {

	$('#menu-home').mouseenter(function(){
		$('#menu-home-mo').fadeIn(500, 'linear', function() {});
	});
	$('#menu-home-mo').mouseleave(function(){
		$('#menu-home-mo').fadeOut(500, 'linear', function() {});
	});

	$('#menu-buy').mouseenter(function(){
		$('#menu-buy-mo').fadeIn(500, 'linear', function() {});
		$('#menu-buy-sub').show();
	});
	$('#menu-buy-mo').mouseleave(function(){
		$('#menu-buy-mo').fadeOut(500, 'linear', function() {});
		$('#menu-buy-sub').hide();
	});
	$('#menu-buy-sub').mouseenter(function(){
		$('#menu-buy-sub').show();
	});
	$('#menu-buy-sub').mouseleave(function(){
		$('#menu-buy-sub').hide();
	});

	$('#menu-rent').mouseenter(function(){
		$('#menu-rent-mo').fadeIn(500, 'linear', function() {});
		$('#menu-rent-sub').show();
	});
	$('#menu-rent-mo').mouseleave(function(){
		$('#menu-rent-mo').fadeOut(500, 'linear', function() {});
		$('#menu-rent-sub').hide();
	});
	$('#menu-rent-sub').mouseenter(function(){
		$('#menu-rent-sub').show();
	});
	$('#menu-rent-sub').mouseleave(function(){
		$('#menu-rent-sub').hide();
	});

	$('#menu-sell').mouseenter(function(){
		$('#menu-sell-mo').fadeIn(500, 'linear', function() {});
		$('#menu-sell-sub').show();
	});
	$('#menu-sell-mo').mouseleave(function(){
		$('#menu-sell-mo').fadeOut(500, 'linear', function() {});
		$('#menu-sell-sub').hide();
	});
	$('#menu-sell-sub').mouseenter(function(){
		$('#menu-sell-sub').show();
	});
	$('#menu-sell-sub').mouseleave(function(){
		$('#menu-sell-sub').hide();
	});
	
	$('#menu-landlords').mouseenter(function(){
		$('#menu-landlords-mo').fadeIn(500, 'linear', function() {});
		$('#menu-landlords-sub').show();
	});
	$('#menu-landlords-mo').mouseleave(function(){
		$('#menu-landlords-mo').fadeOut(500, 'linear', function() {});
		$('#menu-landlords-sub').hide();
	});
	$('#menu-landlords-sub').mouseenter(function(){
		$('#menu-landlords-sub').show();
	});
	$('#menu-landlords-sub').mouseleave(function(){
		$('#menu-landlords-sub').hide();
	});

	$('#menu-aboutus').mouseenter(function(){
		$('#menu-aboutus-mo').fadeIn(500, 'linear', function() {});
		$('#menu-aboutus-sub').show();
	});
	$('#menu-aboutus-mo').mouseleave(function(){
		$('#menu-aboutus-mo').fadeOut(500, 'linear', function() {});
		$('#menu-aboutus-sub').hide();
	});
	$('#menu-aboutus-sub').mouseenter(function(){
		$('#menu-aboutus-sub').show();
	});
	$('#menu-aboutus-sub').mouseleave(function(){
		$('#menu-aboutus-sub').hide();
	});

	$('#menu-contact').mouseenter(function(){
		$('#menu-contact-mo').fadeIn(500, 'linear', function() {});
	});
	$('#menu-contact-mo').mouseleave(function(){
		$('#menu-contact-mo').fadeOut(500, 'linear', function() {});
	});

// PROPERTY SEARCH DROP DOWNS
	$('#search-types').click(function(){
		$('#search-types-drop').show();
	});
	$('#search-types').mouseleave(function(){
		$('#search-types-drop').hide();
	});
	$('#search-types-drop').mouseenter(function(){
		$('#search-types-drop').show();
	});
	$('#search-types-drop').mouseleave(function(){
		$('#search-types-drop').hide();
	});

	$('#search-location').click(function(){
		$('#search-location-drop').show();
	});
	$('#search-location').mouseleave(function(){
		$('#search-location-drop').hide();
	});
	$('#search-location-drop').mouseenter(function(){
		$('#search-location-drop').show();
	});
	$('#search-location-drop').mouseleave(function(){
		$('#search-location-drop').hide();
	});

	//Hide (Collapse) the toggle containers on load
	$(".toggle_container").hide(); 

	//Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
	$("div.trigger").click(function(){
		$(this).toggleClass("active").next().slideToggle("slow");
		return false; //Prevent the browser jump to the link anchor
	});
});

/* By: Darren Chowles */
    
var bssCount = 1;    // Keep track of which image is active
var bssMax = 4;      // Number of items
var bssInterval = 0; // Reference to the interval
var bssSlides = ['<a href="property-details.html"><img src="files/content/sitemap-large.jpg" alt="About Ocean View" title="About Ocean View" height="220" width="353" /></a>',
                  '<a href="property-details.html"><img src="files/content/sitemap-large2.jpg" alt="Buy" title="Buy" height="220" width="353" /></a>',
                  '<a href="property-details.html"><img src="files/content/sitemap-large.jpg" alt="Rent" title="Rent" height="220" width="353" /></a>',
                  '<a href="property-details.html"><img src="files/content/sitemap-large2.jpg" alt="Sell" title="Sell" height="220" width="353" /></a>'];
    
function bssSwapper(){
	bssInterval = setInterval(function(){
		bssCount++;
		if(bssCount > bssMax){
			bssCount = 1;
		}
		// First reset the classes
		for(i=1; i<=bssMax; i++){
			$("#tssc" + i).attr("class", "tmpSlideshowControl");
		}
		$("#tssc" + bssCount).attr("class", "tmpSlideshowControlActive");
		$("#tmpSlide1").html(bssSlides[bssCount-1]);
	}, 5000);
}
	
function bssOver(sli){
	// Set the counter
	bssCount = sli;
	// End the auto
	clearInterval(bssInterval);
		
	for(i=1; i<=bssMax; i++){
		$("#tssc" + i).attr("class", "tmpSlideshowControl");
	}
	$("#tssc" + bssCount).attr("class", "tmpSlideshowControlActive");
	$("#tmpSlide1").html(bssSlides[bssCount-1]);
}
	
function bssOut(){
	// Restart the auto-scroll starting from the last viewed via hover
	bssSwapper();
}

$(document).ready(
  function() {
	bssSwapper();	
  }
);

function showPreview(imagePath,imageIndex){
//alert();
		var subImages = document.getElementById('previewPane').getElementsByTagName('IMG');
		if(subImages.length==0){
			var img = document.createElement('IMG');
			document.getElementById('previewPane').appendChild(img);
		}else img = subImages[0];

		//if(displayWaitMessage){
			//document.getElementById('waitMessage').style.display='inline';
		//}
		//document.getElementById('largeImageCaption').style.display='none';
		//img.onload = function() { hideWaitMessageAndShowCaption(imageIndex-1); };
		img.src = imagePath;
}

function showPrev(imagePath,imageIndex){
//alert();
		var subImages = document.getElementById('previewPane'+imageIndex).getElementsByTagName('IMG');
		if(subImages.length==0){
			var img = document.createElement('IMG');
			document.getElementById('previewPane'+imageIndex).appendChild(img);
		}else img = subImages[0];

		//if(displayWaitMessage){
			//document.getElementById('waitMessage').style.display='inline';
		//}
		//document.getElementById('largeImageCaption').style.display='none';
		//img.onload = function() { hideWaitMessageAndShowCaption(imageIndex-1); };
		img.src = imagePath;
}

function DropDownMenu(entered)
{
with (entered)
{
ref=options[selectedIndex].value;
document.location=ref;
}
}

