// this is the for css dropdown menu
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

$(document).ready(function(){

	$('div#gallery a').lightBox();

	// highlight fields on focus
	$(function(){$("fieldset input").focus(function(){$(this).parent('div.input').addClass("focus");});});
	$(function(){$("fieldset input").blur(function(){$(this).parent('div.input').removeClass("focus");});});
	$(function(){$("fieldset select").focus(function(){$(this).parent('div.input').addClass("focus");});});
	$(function(){$("fieldset select").blur(function(){$(this).parent('div.input').removeClass("focus");});});
	$(function(){$("fieldset textarea").focus(function(){$(this).parent('div.input').addClass("focus");});});
	$(function(){$("fieldset textarea").blur(function(){$(this).parent('div.input').removeClass("focus");});});

	// datepicker fields
	//$("input.datepicker_single").datepicker({dateFormat: 'dd/mm/yy'}); 

	// dates / prices calendar clickable tabs
	$('div#sidebar-dates-prices-table div.tabs a.tab').bind('click', function(){
		$('div#sidebar-dates-prices-table div.tabs a.tab').removeClass('tab-active');
		$(this).addClass('tab-active');
		$('div#sidebar-dates-prices-table table').hide();
		$('div#sidebar-dates-prices-table table#dates-prices-tab-' + $(this).attr('rel')).show();
		return false;
	});
	
	$('div#nav ul li a.noclick').bind('click', function(){
		return false;
	});

	$('input#PageContactTypeRequestABrochureByPost').bind('change', function(){
		if ($(this).attr('checked')) {
			$('div#fields-address').slideDown();			
		} else {
			$('div#fields-address').slideUp();			
		}
	});

	// stripe the ticks green and black
	//$('div.ticks ul li:even').addClass('black');
	//$('ul.ticks li:even').addClass('black');

	$('div#weather-feed-devon').load('/weather.com/weather.php?location_code=UKXX0960');
	$('div#weather-feed-herefordshire').load('/weather.com/weather.php?location_code=UKXX0245');

});


// ie bug fix for blurring checkbox after change
$(function () {
    if ($.browser.msie) {
        $('input:checkbox').click(function () {
            this.blur();
            this.focus();
        });
    }
});

