jQuery(function() {
	
	jQuery("a img").hover(function () {
			jQuery(this).stop().fadeTo(200,0.7);
	},
	function () {
		jQuery(this).stop().fadeTo("fast",1.0);
	 });	
	

    jQuery('a[href^=#]').click(function(){
        var target;
        target = jQuery( jQuery(this).attr('href') );
        if (target.length == 0) {
            return;
        }
        jQuery('html, body').animate({scrollTop: target.offset().top});
        return false;
    });
});
	
//トップページの画像スライダー

function myout() {
jQuery(function () {
		jQuery("#top_image img").fadeOut(100,function () {
		jQuery("#ti_02").attr("src", "./wp-content/themes/hanshin/images/b" + 1 + ".png");
		jQuery("#ti_03").attr("src", "./wp-content/themes/hanshin/images/c" + 1 + ".png");
		jQuery("#ti_01").attr("src", "./wp-content/themes/hanshin/images/a" + 1 + ".png");
		jQuery("#top_message").attr("src", "./wp-content/themes/hanshin/images/m" + 1 + ".png");
		jQuery("#ti_01").fadeIn("fast",function () {
		jQuery("#ti_02").fadeIn("fast",function () {
		jQuery("#ti_03").fadeIn("fast",function () {
		jQuery("#top_message").fadeIn("slow", function(){
		});
		});
		});
		});
		}
	);
});
}


var n=1;
var i=1;

function anime() {
	switch(n){
		case 1:
		case 2:
		case 5:
		case 6:
		n+=1;
		i+=1;
		jQuery(function() {
		jQuery("#top_image img").fadeOut("slow",function () {
		jQuery("#ti_02").css("left", "320px").attr("src", "./wp-content/themes/hanshin/images/b" + i + ".jpg");
		jQuery("#ti_03").css("left", "630px").attr("src", "./wp-content/themes/hanshin/images/c" + i + ".jpg");
		jQuery("#ti_01").attr("src", "./wp-content/themes/hanshin/images/a" + i + ".jpg");
		jQuery("#top_message").attr("src", "./wp-content/themes/hanshin/images/m" + i + ".png");
		jQuery("#ti_01").fadeIn("fast",function () {
		jQuery("#ti_02").fadeIn("fast",function () {
		jQuery("#ti_03").fadeIn("fast",function () {
		jQuery("#top_message").fadeIn("slow", function(){
			
		});
		});
		});
		});
		}
	);
	});
	break;
		case 3:
		case 4:
		n+=1;
		i+=1;
		jQuery(function() {
		jQuery("#top_image img").fadeOut("slow",function () {
		jQuery("#ti_02").css("left", "276px").attr("src", "./wp-content/themes/hanshin/images/b" + i + ".png");
		jQuery("#ti_03").css("left", "447px").attr("src", "./wp-content/themes/hanshin/images/c" + i + ".png");
		jQuery("#ti_01").attr("src", "./wp-content/themes/hanshin/images/a" + i + ".png");
		jQuery("#top_message").attr("src", "./wp-content/themes/hanshin/images/m" + i + ".png");
		jQuery("#ti_01").fadeIn("fast",function () {
		jQuery("#ti_02").fadeIn("fast",function () {
		jQuery("#ti_03").fadeIn("fast",function () {
		jQuery("#top_message").fadeIn("slow", function(){
			
		});
		});
		});
		});
		}
	);
	});
	break;
	}
	
}
var tout = setTimeout(myout, 100);
var timer = setInterval(anime, 4800);

