// JavaScript Document
$(function(){
	var scrolling_div = $('.postcode-search-small');
	var max_height = scrolling_div.css('top');
	var doc = $(".content-left");
	var doc_height = (doc.outerHeight(true) - 369);
	if(doc_height > 516){
		$(window).scroll(function(){
			var windowpos = $(window).scrollTop();
			if(windowpos > 590){
				if(windowpos < doc_height){
					scrolling_div.stop().animate({
					'top': windowpos+'px'
					},200);
				} else scrolling_div.css('top', doc_height);
			} else scrolling_div.css('top','590px');
		});	
	}
	
	$("#menu li a img").mouseover(function(data){
		if(!$(this).hasClass('active')){
			var src = $(this).attr('src');
			var new_src = src.replace('-off','-on');
			if(src !== new_src){
				$(this).attr('src',new_src);
			}
		}
	});
	$("#menu li a img").mouseout(function(data){
		if(!$(this).hasClass('active')){
			var src = $(this).attr('src');
			var new_src = src.replace('-on','-off');
			$(this).attr('src',new_src);
		}
	});
});
