document.write('<script type="text/javascript" src="' + (isBackend?'../':'') + 'lib/js/base/base.js"></script>');

/**
 * BEGIN property preview functions
 */

function setContactFormEnabled(value)
{
	$('ctl0_Content_ContactFirstname').disabled = !value;
	$('ctl0_Content_ContactLastname').disabled = !value;
	$('ctl0_Content_ContactEmail').disabled = !value;
	$('ctl0_Content_ContactArriveDate_year').disabled = !value;
	$('ctl0_Content_ContactArriveDate_month').disabled = !value;
	$('ctl0_Content_ContactArriveDate_day').disabled = !value;
	$('ctl0_Content_ContactDepartDate_year').disabled = !value;
	$('ctl0_Content_ContactDepartDate_month').disabled = !value;
	$('ctl0_Content_ContactDepartDate_day').disabled = !value;
	$('ctl0_Content_ContactTotal').disabled = !value;
	$('ctl0_Content_ContactChildren').disabled = !value;
	$('ctl0_Content_ContactBody').disabled = !value;
	$('ctl0_Content_ContactCountry').disabled = !value;
	$('ctl0_Content_ContactPhoneInput').disabled = !value;		
}

function setReviewFormEnabled(value)
{
	$('ctl0_Content_ReviewNickname').disabled = !value;
	$('ctl0_Content_LivingPlace').disabled = !value;
	$('ctl0_Content_ReviewArrival_year').disabled = !value;
	$('ctl0_Content_ReviewArrival_month').disabled = !value;
	$('ctl0_Content_ReviewArrival_day').disabled = !value;
	$('ctl0_Content_ContractName').disabled = !value;
	$('ctl0_Content_ReviewTitle').disabled = !value;
	$('ctl0_Content_ReviewBody').disabled = !value;
	$('ctl0_Content_Rating5').disabled = !value;
	$('ctl0_Content_Rating4').disabled = !value;
	$('ctl0_Content_Rating3').disabled = !value;
	$('ctl0_Content_Rating2').disabled = !value;
	$('ctl0_Content_Rating1').disabled = !value;
	$('ctl0_Content_Complies').disabled = !value;		
}

/**
 * END property preview funcions.
 */


/**
 * Search Form Functions
 */
function buttonActivitiesClicked()
{
	if($('activities-button').className=='expand')
	{
		$('activities').style.display = '';
		$('activities-button').className = 'collapse';
	} else
	{
		$('activities').style.display = 'none';
		$('activities-button').className = 'expand';
	}
}

function buttonLocationTypeClicked()
{
	if($('location-button').className=='expand')
	{
		$('location').style.display = '';
		$('location-button').className = 'collapse';
	} else
	{
		$('location').style.display = 'none';
		$('location-button').className = 'expand';
	}
}

/**
 * BEGIN FUNCTIONALITY TO SUPPORT AVAILABILITY CALENDARS
 */

var availabilityData = {};
var specialOffersData = {};
function propertyAvailabilitySelect(id, day, month, year)
{
	day = parseInt(day);
	month = parseInt(month);
	year = parseInt(year);
	
	if(!$(id) || !day || !month || !year)
	{
		return;
	}
	
	var classToAdd = '';
	if($('available').checked)
	{
		if(specialOffersData[year] && specialOffersData[year][month])
		{
			classToAdd = specialOffersData[year][month][day];
		}
		else
		{
			classToAdd = '';
		}
	}
	else if($('unavailable').checked)
	{
		classToAdd = 'unav';
	}
	else if($('unknown').checked)
	{
		classToAdd = 'unkn';
	}
	
	if(!availabilityData[year]) availabilityData[year] = {};
	if(!availabilityData[year][year]) availabilityData[year][year] = {};
	if(!availabilityData[year][year][month]) availabilityData[year][year][month] = {};
	
	availabilityData[year][year][month][day] = classToAdd;
	$(id).className = classToAdd;
}

function propertyAvailabilityConfirm(hiddenField)
{
	var stringData = Object.toJSON(availabilityData);
	$(hiddenField).value = stringData;
}
/**
 * END FUNCTIONALITY TO SUPPORT AVAILABILITY CALENDARS
 */