jQuery(function() {
	
	jQuery(".your-name").mouseover(function () {
		jQuery(".name").css("backgroundPosition", "0 -55px");
	});
	jQuery(".your-name").mouseout(function () {
		jQuery(".name").css("backgroundPosition", "0 0");
	});
		jQuery(".your-email").mouseover(function () {
		jQuery(".mail").css("backgroundPosition", "0 -55px");
	});
	jQuery(".your-email").mouseout(function () {
		jQuery(".mail").css("backgroundPosition", "0 0");
	});
		jQuery(".your-message textarea").mouseover(function () {
		jQuery(this).css("borderColor","#FF6600");
		jQuery(".message_t").css("backgroundPosition","0 -32px");
	});
	jQuery(".your-message textarea").mouseout(function () {
		jQuery(this).css("borderColor","#25b18c");
		jQuery(".message_t").css("backgroundPosition","0 0");
	});	
	

	jQuery("#sendbutton").hover(function(){
		jQuery("#name_clone").text(jQuery(".name input").val());
			if (jQuery(".name input").val() == "") {
			jQuery("#name_clone").html("<span class='red'>※記入されていません</span>");
			}
		jQuery("#mail_clone").text(jQuery(".mail input").val());
			if (jQuery(".mail input").val() == "") {
			jQuery("#mail_clone").html("<span class='red'>※記入されていません</span>");
			}
		jQuery("#message_clone").html(jQuery(".message textarea").val());
			if (jQuery(".message textarea").val() == "") {
			jQuery("#message_clone").text("※記入されていません");
			}
		jQuery("#contact_clone:not(:animated)").fadeIn("fast");
		},
		function () {
			jQuery("#contact_clone:not(:animated)").fadeOut("fast");
	});
			
	
	
	if (jQuery("div").is(".wpcf7-mail-sent-ok")) {
	jQuery("#contact").hide();
	location.replace("./mail_ok");
	} else if (jQuery("div").is(".wpcf7-validation-errors")) {
	jQuery("").show();
	}

});

/**
 * jQuery Masonry v2.0.110721
 * A dynamic layout plugin for jQuery
 * The flip-side of CSS Floats
 * http://masonry.desandro.com
 *
 * Licensed under the MIT license.
 * Copyright 2011 David DeSandro
 */
