window.Rydges={},
function(t){
	var e=function(t){return this.initialize(t),this};
	t.extend(e.prototype,{initialize:function(e){
			this.options=e,
			this.isCover="cover"===e.type,
			this.isContain="contain"===e.type,
			this.el=t(e.el),
			this.calculate(),
			t(window).on("resize",t.proxy(this,"calculate"))
		},
		width:function(){
			return this.options.width||this.el.attr("width")
		},
		height:function(){
			return this.options.height||this.el.attr("height")
		},
		ratio:function(){
			return this.width()/this.height()
		},
		calculate:function(){
			var t,e=this.el.parent().width(),i=this.el.parent().height(),n={};
			this.options.padding&&(e-=this.options.padding.x,i-=this.options.padding.y),
			this.options.max&&(e=Math.min(this.options.max.width,e),i=Math.min(this.options.max.height,i)),
			this.options.min&&(e=Math.max(this.options.min.width,e),i=Math.max(this.options.min.height,i)),
			t=e/i,
			this.isContain&&(t>this.ratio()?(n.height=i,n.width=i*this.ratio()):(n.height=e/this.ratio(),n.width=e),
			n.marginTop=(this.el.parent().height()-n.height)/2,
			n.marginLeft=(this.el.parent().width()-n.width)/2),
			this.isCover&&(t<this.ratio()?(n.height=i,n.width=i*this.ratio()):(n.height=e/this.ratio(),n.width=e),n.marginTop=-(n.height-this.el.parent().height())/2,n.marginLeft=-(n.width-this.el.parent().width())/2),
			this.el.css(n)
		}
	}),
	t.fn.contain=function(i){
		return this.each(function(){new e(t.extend({el:this,type:"contain"},i))})
	},
	t.fn.cover=function(i){
		return this.each(function(){new e(t.extend({el:this,type:"cover"},i))})
	}
}(jQuery),
function(t,e){
	"use strict";
	var i="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";
	t.fn.imagesLoaded=function(n){
		function o(){
			var e=t(d),i=t(p);
			c&&(p.length?c.reject(l,e,i):c.resolve(l)),
			t.isFunction(n)&&n.call(r,l,e,i)
		}
		function a(t){
			s(t.target,"error"===t.type)
		}
		function s(e,n){
			e.src!==i&&-1===t.inArray(e,u)&&(u.push(e),n?p.push(e):d.push(e),t.data(e,"imagesLoaded",{isBroken:n,src:e.src}),h&&c.notifyWith(t(e),[n,l,t(d),t(p)]),l.length===u.length&&(setTimeout(o),l.unbind(".imagesLoaded",a)))
		}
		var r=this,c=t.isFunction(t.Deferred)?t.Deferred():0,h=t.isFunction(c.notify),l=r.find("img").add(r.filter("img")),u=[],d=[],p=[];
		return t.isPlainObject(n)&&t.each(n,function(t,e){"callback"===t?n=e:c&&c[t](e)}),
		l.length?l.bind("load.imagesLoaded error.imagesLoaded",a).each(function(n,o){var a=o.src,r=t.data(o,"imagesLoaded");return r&&r.src===a?void s(o,r.isBroken):o.complete&&o.naturalWidth!==e?void s(o,0===o.naturalWidth||0===o.naturalHeight):void((o.readyState||o.complete)&&(o.src=i,o.src=a))}):o(),c?c.promise(r):r}
}(jQuery),
Rydges.Fadeshow=function(t){this.init(t)},
$.extend(Rydges.Fadeshow.prototype,{
	defaults:{controls:!0},
	init:function(t){
		var e=this;
		this.el=$(t.el),
		this.options=$.extend({},this.defaults,t),
		this.slider=this.el.children().first(),
		this.slides=this.slider.children().hide(),
		this.slides.each(function(){$(this).prependTo(e.slider)}).filter(":last-child").show(),
		this.createControls(),
		this.timeout=setTimeout($.proxy(this,"autoplay"),6e3)
	},
	autoplay:function(){
		clearTimeout(this.timeout),
		this.next(),
		this.timeout=setTimeout($.proxy(this,"autoplay"),6e3)
	},
	createControls:function(){
		var t=this;
		this.options.controls&&this.slides.size()>1&&(this.el.append('<button class="slider-prev"></button>').append('<button class="slider-next"></button>'),this.el.find(".slider-prev").on("click",function(e){e.preventDefault(),clearTimeout(t.timeout),t.prev()}),this.el.find(".slider-next").on("click",function(e){e.preventDefault(),clearTimeout(t.timeout),t.next()})),
		t.slider.on("click",function(e){e.preventDefault(),clearTimeout(t.timeout),t.next()}),
		t.slider.find("a").click(function(t){t.stopPropagation()})
	},
	prev:function(){
		var t=this;
		t.slides.finish().filter(":first-child").hide().appendTo(t.slider).fadeIn("slow",function(){t.slides.not(this).hide()}),
		this.el.trigger("fade")
	},
	next:function(){
		var t=this;
		t.slides.finish().filter(":last-child").prev().show().next().fadeOut("slow",function(){$(this).prependTo(t.slider)}),
		this.el.trigger("fade")
	}
}),
Rydges.FluidText=function(t){this.init(t)},
$.extend(Rydges.FluidText.prototype,{
	init:function(t){
		this.el=$(t.el),
		this.options=t,
		$(window).on("load resize",$.proxy(this,"resize"))
	},
	resize:function(){
		var t=Math.min(this.options.max,$(window).width()),e=t/this.options.width;
		this.el.css({fontSize:e+"em"})
	}
}),
$(function(){
	//new Rydges.FluidText({el:".default-layout .block-grid, .default-layout .header-grid, .article-layout .header-grid",width:965,max:1280}),
	//new Rydges.FluidText({el:".article-layout .block-grid, .background-layout .block-grid, .dark-layout .block-grid",width:836,max:836}),
	//new Rydges.FluidText({el:".header-slice",width:700,max:700})
}),

