function here() {
	alert('here');
}


(function($){
	
	$.extend({
			 
		smoothAnchors : function(speed, easing, redirect){
				
			speed = speed || "fast";
			easing = easing || null;
			redirect = (redirect === true || redirect == null) ? true : false;
			
			$("a").each(function(i){
							
				var url = $(this).attr("href");
				
				if(url){
					if(url.indexOf("#") != -1 && url.indexOf("#") == 0){
		
						var aParts = url.split("#",2);
						var anchor = $("a[name='"+aParts[1]+"']");
						
						if(anchor){
																					
							$(this).click(function(){
												   
								if($(document).height()-anchor.offset().top >= $(window).height()
								 || anchor.offset().top > $(window).height()
								 || $(document).width()-anchor.offset().left >= $(window).width()
								 || anchor.offset().left > $(window).width()){
									
									
									/* calculate current anchor point e.g. box1 */
									/* calculate current top coordinates */
									var currentBox = document.location.hash.substring(1);
									if ((currentBox == 'a1') || (currentBox == 'a2') || (currentBox == 'a3'))  {
										var currentTopPosition = 0;	
									}
									if ((currentBox == 'b1') || (currentBox == 'b2') || (currentBox == 'b3'))  {
										var currentTopPosition = $(window).height();
										
									}
									if ((currentBox == 'c1') || (currentBox == 'c2') || (currentBox == 'c3'))  {
										var currentTopPosition = ($(window).height() * 2);
										
									}
									
									
									/* calculate current left coordinates */
									if ((currentBox == 'a1') || (currentBox == 'b1') || (currentBox == 'c1'))  {
										var currentLeftPosition = 0;
									}
									if ((currentBox == 'a2') || (currentBox == 'b2') || (currentBox == 'c2'))  {
										var currentLeftPosition = $(window).width();
									}
									if ((currentBox == 'a3') || (currentBox == 'b3') || (currentBox == 'c3'))  {
										var currentLeftPosition = ($(window).width() * 2);
									}
									
									
									/* work out up and down movement */
									if (currentTopPosition > anchor.offset().top) {
										var routeUpDown = 'up';
									}
									else if (currentTopPosition < anchor.offset().top) {
										var routeUpDown = 'down';
									}
									else var routeUpDown = false;
									
									/* work out up left and right movement */
									if (currentLeftPosition > anchor.offset().left) {
										var routeLeftRight = 'left';
									}
									else if (currentLeftPosition < anchor.offset().left) {
										var routeLeftRight = 'right';
									}
									else var routeLeftRight = false;
									
									
									
									if ((routeUpDown) && (routeLeftRight)) {
										$('html, body').animate({
											
											scrollTop: anchor.offset().top,
											scrollLeft: currentLeftPosition
										}, speed, easing, function(){
											if(redirect){ 
												//window.location = url 
											}
										});
										
										$('html, body').animate({
											
											scrollTop: anchor.offset().top,
											scrollLeft: anchor.offset().left
										}, speed, easing, function(){
											if(redirect){ 
												window.location = url 
											}
										});
									}
									
									else {
										$('html, body').animate({
											
											scrollTop: anchor.offset().top,
											scrollLeft: anchor.offset().left
										}, speed, easing, function(){
											if(redirect){ 
												window.location = url 
											}
										});
									}
									
									
									
									
									
									
									
									
									
									
									
									
									//alert ('routeUpDown is '+routeUpDown);
									//alert ('routeLeftRight is '+routeLeftRight);
									//alert('currentTopPosition is '+currentTopPosition+' and currentLeftPosition is '+currentLeftPosition);
									//alert('current box is '+currentBox);
									//alert(anchor.id());
									//alert('anchor is '+anchor.id);
									//alert('current height is '+$(window).height()+' current width is '+$(window).width()+' going to top '+anchor.offset().top+' and left '+anchor.offset().left);
									//alert('moveUp is '+moveUp);
									//if (anchor.offset().top > 
									
									
									
									
									
									
									
									
									/*$('html, body').animate({
										
										scrollTop: anchor.offset().top,
										scrollLeft: anchor.offset().left
									}, speed, easing, function(){
										if(redirect){ 
											window.location = url 
										}
									}); */
								
								}
								
								return false;
																
							});
						}
					
					}
					
				}
				
			});
			
		}
	
	});
	
})(jQuery);