(function(a,b,c){var d=b.event,e;d.special.smartresize={setup:function(){b(this).bind("resize",d.special.smartresize.handler)},teardown:function(){b(this).unbind("resize",d.special.smartresize.handler)},handler:function(a,b){var c=this,d=arguments;a.type="smartresize",e&&clearTimeout(e),e=setTimeout(function(){jQuery.event.handle.apply(c,d)},b==="execAsap"?0:100)}},b.fn.smartresize=function(a){return a?this.bind("smartresize",a):this.trigger("smartresize",["execAsap"])},b.Mason=function(a,c){this.element=b(c),this._create(a),this._init()};var f=["position","height"];b.Mason.settings={isResizable:!0,isAnimated:!1,animationOptions:{queue:!1,duration:500},gutterWidth:0,isRTL:!1,isFitWidth:!1},b.Mason.prototype={_filterFindBricks:function(a){var b=this.options.itemSelector;return b?a.filter(b).add(a.find(b)):a},_getBricks:function(a){var b=this._filterFindBricks(a).css({position:"absolute"}).addClass("masonry-brick");return b},_create:function(c){this.options=b.extend(!0,{},b.Mason.settings,c),this.styleQueue=[],this.reloadItems();var d=this.element[0].style;this.originalStyle={};for(var e=0,g=f.length;e<g;e++){var h=f[e];this.originalStyle[h]=d[h]||null}this.element.css({position:"relative"}),this.horizontalDirection=this.options.isRTL?"right":"left",this.offset={};var i=b(document.createElement("div"));this.element.prepend(i),this.offset.y=Math.round(i.position().top),this.options.isRTL?(i.css({"float":"right",display:"inline-block"}),this.offset.x=Math.round(this.element.outerWidth()-i.position().left)):this.offset.x=Math.round(i.position().left),i.remove();var j=this;setTimeout(function(){j.element.addClass("masonry")},0),this.options.isResizable&&b(a).bind("smartresize.masonry",function(){j.resize()})},_init:function(a){this._getColumns("masonry"),this._reLayout(a)},option:function(a,c){b.isPlainObject(a)&&(this.options=b.extend(!0,this.options,a))},layout:function(a,c){var d,e,f,g,h,i;for(var j=0,k=a.length;j<k;j++){d=b(a[j]),e=Math.ceil(d.outerWidth(!0)/this.columnWidth),e=Math.min(e,this.cols);if(e===1)this._placeBrick(d,this.colYs);else{f=this.cols+1-e,g=[];for(i=0;i<f;i++)h=this.colYs.slice(i,i+e),g[i]=Math.max.apply(Math,h);this._placeBrick(d,g)}}var l={};l.height=Math.max.apply(Math,this.colYs)-this.offset.y,this.options.isFitWidth&&(l.width=this.cols*this.columnWidth-this.options.gutterWidth),this.styleQueue.push({$el:this.element,style:l});var m=this.isLaidOut?this.options.isAnimated?"animate":"css":"css",n=this.options.animationOptions,o;for(j=0,k=this.styleQueue.length;j<k;j++)o=this.styleQueue[j],o.$el[m](o.style,n);this.styleQueue=[],c&&c.call(a),this.isLaidOut=!0},_getColumns:function(){var a=this.options.isFitWidth?this.element.parent():this.element,b=a.width();this.columnWidth=this.options.columnWidth||this.$bricks.outerWidth(!0)||b,this.columnWidth+=this.options.gutterWidth,this.cols=Math.floor((b+this.options.gutterWidth)/this.columnWidth),this.cols=Math.max(this.cols,1)},_placeBrick:function(a,b){var c=Math.min.apply(Math,b),d=0;for(var e=0,f=b.length;e<f;e++)if(b[e]===c){d=e;break}var g={top:c};g[this.horizontalDirection]=this.columnWidth*d+this.offset.x,this.styleQueue.push({$el:a,style:g});var h=c+a.outerHeight(!0),i=this.cols+1-f;for(e=0;e<i;e++)this.colYs[d+e]=h},resize:function(){var a=this.cols;this._getColumns("masonry"),this.cols!==a&&this._reLayout()},_reLayout:function(a){var b=this.cols;this.colYs=[];while(b--)this.colYs.push(this.offset.y);this.layout(this.$bricks,a)},reloadItems:function(){this.$bricks=this._getBricks(this.element.children())},reload:function(a){this.reloadItems(),this._init(a)},appended:function(a,b,c){if(b){this._filterFindBricks(a).css({top:this.element.height()});var d=this;setTimeout(function(){d._appended(a,c)},1)}else this._appended(a,c)},_appended:function(a,b){var c=this._getBricks(a);this.$bricks=this.$bricks.add(c),this.layout(c,b)},remove:function(a){this.$bricks=this.$bricks.not(a),a.remove()},destroy:function(){this.$bricks.removeClass("masonry-brick").each(function(){this.style.position=null,this.style.top=null,this.style.left=null});var c=this.element[0].style;for(var d=0,e=f.length;d<e;d++){var g=f[d];c[g]=this.originalStyle[g]}this.element.unbind(".masonry").removeClass("masonry").removeData("masonry"),b(a).unbind(".masonry")}},b.fn.imagesLoaded=function(a){var b=this.find("img"),c=[],d=this,e=b.length;if(!b.length){a.call(this);return this}b.one("load error",function(){--e===0&&(e=b.length,b.one("load error",function(){--e===0&&a.call(d)}).each(function(){this.src=c.shift()}))}).each(function(){c.push(this.src),this.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="});return this};var g=function(a){this.console&&console.error(a)};b.fn.masonry=function(a){if(typeof a=="string"){var c=Array.prototype.slice.call(arguments,1);this.each(function(){var d=b.data(this,"masonry");if(!d)g("cannot call methods on masonry prior to initialization; attempted to call method '"+a+"'");else{if(!b.isFunction(d[a])||a.charAt(0)==="_"){g("no such method '"+a+"' for masonry instance");return}d[a].apply(d,c)}})}else this.each(function(){var c=b.data(this,"masonry");c?(c.option(a||{}),c._init()):b.data(this,"masonry",new b.Mason(a,this))});return this}})(window,jQuery);





/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 *
 * Open source under the BSD License.
 *
 * Copyright ﾂｩ 2008 George McGinley Smith
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice, this list of
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list
 * of conditions and the following disclaimer in the documentation and/or other materials
 * provided with the distribution.
 *
 * Neither the name of the author nor the names of contributors may be used to endorse
 * or promote products derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 *
*/

// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		//alert(jQuery.easing.default);
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
	},
	easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
	easeInOutQuad: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t + b;
		return -c/2 * ((--t)*(t-2) - 1) + b;
	},
	easeInCubic: function (x, t, b, c, d) {
		return c*(t/=d)*t*t + b;
	},
	easeOutCubic: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t + 1) + b;
	},
	easeInOutCubic: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	},
	easeInQuart: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t + b;
	},
	easeOutQuart: function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	},
	easeInOutQuart: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
	},
	easeInQuint: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t*t + b;
	},
	easeOutQuint: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
	},
	easeInOutQuint: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
		return c/2*((t-=2)*t*t*t*t + 2) + b;
	},
	easeInSine: function (x, t, b, c, d) {
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
	},
	easeOutSine: function (x, t, b, c, d) {
		return c * Math.sin(t/d * (Math.PI/2)) + b;
	},
	easeInOutSine: function (x, t, b, c, d) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeInCirc: function (x, t, b, c, d) {
		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
	},
	easeOutCirc: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	},
	easeInOutCirc: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
	},
	easeInElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	},
	easeOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	easeInOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},
	easeInBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	easeOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	easeInOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	},
	easeInBounce: function (x, t, b, c, d) {
		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
	},
	easeOutBounce: function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	},
	easeInOutBounce: function (x, t, b, c, d) {
		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
	}
});

