
/* config */
$(function() {
	//ロールオーバー
	rollOver();
	
	//scroll for page link
	$('a[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;
				$('html,body')
				.animate({scrollTop: targetOffset}, 1000);
				return false;
			}
		}
	});

	// add class
	$('li:last').addClass('Last');
	
	//for H3
	$('#contentRight h3').wrapInner('<strong></strong>');
	
	//メッセージが送信完了したら、入力フォームを消す
	if ( $('#contentRight form div.wpcf7-mail-sent-ok').size() > 0 ) {
		$('#contentRight form table.TableForm').hide();
		$('#contentRight form p input').hide();
	}
	
	//Google Map表示 (Profile用)
	if( $("#gMap").size() > 0 ){
    var map;
    function createMarkerToInfoLink(point, cText) {
      var marker = new GMarker(point);
      marker.openInfoWindowHtml( cText );
      return marker;
    }
    
    function mapping() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("gMap"));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(33.58576,130.41999), 14);
        
        map.addOverlay(createMarkerToInfoLink(new GLatLng(33.58576,130.41999),  "<strong>河上康洋税理士事務所</strong><br />〒812-0011<br />福岡市博多区博多駅前4-15-10<br />B:SQUARE 602号"));
      }
    }
    mapping();
  }
	
	//for IE6
	if ($.browser.msie && $.browser.version < 7 ){
	}
});


/**
 * rollOver on jQuery
 * rollOver tag:img,input
 * rollOver class:Over
 * rollOver FileName:*_o.*
 * Last modify:20081210
 * Licensed:MIT License
 * @author AkiraNISHIJIMA(http://nishiaki.probo.jp/)
 */


function rollOver(){
    var preLoad = new Object();
    $('img.Over,input.Over').not("[src*='_o.']").each(function(){
        var imgSrc = this.src;
        var fType = imgSrc.substring(imgSrc.lastIndexOf('.'));
        var imgName = imgSrc.substr(0, imgSrc.lastIndexOf('.'));
        var imgOver = imgName + '_o' + fType;
        preLoad[this.src] = new Image();
        preLoad[this.src].src = imgOver;
        $(this).hover(
            function (){
                this.src = imgOver;
            },
            function (){
                this.src = imgSrc;
            }
            );
    });
}
