function elemSupportsAttr(element, attribute) {
	var test = document.createElement(element);
	if (attribute in test) { 
		return true;
	}
	else {
		return false;
	}
};

jQuery(function() {
	jQuery.support.borderRadius = false;
	jQuery.each(['BorderRadius','MozBorderRadius','WebkitBorderRadius','OBorderRadius','KhtmlBorderRadius'], function() {
		if(document.body.style[this] !== undefined) jQuery.support.borderRadius = true;
		return (!jQuery.support.borderRadius);
	});
});

$(function() {
	var slideOut = true;
	$('#footer-associations img').css('opacity', 0.6).removeClass('fader');
	$('.link, #footer ul.menu li:not(.active-trail) a').css('opacity', 0.7).addClass('linkFade').removeClass('link');
	$('#footer-associations img').hover(function() {
		$(this).fadeTo(1000, '1');
	},
	function() {
		$(this).fadeTo(1000, '0.6');
	});
	$('.linkFade').hover(function() {
		$(this).fadeTo(1000, '1');
	},
	function() {
		$(this).fadeTo(1000, '0.7');
	});
	$('#footer ul.menu li.active-trail a').fadeTo(1000, '1');
	if (window.location.hash != '#adv') {
		slideOut = false;
		$('#property-search-advanced-options, #property-search-advanced-options *').hide();
	}
	else {
		$('#views-exposed-form-location-test-search-default').attr('action', $('#views-exposed-form-location-test-search-default').attr('action')+'#adv');
	}
	$('#advanced-link a').click(function() {
		if (slideOut) {
			$('#property-search-advanced-options *').fadeOut('fast', function() {
				$('#property-search-advanced-options').slideUp('slow');
			});
			$('#views-exposed-form-location-test-search-default').attr('action', $('#views-exposed-form-location-test-search-default').attr('action').substr(0, $('#views-exposed-form-location-test-search-default').attr('action').length - 4));
			slideOut = false;
		}
		else {
			$('#property-search-advanced-options').slideDown('slow', function() {
				$('#property-search-advanced-options *').fadeIn('fast');
			});
			$('#views-exposed-form-location-test-search-default').attr('action', $('#views-exposed-form-location-test-search-default').attr('action')+'#adv');
			slideOut = true;
		}
		return false;
	});
	if ($('#edit-pc').length != 0 && !elemSupportsAttr('input', 'placeholder')) {
		$('#edit-pc').attr('value', "Type a location or postcode to search e.g. 'Canterbury', 'Ashford', 'CT1'");
		$('#edit-pc').css('color', '#aaa');
		$('#edit-pc').focus(function() {
			if ($('#edit-pc').attr('value') == "Type a location or postcode to search e.g. 'Canterbury', 'Ashford', 'CT1'") {
				$('#edit-pc').attr('value', '');
				$('#edit-pc').css('color', $('body').css('color'));
			}
		});
		$('#edit-pc').blur(function() {
			if ($('#edit-pc').attr('value') == "") {
				$('#edit-pc').attr('value', "Type a location or postcode to search e.g. 'Canterbury', 'Ashford', 'CT1'");
				$('#edit-pc').css('color', '#aaa');
			}
		});
	}
	if ($('.messages:not(.error)').length > 0) {
		setTimeout(function(){$('.messages:not(.error)').slideUp('slow');}, 15000);
	}
});



