////base.js////

/* jQuery
-------------------------------------------*/

$(function(){
		   
	/* fontsize.js initialize
	-------------------------------------------*/
	fscRef();

	/* Hover image
	-------------------------------------------*/

	// Arguments are image paths relative to the current page.
	var cache = [];
	$.preLoadImages = function() {  
		var args_len = arguments.length;  
		for (var i = args_len; i--;) {  
			var cacheImage = document.createElement('img');  
			cacheImage.src = arguments[i];  
			cache.push(cacheImage);  
		}  
	}

	// Hover action
	$("img.hover").mouseover(function(){
		$(this).attr("src",$(this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_f2$2"));
	}).mouseout(function(){
		$(this).attr("src",$(this).attr("src").replace(/^(.+)_f2(\.[a-z]+)$/, "$1$2"));
	}).each(function(){
		$("<img>").attr("src",$(this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_f2$2"));
	})
	
	// Preload image
	$("img.hover").each(function(){
		$.preLoadImages($(this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_f2$2"));
	});
	
	/* Blank page icon
	-------------------------------------------*/
	$('a[href$="pdf"]').addClass('blankPDF');
	
	$('#mainContents li').each(function() {
		$(this).children('a[href$="pdf"]').parent().addClass('blankPDF');
		$(this).children('a[href$="pdf"]').removeClass('blankPDF');
	});
	$('#topSubNavi li').each(function() {
		$(this).children('a[href$="pdf"]').after('<img src="common/img/icon_pdf.gif" alt="PDF" style="vertical-align: text-bottom;" />');
	});
	
});


/*Analytics
----------------------------------------------------------------------*/

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-26597459-1']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();


