
(function(){

	$(document).ready(function(){

		// rollover.
		$('img.over, input.over').each(function(){
			// preload image.
			var img = new Image();
			img.src = this.src.replace(/^(.+)(\.[a-z]+)$/, '$1_on$2');
			$(this)
				// store the image sources.
				.data('image', {
					defaultSrc: this.src,
					hoverSrc: img.src
				})
				.hover(
					function(){
						this.src = $(this).data('image').hoverSrc;
					},
					function(){
						this.src = $(this).data('image').defaultSrc;
					}
				);
		});

		// status current.
		$('img.current').each(function(){
			this.src = this.src.replace(/^(.+)(\.[a-z]+)$/, '$1_on$2');
		});

		// google tracker for cross domain.
		$('a').not('[href=#top],[rel=external],[rel=popup]').click(function(){
			pageTracker._link(this.href);
			return false;
		});
		$('form').submit(function(){
			pageTracker._linkByPost(this);
		});

		// open link as '_blank'.
		$('a[rel=external]').click(function(){
			pageTracker._link(this.href);	// for ga.	
			window.open(this.href, '_blank');
			return false;
		});

	});

})(jQuery);
