$(document).ready(function() {
	$(".featured-offer").load("/offers/featured-offers.php .featured_special .specials_content h3, .featured_special .btn_reserve", function() {
		$('.featured-offer .btn_reserve').before('<span class="arw-btn_reserve">></span>');
	});
	
	var directory = $('body').attr('id');
	$('#'+directory+' ul.nav .sub-'+directory).parent().attr('id', 'active');
	
	if($.browser.msie && $.browser.version == "7.0") {
		$('ul.nav li div').filter('#active').css('display', 'block');
	}

	$('ul.nav li.top').hover(
		function() {
			$(this).addClass('active');
			
			if ($(this).find('div').attr('id') == 'active') {
				$('ul.nav li div').filter('#active').css('display', 'block');
			}
			else {
				$('ul.nav li div').filter('#active').css('display', 'none');
			}
		},
		
		function() {
			$(this).removeClass('active');
			
			$('ul.nav li div').filter('#active').css('display', 'block');
		}
	);
	
	// user must approve terms and conditions before viewing residences
	$('#nav-resi').not('#resi #nav-resi').click(function() {
		$('.wrapper').append('<div class="resi-disclaimer"><p class="resi-close"><a href="#">close</a></p><p>By clicking on the "yes" button below, you will be leaving The Jalousie Plantation hotel website and entering the Sugar Beach website to access information on Residences and Real  Estate. Although present through this link, the site pages to which you will be transferred are the property of Jalousie (1996) Ltd, the proprietor of the hotel and lands, who accept full responsibility for the accuracy and completeness of these site pages.  Viceroy Hotel Group does not guarantee or assume responsibility for the accuracy or completeness of any information or data displayed through these pages and expressly disclaims any duty or obligation to review or correct any of the contents of such website or information on the site pages.</p><a href="http://www.residencessugarbeach.com" class="terms" target="_blank">Yes</a></div>');
		
		$('.resi-disclaimer').fadeIn();
		
		$('.resi-close a').bind('click', function() {
			$('.resi-disclaimer').fadeOut(function() {
					$('.resi-disclaimer').fadeOut();
			});
			
			return false;
		});
		
		return false;	
	});
	
	$('#resi #nav-resi').click(function() {
		return false;
	});
	
	$.fn.clearInputs = function() {
		return this.each(function() {
			var default_value = $(this).val();

			$(this).focus(function() {
				if ($(this).val() == default_value && $(this).attr('type') != 'submit') {
					$(this).val("");
				}
			});

			$(this).blur(function() {
				if ($(this).val() == "") {
					$(this).val(default_value);
				}
			});
		});
	};
	$('input').clearInputs();
});
