$(document).ready(function() {
    $('.slideshow').cycle({
		fx: 'fade',
		timeout: 10000
	});
});

// Show passed DIV
function showDiv(layer_ref){
	hza2 = document.getElementById(layer_ref);
	state = 'block';

	if (document.all) { //IS IE 4 or 5 (or 6 beta)
		eval( "document.all." + layer_ref + ".style.display = state");
	}
	if (document.layers) { //IS NETSCAPE 4 or below
		document.layers[layer_ref].display = state;
	}
	if (document.getElementById &&!document.all) {
		hza = document.getElementById(layer_ref);
		hza.style.display = state;
	}
	
}

// Hide passed DIV
function hideDiv(layer_ref) {
	hza2 = document.getElementById(layer_ref);
	state = 'none';

	if (document.all) { //IS IE 4 or 5 (or 6 beta)
		eval( "document.all." + layer_ref + ".style.display = state");
	}
	if (document.layers) { //IS NETSCAPE 4 or below
		document.layers[layer_ref].display = state;
	}
	if (document.getElementById &&!document.all) {
		hza = document.getElementById(layer_ref);
		hza.style.display = state;
	}
}


function toggleReveal(layer_ref) {
	$(layer_ref).slideToggle('slow', function() {
    // Animation complete.
  });
}

function showFeatures(){
	hideDiv('showFeatures');
	toggleReveal('#additionalFeatures');
}

function hideMoreFeatures(){
	toggleReveal('#additionalFeatures');
	toggleReveal('#showFeatures');
}

function hideFeatures(idref){
	toggleReveal('#moreinfo' + idref);
	toggleReveal('#morelink' + idref);
}

function showTab(tabref, idref) {
	hideDiv('content' + idref);
	hideDiv('contact' + idref);
	hideDiv('map' + idref);
	
	showDiv(tabref + idref);

}

function enable_input(status, stritem) {
	// Enable or disable a input field	
	if (status) {
    	$("#" + stritem).attr("disabled", "disabled");
    	//$("#" + stritem).val('');
    }else{
    	$("#" + stritem).removeAttr("disabled");
    }
}

function searchfocus() {
	 if ($('#searchtown').val() == 'Town, City or Area') {
	 	$('#searchtown').val('');
	 }
}

function searchunfocus() {
	 if ($('#searchtown').val() == '') {
	 	$('#searchtown').val('Town, City or Area');
	 }
}