Rydges.forms={
	mobileFix:function(){
		if(!($(window).width()>767)){
			var t=$('meta[name="viewport"]'),e=t.attr("content");
			$(document).on("focus","input, select, textarea",function(){
				t.attr("content",e+", user-scalable=no"),
				$(".banner-footer").hide()
			}).on("blur","input, select, textarea",function(){
				t.attr("content",e),
				$(".banner-footer").show()
			})
		}
	}
},
$(function(){Rydges.forms.mobileFix()}),
Rydges.LazyLoad=function(t){this.init(t)},
$.extend(Rydges.LazyLoad.prototype,{
	init:function(t){this.el=$(t.el),this.hide()},
	hide:function(){
		this.el.find("img").css({visibility:"hidden",opacity:0}).each(function(){
			var t=$(this);
			t.imagesLoaded(function(){
				t.css({visibility:"visible",transition:"opacity 0.2s"}).width(),
				t.css({opacity:""})
			})
		})
	}
}),
$(function(){		
	new Rydges.LazyLoad({el:"body"})	
}),

Rydges.Navigation=function(t){this.init(t)},
$.extend(Rydges.Navigation.prototype,{
	init:function(t){
		this.el=$(t.el),
		this.handle=this.el.find(".navigation-handle"),
		this.container=this.el.parent(),
		this.height=this.el.height(),
		this.percent=this.height/100,
		this.handle.on("touchstart.navigation",$.proxy(this,"start")),
		this.handle.on("click.navigation",$.proxy(this,"click")),
		this.el.on("transitionend",$.proxy(this,"transitionEnd")),
		$(window).resize($.proxy(this,"setPadding")).trigger("resize")
	},
	setPadding:function(){
		$("body").css({paddingTop:this.el.height()})
	},
	click:function(t){
		t.preventDefault();
		var e=this;
		this.el.toggleClass("js-active"),
		this.handle.toggleClass("open"),
		this.el.is(".js-active")?(this.position=100,this.container.animate({height:"100%"})):(this.position=0,this.container.animate({scrollTop:0},200,function(){e.container.css({height:"",overflow:""})})),
		this.position=this.el.is(".js-active")?100:0,
		this.el.css({transition:"0.2s",transform:"translate(0, "+(this.position-100)+"%)"})
	},
	start:function(t){
		$(window).on("touchmove.navigation",$.proxy(this,"move")),
		$(window).on("touchend.navigation",$.proxy(this,"end")),
		this.offset=t.originalEvent.targetTouches[0].clientY,
		this.offset-=this.handle.offset().top,
		this.offset+=$(window).scrollTop()
	},
	move:function(t){
		t.preventDefault(),
		this.position=t.originalEvent.targetTouches[0].clientY,
		this.position=(this.position-this.offset)/this.percent,
		this.position=Math.max(0,this.position),
		this.position=Math.min(120,this.position),
		this.el.css({transition:"",transform:"translate3d(0, "+(this.position-100)+"%, 0)"})
	},
	end:function(){
		$(window).off(".navigation"),
		this.position=this.position>50?100:0,
		this.el.css({transition:"0.2s",transform:"translate3d(0, "+(this.position-100)+"%, 0)"})
	},
	transitionEnd:function(){
		this.el.css({transition:""})
	}
}),
$(function(){
	new Rydges.Navigation({el:"#navigation"})
}),

