jQuery(document).ready(function() {
	// return to top link func
	if ( jQuery(document).height() >= 2200 ) {
		jQuery('<span><a href="#top">&#x2191; return to top</a></span>').insertAfter('p.footer cite');
		jQuery('<a id="top" name="top"></a>').prependTo('body');
		var pgHeight = parseInt(jQuery(document).height() / 3, 10);
		jQuery('p.footer a').click(function(){
			jQuery('html, body').animate({scrollTop: '0px'}, pgHeight);
			return false;
		});
	};
	/* end if var | start position function*/
	jQuery.fn.findPosition = function(pos) {
		return pos.position();
	};
	//var elem = jQuery('p.footer').position();
	//alert('The position is ' + elem.top );
	// jQuery('ul.nav a.nav-btn-contact').click(function(){
	// 	jQuery('html, body').animate({scrollTop: elem.top}, pgHeight);
	// 	return false;
	// });
	jQuery('ul.nav a.nav-btn-portfolio').click(function(){
		jQuery('html, body').animate({scrollTop: '450px'}, 800);
		return false;
	});
	jQuery('ul.nav a.nav-btn-home').click(function(){
		jQuery('html, body').animate({scrollTop: '0px'}, 800);
		return false;
	});
	/* must be enabled for dynamic loader */
	/* jQuery.hover_insert = function() {
		jQuery('<div class="img_overlay"> </div>').insertBefore('div.storycontent p a img');
	}; */
	jQuery('<div class="img_overlay"> </div>').insertBefore('div.storycontent div a img');
	jQuery('div.storycontent div a').hover(function(){
		var $imgOverlay = jQuery('div.storycontent div a div.img_overlay').hide();
		jQuery($imgOverlay).css('margin-top', 15);
		jQuery($imgOverlay).animate({'margin-top': 0, opacity: 'show'}, 400);
	});
});
