jQuery(document).ready(function(){

	shown = 'none';

	jQuery("li.about").click(function(){

			if (shown == 'about') {jQuery("#content").animate({ 
					        marginTop: "50px"
					      }, 500 );
					jQuery('li.about a').css("border-top","none");
					shown = 'none'} else {
				jQuery("#content").animate({ 
						        marginTop: "50px"
						      }, 500 ).queue(function () {
					jQuery('#about-text').show();
					jQuery('li.about a').css("border-top","5px solid #ccc"); "border-top","5px solid #ccc"
					jQuery('#links').hide();
					jQuery('li.links a').css("border-top","none");
					jQuery('#search').hide();
					jQuery('li.search a').css("border-top","none");
					jQuery('#contact').hide();
					jQuery('li.contact a').css("border-top","none");
					jQuery(this).animate({ 
							        marginTop: "230px"
							      }, 500 );
					shown = 'about';
					jQuery(this).dequeue();
				});
			}
		});

	jQuery("li.links").click(function(){

				if (shown == 'links') {jQuery("#content").animate({ 
						        marginTop: "50px"
						      }, 500 );
						jQuery('li.links a').css("border-top","none");
						shown = 'none'} else {
					jQuery("#content").animate({ 
							        marginTop: "50px"
							      }, 500 ).queue(function () {
						jQuery('#about-text').hide();
						jQuery('li.about a').css("border-top","none");
						jQuery('#links').show();
						jQuery('li.links a').css("border-top","5px solid #ccc");
						jQuery('#search').hide();
						jQuery('li.search a').css("border-top","none");
						jQuery('#contact').hide();
						jQuery('li.contact a').css("border-top","none");
						jQuery(this).animate({ 
								        marginTop: "195px"
								      }, 500 );
						shown = 'links';
						jQuery(this).dequeue();
					});
				}
			});

	jQuery("li.search").click(function(){

				if (shown == 'search') {
					jQuery("#content").animate({ 
							        marginTop: "50px"
							      }, 500 );
							jQuery('li.search a').css("border-top","none");
							shown = 'none'
				} else {
					jQuery("#content").animate({ 
							        marginTop: "50px"
							      }, 500 ).queue(function () {
						jQuery('#about-text').hide();
						jQuery('li.about a').css("border-top","none");
						jQuery('#links').hide();
						jQuery('li.links a').css("border-top","none");
						jQuery('#search').show();
						jQuery('li.search a').css("border-top","5px solid #ccc");
						jQuery('#contact').hide();
						jQuery('li.contact a').css("border-top","none");
						jQuery(this).animate({ 
								        marginTop: "95px"
								      }, 500 );
						shown = 'search';
						jQuery(this).dequeue();
					});
				}
			});

	jQuery("li.contact").click(function(){

				if (shown == 'contact') {jQuery("#content").animate({ 
						        marginTop: "50px"
						      }, 500 );
						jQuery('li.contact a').css("border-top","none");
						shown = 'none'} else {
					jQuery("#content").animate({ 
							        marginTop: "50px"
							      }, 500 ).queue(function () {
						jQuery('#about-text').hide();
						jQuery('li.about a').css("border-top","none");
						jQuery('#links').hide();
						jQuery('li.links a').css("border-top","none");
						jQuery('#search').hide();
						jQuery('li.search a').css("border-top","none");
						jQuery('#contact').show();
						jQuery('li.contact a').css("border-top","5px solid #ccc");
						jQuery(this).animate({ 
								        marginTop: "180px"
								      }, 500 );
						shown = 'contact';
						jQuery(this).dequeue();
					});
				}
			});
			
			
			
			
			
			

jQuery(document).bind('keydown',  {combi:'j', disableInInput: true} ,
function(){ scrollTop = jQuery(window).scrollTop();
            jQuery('#content .posthead').each(function(i, h2){
                h2top = jQuery(h2).offset().top;
                if (scrollTop < h2top) {
                    jQuery.scrollTo(h2, 300 );
                    return false;
                }
            });
            jQuery('#content .posthead p img').each(function(i, h2){
                h2top = jQuery(h2).offset().top;
                if (scrollTop < h2top) {
                    jQuery.scrollTo(h2, 300 );
                    return false;
                }
            });
     });	

   jQuery(document).bind('keydown', {combi:'b', disableInInput: true} ,
function(){ scrollTop = jQuery(window).scrollTop();
            jQuery('#footer').each(function(i, h2){
                h2top = jQuery(h2).offset().top;
                if (scrollTop < h2top) {
                    jQuery.scrollTo(h2, 300 );
                    return false;
                }
            });
     });	


		jQuery.fn.reverse = function()
			{
		return this.pushStack(this.get().reverse(), arguments);
			};


   jQuery(document).bind('keydown',  {combi:'k', disableInInput: true} ,
function(){ scrollTop = jQuery(window).scrollTop();
            jQuery('#content .posthead').reverse().each(function(i, h2){
                h2top = jQuery(h2).offset().top;
                if (scrollTop > h2top) {
                    jQuery.scrollTo(h2, 300 );
                    return false;
                }
            });
            jQuery('#content .posthead p img').reverse().each(function(i, h2){
                h2top = jQuery(h2).offset().top;
                if (scrollTop > h2top) {
                    jQuery.scrollTo(h2, 300 );
                    return false;
                }
            });
        });	

   jQuery(document).bind('keydown',  {combi:'t', disableInInput: true} ,
function(){ scrollTop = jQuery(window).scrollTop();
            jQuery('#head').reverse().each(function(i, h2){
                h2top = jQuery(h2).offset().top;
                if (scrollTop > h2top) {
                    jQuery.scrollTo(0, 200 );
                    return false;
                }
            });
        });
});