
/* config */
//$(function() {
jQuery(document).ready(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());
        //2011/04までの住所
        //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号"));
        //2011/04/12以降の住所
        map.setCenter(new GLatLng(33.595684,130.406476), 14);
        map.addOverlay(createMarkerToInfoLink(new GLatLng(33.595684,130.406476),  "<strong>河上康洋税理士事務所</strong><br />〒812-0027<br />福岡市博多区下川端町2-1<br />博多座・西銀ビル11階"));
      }
    }
    mapping();
  }
	

  //Fancybox for WordPress v2.7.2
  $.fn.getTitle = function() {
		var arr = $("a.fancybox");
		$.each(arr, function() {
			var title = $(this).children("img").attr("title");
			$(this).attr('title',title);
		})
	}

		// Supported file extensions
		var thumbnails = 'a:has(img)[href$=".bmp"],a:has(img)[href$=".gif"],a:has(img)[href$=".jpg"],a:has(img)[href$=".jpeg"],a:has(img)[href$=".png"],a:has(img)[href$=".BMP"],a:has(img)[href$=".GIF"],a:has(img)[href$=".JPG"],a:has(img)[href$=".JPEG"],a:has(img)[href$=".PNG"]';

	
		$(thumbnails).addClass("fancybox").attr("rel","fancybox").getTitle();
			$("a.fancybox").fancybox({
			'imageScale': true,
			'padding': 10,
			'zoomOpacity': true,
			'zoomSpeedIn': 500,
			'zoomSpeedOut': 500,
			'zoomSpeedChange': 300,
			'overlayShow': true,
			'overlayColor': "#666666",
			'overlayOpacity': 0.3,
			'enableEscapeButton': true,
			'showCloseButton': true,
			'hideOnOverlayClick': true,
			'hideOnContentClick': false,
			'frameWidth':  560,
			'frameHeight':  340,
			'callbackOnStart': null,
			'callbackOnShow': null,
			'callbackOnClose': null,
			'centerOnScroll': true
		});
	
	//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;
              }
              );
      });
  }

});



