// url
$(document).ready(function() {
    $("ul#localNavi li a").each(function() {
		var url = document.URL.split("#")
		if ( this == url[0] || this + "index.html" == url[0]) {
			$(this).each(function(){
				$(this).replaceWith($(this).html());
			});
		}
    });
    $("dl#categories dd ul li a").each(function() {
		var url = document.URL.split("#")
		if ( this == url[0] || this + "index.html" == url[0]) {
			$(this).parent().addClass("focus");
			$(this).each(function(){
				$(this).replaceWith($(this).html());
			});
		}
    });
});


// pdfLink
$(function(){
	$("a[@href$=pdf]").addClass("pdf").click(function() {
		window.open(this.href,'blank');
		return false;
	});
});

$(document).ready(function() {
	$("a.blank").click(function() {
		window.open(this.href,'blank');
		return false;
	});
});


// zebra
$(function(){
$("table.zebra tr:even").addClass("even");
});

// hover
function initRollOverImages() {  
	var image_cache = new Object();  
	$(".hover").not("[@src*='hvr.']").each(function(i) {  
		var imgsrc = this.src;  
		var dot = this.src.lastIndexOf('.');  
		var imgsrchvr = this.src.substr(0, dot) + 'hvr' + this.src.substr(dot, 4);  
		image_cache[this.src] = new Image();  
		image_cache[this.src].src = imgsrchvr;  
		$(this).hover(  
			function() { this.src = imgsrchvr; },  
			function() { this.src = imgsrc; }  
		);  
	});  
}

$(document).ready(initRollOverImages);  


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


// blank
$(document).ready(function() {
	$("a.blank").click(function() {
		window.open(this.href,'blank');
		return false;
	});
});


// popup
$(function() {
	$('.fuyudrive').click(function(){
		window.open(this.href, "fuyudrive","width=431,height=757,resizable=yes");
		return false;
	});
});
