$(window).bind("load",function(){

$("#pagetop").click(function(){
	pageScroll();
	return false;
});

//Contact
//if($('body#company').size()){
	$("a.maillink").each(function(){
	var ma = $(this).text();
	if(! ma.match("@")) { ma = "iki@guthrie.co.jp"};
	$(this).attr({'href': "mailto:"+ma});
	});
//}

});


$(document).ready(function(){
//$(window).bind("load",function(){
//$(function(){
			 
$('#mainmenu a').each(function(){
	var tgturi = $(this).attr("href").split('/');
	if(tgturi[tgturi.length-2] == $('body').attr('id')){
		$(this).addClass('sel');
	}
});
$('#submenu a').each(function(){
	var tgturi = $(this).attr("href").split('/');
	var matchObj = new RegExp($('body').attr('id'));
	if(tgturi[tgturi.length-1].match(matchObj)){
		$(this).addClass('sel');
	}
});

//if (!document.getElementById) return false;
var aPreLoad = new Array();
var sTempSrc;
var aImages = document.getElementsByTagName('img');
for (var i = 0; i < aImages.length; i++) {
	var tgtClass = aImages[i].className;
	if (tgtClass == 'btn') {
		var src = aImages[i].getAttribute('src');
		var ftype = src.substring(src.lastIndexOf('.'), src.length);
		var hsrc = src.replace(ftype, '_o'+ftype);
		aImages[i].setAttribute('hsrc', hsrc);
		aImages[i].setAttribute('dsrc', src);
		aPreLoad[i] = new Image();
		aPreLoad[i].src = hsrc;
		
		if(aImages[i].parentNode.className == "sel") {
			aImages[i].setAttribute('src', hsrc);
			continue;
		}
		aImages[i].onmouseover = function() {
			this.setAttribute('src', this.getAttribute('hsrc'));
		}
		aImages[i].onmouseout = function() {
			this.setAttribute('src', this.getAttribute('dsrc'));
		}
	}
}

//////////////////////

});

////////////////////////////////////////////

function pageScroll(o){
	if(!o) o=0;
	$.scrollTo(o,250);
}

function showHide(o) {
	var $tgtNode = $("div.pane", $(o.parentNode.parentNode));
	$tgtNode.slideToggle("fast");
}

function slideToggle(o) {
	var $tgtNode = $("div.pane", $(o.parentNode.parentNode));
	$tgtNode.slideToggle("fast");
}

 