// JavaScript Document
	function fadeContent(count) {
		//alert(count);
	  if(count < 2){
		  
		$("#old_browser").html("Your browser (Internet Explorer 6/7) is <strong>out of date</strong>. It has known security flaws and may not display all features of this and other websites. <a href=\"http://www.microsoft.com/windows/internet-explorer/default.aspx\" target=\"_blank\">Learn how to update your browser</a>").fadeIn(500).fadeOut(500);
		count++;
		fadeContent(count); //loop
	  }
	  $("#old_browser").fadeIn(500);
	  $('#old_browser').live("click", function(){
			document.location = 'http://www.microsoft.com/windows/internet-explorer/default.aspx';	
		});
	}
	
	function checkDisplayBackToTop(){
		if($(document).height()> $(window).height()){
			$(".to_top").show();
		}else{
			$(".to_top").hide();
		}
	}
	
	$(document).ready(function() {
		$('#clouds').pan({fps: 30, speed: 1, dir: 'left', depth: 10});
		$('#search_form').sprite({fps: 20, no_of_frames: 3});
		
		$('#sign').click(function(){
			document.location = 'http://www.webmotionuk.co.uk/';	
		});
		$('#logo').click(function(){
			document.location = 'http://www.onourstreet.co.uk/';	
		});

		if($.browser.msie==true && $.browser.version<7.0){
			fadeContent(0);
		}
		
		checkDisplayBackToTop();	
					
	});
	
	$(window).resize(function() {
		checkDisplayBackToTop();	
	});
	
	$('a[rel=smooth]').each(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname && this.hash.replace(/#/,'') ) {
		var $targetId = $(this.hash), $targetAnchor = $('[name=' + this.hash.slice(1) +']');
		var $target = $targetId.length ? $targetId : $targetAnchor.length ? $targetAnchor : false;
			if ($target) {
			var targetOffset = $target.offset().top;
				$(this).click(function() {
					$('html, body').animate({scrollTop: targetOffset}, 400);
					return false;
				});
			}
		}
	});
