jQuery.fn.center = function () {

    this.css("position","fixed");
    this.css("top", ( $(document).height() - this.height() ) / 2 + "px");
    this.css("left", ( $(document).width() - this.width() ) / 2 + "px");
    return this;
}

$(document).ready(function() {

Loader = $('#loading');

$('li#getintouch a.top').click(function() { $('#getintouchdrop').slideToggle(); $(this).toggleClass('visible'); });

$('a.getintouch').click(function() { $('#getintouchdrop').slideToggle(); $(this).toggleClass('visible'); });


				$('ul#nav a.scroll, #header a#logo').bind('click',function(event){
                    var $anchor = $(this);
              
					// if ($(this).attr('href') == '#Home') { var topvar = 0; } else { var topvar = $($anchor.attr('href')).offset().top; }
					
					var topvar = $($anchor.attr('href')).offset().top;
					
					// $('html, body').stop().animate({ scrollLeft: 0 }, 1000);
					
                     $('html, body').stop().animate({scrollTop: topvar}, 2000, function(){ if (isiPhone()) { header.follow(); } }); 
         
                    event.preventDefault();
                });
	
	
$('a.readmore').click(function () { 

var postid = $(this).attr('id');

$('#postexcerpt_' + postid).hide();

var height = $('#fullpost_' + postid).height();

//$('#newspost_' + postid).animate({
//        height: height + 200
//    }, 50, function() { $('#fullpost_' + postid).show(); });
    
    
    $('#fullpost_' + postid).show();
    
   


});	
	

});

function isiPhone(){
    return (
        (navigator.platform.indexOf("iPhone") != -1) ||
        (navigator.platform.indexOf("iPod") != -1) || 
		(navigator.platform.indexOf("iPad") != -1)
    );
}

$(document).ready(function() { $('#loading').fadeIn('fast'); $('#loading').center(); });

$(window).load(function(){ $('#loading').fadeOut('fast'); })


			