$(document).on("click","a",function(t){
	var e=$(this).attr("href"),i=location.hostname;
	e&&e.match(/^http/)&&-1===e.indexOf(i)&&(t.preventDefault(),window.open(e))
}),
$(function(){
	$(".overlay").click(function(){$(this).fadeOut()})
}),
$(window).on("resize load",function(){
	$(window).width()<767?$("body").addClass("mobile"):$("body").removeClass("mobile")
}),
Rydges.ResponsiveImage=function(t){this.init(t)},
$.extend(Rydges.ResponsiveImage.prototype,{
	init:function(t){
		this.el=$(t.el),
		this.options=t,
		this.el.data({
			desktop_src:this.el.data("src"),
			desktop_width:this.el.data("width"),
			desktop_height:this.el.data("height"),
			mobile_src:this.el.attr("src"),
			mobile_width:this.el.attr("width"),
			mobile_height:this.el.attr("height")
		}),
		this.width=$(window).width(),
		this.shouldReplace()&&this.replace("desktop"),
		$(window).resize($.proxy(this,"resize"))
	},
	shouldReplace:function(){
		return $(window).width()>=768
	},
	resize:function(){
		var t=767,e=$(window).width();
		e>t&&this.width<t&&this.replace("desktop"),
		t>e&&this.width>t&&this.replace("mobile"),
		this.width=e
	},
	replace:function(t){
		this.el.css("visibility","hidden"),
		this.el.attr("src",this.el.data(t+"_src")),
		this.el.attr("width",this.el.data(t+"_width")),
		this.el.attr("height",this.el.data(t+"_height")),
		this.el.css("visibility","visible")
	}
}),
$(function(){
	$("[data-src]").each(function(){
		new Rydges.ResponsiveImage({el:this,width:$(window).width()})
	})
}),
Rydges.BackgroundLayout=function(t){ this.init(t)	},
$.extend(Rydges.BackgroundLayout.prototype,{
	init:function(t){
		this.el=$(t.el),
		this.options=t,
		this.header=this.el.find(".header-container"),
		$(window).on("resize.pageLayout",$.proxy(this,"resize")),
		$(window).trigger("resize")
	},
	resize:function(){
		var t=$(window).height()-100;
		this.header.css({marginTop:t-this.header.height()})
	}
}),
$(function(){
	$(".background-layout").each(function(){	
		new Rydges.BackgroundLayout({el:this})	
	})
}),
Rydges.BackgroundSlice=function(t){this.init(t)},
$.extend(Rydges.BackgroundSlice.prototype,{
	init:function(t){
		this.el=$(t.el),
		this.options=t,
		this.imageCover()
	},
	imageCover:function(){
		this.el.find("img").each(function(){
			$(this).cover({width:$(this).attr("width"),height:$(this).attr("height")})
		})
	}
}),
$(function(){
	$(".background-slice").each(function(){
		new Rydges.BackgroundSlice({el:this})
	})
}),
Rydges.BedroomHeaderBlockSlice=function(t){this.init(t)},
$.extend(Rydges.BedroomHeaderBlockSlice.prototype,{
	init:function(t){
		this.el=$(t.el),
		this.container=this.el.closest('[class$="-container"]'),
		this.container.is(".content-container")&&(this.container.addClass("header-block-margin"),
		$(window).resize($.proxy(this,"resize")),this.resize())
	},
	resize:function(){
		var t=this.el.height(),e=this.container.position().top,i=Math.max(0,$(window).height()-e-80-t);
		this.container.css({marginTop:i})
	}
}),
$(function(){
	$(".header-block-slice").each(function(){
		new Rydges.BedroomHeaderBlockSlice({el:this})
	})
}),
$(function(){
	$(".slideshow-gallery").parent().each(function(){
		new Rydges.Fadeshow({el:this})
	})
}),
Rydges.HeaderHomeSlice=function(t){this.init(t)},
$.extend(Rydges.HeaderHomeSlice.prototype,{
	init:function(t){
		this.el=$(t.el),
		this.options=t,
		$(window).on("resize.headerHomeSlice",$.proxy(this,"resize")),
		this.imageCover(),
		$(window).trigger("resize")
	},
	imageCover:function(){
		this.el.find(".header-home-image").each(function(){$(this).cover()})
	},
	resize:function(){
		var t=parseInt($("body").css("padding-top")),e=$(window).height()-t-80;
		this.el.css({height:e})
	}
}),
$(function(){
	$(".header-home-slice").each(function(){
		new Rydges.HeaderHomeSlice({el:this}),
		new Rydges.Fadeshow({el:this,controls:!1})
	})
}),
Rydges.ImagesBlockSlice=function(t){this.init(t)},
$.extend(Rydges.ImagesBlockSlice.prototype,{
	init:function(t){
		this.el=$(t.el),
		this.options=t,
		this.imageCover()
	},
	imageCover:function(){
		this.el.find("img").each(function(){
			$(this).cover()
		})
	}
}),
$(function(){
	$(".image-block-slice").each(function(){
		new Rydges.ImagesBlockSlice({el:this}),
		new Rydges.Fadeshow({el:this,controls:!1})
	})
})