/*
 * jmonk.js
 * @requires jQuery v1.2.6
 *
 */


 
/**
 *	Initialization
 */
$(function(){
	$.jmonk.init();
});

/**
 *	Initialization
 */

$.jmonk = {
	init: function() {
		for (module in $.jmonk) {
			if ($.jmonk[module].init){
				$.jmonk[module].init();
			}
		}
	}
};





/**
 *	externalLinks (add target _blank)
 */
$.jmonk.externalLinks = {
	init: function() {
		$('a[@rel=external]').attr("target","_blank").filter(':not(:has("img"))').addClass("external");
	}
};



/**
 *	pagetop
 */
 $.jmonk.pagetop = {
	init: function() {
		$('a[href*=#]').click(function() {
			if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')&& location.hostname == this.hostname.replace(/:.*$/,'')) {
				var $target = $(this.hash);
				$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
				if ($target.length) {
					var targetOffset = $target.offset().top;
					$('html,body').animate({scrollTop: targetOffset}, 500);
					return false;
				}
			}
		});	
	 }
 };