function preLoadImages() {
  for (var i = 0, I = arguments.length; i < I; ++i) {
    new Image().src = arguments[i];
  }
}

preLoadImages(
"http://netrinseki.heteml.jp/hanshin/wp-content/themes/hanshin/images/a1.png",
"http://netrinseki.heteml.jp/hanshin/wp-content/themes/hanshin/images/a2.jpg",
"http://netrinseki.heteml.jp/hanshin/wp-content/themes/hanshin/images/a3.jpg",
"http://netrinseki.heteml.jp/hanshin/wp-content/themes/hanshin/images/a4.png",
"http://netrinseki.heteml.jp/hanshin/wp-content/themes/hanshin/images/a5.png",
"http://netrinseki.heteml.jp/hanshin/wp-content/themes/hanshin/images/a6.jpg",
"http://netrinseki.heteml.jp/hanshin/wp-content/themes/hanshin/images/b1.png",
"http://netrinseki.heteml.jp/hanshin/wp-content/themes/hanshin/images/b2.jpg",
"http://netrinseki.heteml.jp/hanshin/wp-content/themes/hanshin/images/b3.jpg",
"http://netrinseki.heteml.jp/hanshin/wp-content/themes/hanshin/images/b4.png",
"http://netrinseki.heteml.jp/hanshin/wp-content/themes/hanshin/images/b5.png",
"http://netrinseki.heteml.jp/hanshin/wp-content/themes/hanshin/images/b6.jpg",
"http://netrinseki.heteml.jp/hanshin/wp-content/themes/hanshin/images/c1.png",
"http://netrinseki.heteml.jp/hanshin/wp-content/themes/hanshin/images/c2.jpg",
"http://netrinseki.heteml.jp/hanshin/wp-content/themes/hanshin/images/c3.jpg",
"http://netrinseki.heteml.jp/hanshin/wp-content/themes/hanshin/images/c4.png",
"http://netrinseki.heteml.jp/hanshin/wp-content/themes/hanshin/images/c5.png",
"http://netrinseki.heteml.jp/hanshin/wp-content/themes/hanshin/images/c6.jpg",
"http://netrinseki.heteml.jp/hanshin/wp-content/themes/hanshin/images/m1.png",
"http://netrinseki.heteml.jp/hanshin/wp-content/themes/hanshin/images/m2.png",
"http://netrinseki.heteml.jp/hanshin/wp-content/themes/hanshin/images/m3.png",
"http://netrinseki.heteml.jp/hanshin/wp-content/themes/hanshin/images/m4.png",
"http://netrinseki.heteml.jp/hanshin/wp-content/themes/hanshin/images/m5.png",
"http://netrinseki.heteml.jp/hanshin/wp-content/themes/hanshin/images/m6.png",
"http://netrinseki.heteml.jp/hanshin/wp-content/themes/hanshin/images/c7.png",
"http://netrinseki.heteml.jp/hanshin/wp-content/themes/hanshin/images/m8.png"
);


