$(document).ready(function() {
   $('#langblk a.language-link img').css('opacity',0.3);
   $('#langblk a.active img').css('opacity',1);
   
	$('#mnav ul li ul li:contains("BTPC Associate Villas") a').replaceWith('<div class="fcnavs">' + $('#mnav ul li ul li:contains("BTPC Associate Villas") a').text() + "</div>");
	$('#mnav ul li ul li:contains("BTPC Own Villas") a').replaceWith('<div class="fcnavs">' + $('#mnav ul li ul li:contains("BTPC Own Villas") a').text() + "</div>");
	//$('#mnav ul li ul li:contains("FAQ") a').replaceWith('<div class="fcnavs">' + $('#mnav ul li ul li:contains("FAQ") a').text() + "</div>");

	$('#mnav ul li ul li:contains("Banyan Tree Bintan") a').attr("title","Two-Bedroom Sanctuary Pool Villa");
	$('#mnav ul li ul li:contains("Banyan Tree Phuket") a').attr("title","Two-Bedroom Doublepool Villa");
	$('#mnav ul li ul li:contains("Banyan Tree Seychelles") a').attr("title","Two-Bedroom Doublepool Villa");
	$('#mnav ul li ul li:contains("Banyan Tree Ringha") a').attr("title","Two-Bedroom Tibetan Lodge");
	$('#mnav ul li ul li:contains("Casa Lucardo, Tuscany, Italy") a').attr("title","Four-Bedroom Private Villa With Swimming Pool");
	$('#mnav ul li ul li:contains("Villa Grasse, Provence, France") a').attr("title","Three-Bedroom & Study Room Private Villa With Swimming Pool");
	$("#mnav ul li ul li:contains('709 St. John's, London, United Kingdom') a").attr("title","Two-Bedroom Private Luxury Apartment");
	$('#mnav ul li ul li:contains("901 Confore Gokomachi Oike Fierte, Japan") a').attr("title","Two-Bedroom Private Luxury Apartment");
	$('#mnav ul li ul li:contains("Banyan Tree Lijiang") a').attr("title","Two-Bedroom Jet Pool Villa");
	$('#mnav ul li ul li:contains("Banyan Tree Bangkok") a').attr("title","Two-Bedroom Banyan Suite");
	$('#mnav ul li ul li:contains("Banyan Tree Madivaru") a').attr("title","Tented Pool Vila");
	$('#mnav ul li ul li:contains("Banyan Tree Mayakoba") a').attr("title","Two-Bedroom Pool Vila");

	$("#cForm").validate();
	$("#esForm").validate();

});


function slideSwitch2() {
    var $active = $('#rotator DIV.active');

    if ( $active.length == 0 ) $active = $('#rotator DIV:last');

    // use this to pull the divs in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#rotator DIV:first');

    // uncomment below to pull the divs randomly
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch2()", 5000 );
});	



	// Apply the Highslide settings
	hs.registerOverlay({
		useOnHtml: true,
		html: '<div class="closebutton" onclick="return hs.close(this)" title="Close"></div>',
		position: 'top right',
		fade: 2 // fading the semi-transparent overlay looks bad in IE
	});
	hs.showCredits = false;
	hs.align = 'center';
	hs.dimmingOpacity = 0.75;
	hs.dimmingGeckoFix = true;
	
	hs.graphicsDir = '/highslide/graphics/';
	//hs.outlineType = 'rounded-white';
	hs.wrapperClassName = 'borderless no-footer';
	hs.allowSizeReduction = false;
	// always use this with flash, else the movie will be stopped on close:
	hs.preserveContent = false;
	
// Image Swap
$.swapImage(".swapImage");
