// lastupdate: 2009/12/14

// RollOver
$(function () {
	$.rollover = {
		init: function () {
			// <img>
			$('a img,input[type="image"]')
				.filter('[src*="_off."]')
				.bind('mouseover', this.over)
				.bind('mouseout',  this.out)
				.each(this.preload);
			// <a> with <img>, <shape> with <img> (for DD_belatedPNG.js)
			if ($.browser.msie && $.browser.version <= 6 )	// ie6
			$('shape')
				.filter(function(){return this.firstChild && this.firstChild.src})
				.bind('mouseover', this.overx)
				.bind('mouseout',  this.outx)
				.each(this.preloadx);
		},

		// <img>
		over : function () {
			this.setAttribute('src', this.getAttribute('src').replace('_off.', '_on.'));
		},
		out : function () {
			this.setAttribute('src', this.getAttribute('src').replace('_on.', '_off.'));
		},
		preload : function () {
			new Image().src = this.getAttribute('src').replace('_off.', '_on.');
		},
		// <a> with <img>, <shape> with <img> (for DD_belatedPNG.js)
		overx : function () {
			var img = this.firstChild;
			img.setAttribute('src', img.getAttribute('src').replace('_off.', '_on.'));
		},
		outx : function () {
			var img = this.firstChild;
			img.setAttribute('src', img.getAttribute('src').replace('_on.', '_off.'));
		},
		preloadx : function () {
			var img = this.firstChild;
			new Image().src = img.getAttribute('src').replace('_off.', '_on.');
		}
	};

	$.rollover.init();
});


// extension
$(document).ready(function(){
	$("a[href$=pdf]").addClass("pdf");
	$("a[href$=doc]").addClass("doc");
	$("a[href$=xls]").addClass("xls");
	$("a[href$=gif]").addClass("img");
	$("a[href$=jpg]").addClass("img");
 $('a[href^=http]').not('[href*=akita-gt.org]').not('a:has(img)')
	  .addClass("external")
	  .attr({ target: "_blank" });
});

/*
// png
$(document).ready(function() {
	$("img[src$=png]").pngfix();
});
*/

// PNG fix with DD_belatedPNG.js
if (window.DD_belatedPNG) DD_belatedPNG.fix('.title, img, #body');

