/*	Created by Coderviet and updated by Stonechow	 */

$(document).ready(function() {
	$(function() {
			var e = $(".bxslider");
			e.length && e.bxSlider({
				mode: "fade",
				speed: 1500,
				captions: !0,
				auto: !0,
				pager: !1
			})
		}),
		$(function() {
			var e = $(".article-has-images");
			e.length && e.bxSlider({
				auto: !0,
				mode: "fade",
				speed: 1500,
				controls: !1,
				pager: !1
			})
		}),
		$(function() {
			var e = $(".video-list");
			e.length && e.bxSlider({
				auto: !0,
				mode: "vertical",
				speed: 1500,
				controls: !0,
				pager: !1,
				slideWidth: 350,
				minSlides: 2,
				maxSlides: 2,
				slideMargin: 10
			})
		});
	/*Slide gallery*/
	/*	$(function(){
			var i=$("#thumbs ul.thumbs");
			if(i.length){
				$("#thumbs ul.thumbs li").opacityrollover({mouseOutOpacity:e,mouseOverOpacity:1,fadeSpeed:"fast",exemptionSelector:".selected"});
				{$("#thumbs").galleriffic({delay:4800,numThumbs:10,preloadAhead:-1,enableTopPager:!0,enableBottomPager:!0,maxPagesToShow:100,imageContainerSel:"#slideshow",controlsContainerSel:"#controls",captionContainerSel:"#caption",loadingContainerSel:"#loading",renderSSControls:!0,renderNavControls:!0,playLinkText:'Slideshow <img src="./images/slideshow_play.png" border="0" />',pauseLinkText:'Slideshow <img src="./images/slideshow_pause.png" border="0" />',prevLinkText:"&#8249; Previous Photo",nextLinkText:"Next Photo &#8250;",enableHistory:!1,autoStart:!0,syncTransitions:!0,defaultTransitionDuration:900,onSlideChange:function(i,t){this.find("ul.thumbs").children().eq(i).fadeTo("fast",e).end().eq(t).fadeTo("fast",1),this.$captionContainer.find("div.photo-index").html(t+1+" <b><i>/</b></i> "+this.data.length)},onPageTransitionOut:function(i){this.fadeTo("fast",0,i)},onPageTransitionIn:function(){var i=this.find("a.prev").css("visibility","hidden"),e=this.find("a.next").css("visibility","hidden");
				this.displayedPage>0&&i.css("visibility","visible");
				var t=this.getNumPages()-1;
				this.displayedPage<t&&e.css("visibility","visible"),this.fadeTo("fast",1)}})}$(".next-slide").click(function(){$("ul.thumbs").find(".selected").next().children().click()}),$(".previous-slide").click(function(){$("ul.thumbs").find(".selected").prev().children().click()})
			}
			var e=.6
		});*/
		var ep = .6
	$(function() {
		var thumbs = $(".thumbs-div");
		$.each(thumbs, function(i, e) {
			var container=$(e).parents(".slide-container");
			$(container).find( ".controls").attr("id", "controls" + i);
			$(container).find( ".caption-container").attr("id", "caption" + i);
			$(container).find( ".slideshow").attr("id", "slideshow" + i);
			$(container).find( ".loader").attr("id", "loading" + i);
			$(container).find( "ul.thumbs li").opacityrollover({
				mouseOutOpacity: ep,
				mouseOverOpacity: 1,
				fadeSpeed: "fast",
				exemptionSelector: ".selected"
			}); {
				$(e).galleriffic({
					delay: 3500,
					numThumbs: 10,
					preloadAhead: -1,
					enableTopPager: !0,
					enableBottomPager: !0,
					maxPagesToShow: 100,
					imageContainerSel: "#slideshow" + i,
					controlsContainerSel: "#controls" + i,
					captionContainerSel: "#caption" + i,
					loadingContainerSel: "#loading"+i,
					renderSSControls: !0,
					renderNavControls: !0,
					playLinkText: 'Slideshow <img src="./images/slideshow_play.png" border="0" />',
					pauseLinkText: 'Slideshow <img src="./images/slideshow_pause.png" border="0" />',
					prevLinkText: "&#8249; Previous Photo",
					nextLinkText: "Next Photo &#8250;",
					enableHistory: !1,
					autoStart: !0,
					syncTransitions: !0,
					defaultTransitionDuration: 900,
					onSlideChange: function(it, t) {
						this.find("ul.thumbs").children().eq(it).fadeTo("fast", ep).end().eq(t).fadeTo("fast", 1), this.$captionContainer.find("div.photo-index").html(t + 1 + " <b><i>/</b></i> " + this.data.length)
					},
					onPageTransitionOut: function(it) {
						this.fadeTo("fast", 0, it)
					},
					onPageTransitionIn: function() {
						var it = this.find("a.prev").css("visibility", "hidden"),
							et = this.find("a.next").css("visibility", "hidden");
						this.displayedPage > 0 && it.css("visibility", "visible");
						var t = this.getNumPages() - 1;
						this.displayedPage < t && et.css("visibility", "visible"), this.fadeTo("fast", 1)
					}
				})
			}
			$(".next-slide").click(function() {
				$("ul.thumbs").find(".selected").next().children().click()
			}), $(".previous-slide").click(function() {
				$("ul.thumbs").find(".selected").prev().children().click()
			})

		});

		/*		if(i.length){
					$("#thumbs ul.thumbs li").opacityrollover({mouseOutOpacity:e,mouseOverOpacity:1,fadeSpeed:"fast",exemptionSelector:".selected"});
					{$("#thumbs").galleriffic({delay:4800,numThumbs:10,preloadAhead:-1,enableTopPager:!0,enableBottomPager:!0,maxPagesToShow:100,imageContainerSel:"#slideshow",controlsContainerSel:"#controls",captionContainerSel:"#caption",loadingContainerSel:"#loading",renderSSControls:!0,renderNavControls:!0,playLinkText:'Slideshow <img src="./images/slideshow_play.png" border="0" />',pauseLinkText:'Slideshow <img src="./images/slideshow_pause.png" border="0" />',prevLinkText:"&#8249; Previous Photo",nextLinkText:"Next Photo &#8250;",enableHistory:!1,autoStart:!0,syncTransitions:!0,defaultTransitionDuration:900,onSlideChange:function(i,t){this.find("ul.thumbs").children().eq(i).fadeTo("fast",e).end().eq(t).fadeTo("fast",1),this.$captionContainer.find("div.photo-index").html(t+1+" <b><i>/</b></i> "+this.data.length)},onPageTransitionOut:function(i){this.fadeTo("fast",0,i)},onPageTransitionIn:function(){var i=this.find("a.prev").css("visibility","hidden"),e=this.find("a.next").css("visibility","hidden");
					this.displayedPage>0&&i.css("visibility","visible");
					var t=this.getNumPages()-1;
					this.displayedPage<t&&e.css("visibility","visible"),this.fadeTo("fast",1)}})}$(".next-slide").click(function(){$("ul.thumbs").find(".selected").next().children().click()}),$(".previous-slide").click(function(){$("ul.thumbs").find(".selected").prev().children().click()})
				}*/
		
	});

	/* ---	Main Navigation --- */
	function getPageSize() {
		var e, i;
		window.innerHeight && window.scrollMaxY ? (e = document.body.scrollWidth, i = window.innerHeight + window.scrollMaxY) : document.body.scrollHeight > document.body.offsetHeight ? (e = document.body.scrollWidth, i = document.body.scrollHeight) : document.documentElement && document.documentElement.scrollHeight > document.documentElement.offsetHeight ? (e = document.documentElement.scrollWidth, i = document.documentElement.scrollHeight) : (e = document.body.offsetWidth, i = document.body.offsetHeight);
		var t, o;
		return self.innerHeight ? (t = self.innerWidth, o = self.innerHeight) : document.documentElement && document.documentElement.clientHeight ? (t = document.documentElement.clientWidth, o = document.documentElement.clientHeight) : document.body && (t = document.body.clientWidth, o = document.body.clientHeight), pageHeight = o > i ? o : i, pageWidth = t > e ? t : e, [pageWidth, pageHeight, t, o]
	}

	function initNav() {
		var e = jQuery("#menu-main-nav"),
			i = 260;
		jQuery(e).find(".sub-menu").css({
			left: 0
		}), jQuery(e).find("> li").each(function() {
			var e = jQuery(this).find("> .drop").height();
			jQuery(this).find("> .drop").css({
				display: "none",
				height: 0,
				overflow: "hidden"
			}), jQuery(this).find(".drop li > .drop").css({
				display: "none",
				width: 0
			}), jQuery.browser.msie || (jQuery(this).find("> .drop").css({
				opacity: 0
			}), jQuery(this).find(".drop li > .drop").css({
				opacity: 0
			})), jQuery(this).mouseenter(function() {
				jQuery(this).addClass("hover");
				var t = jQuery(this).find("> .drop");
				jQuery.browser.msie ? jQuery(t).css({
					display: "block"
				}).stop().animate({
					height: e
				}, i, function() {
					jQuery(this).css({
						overflow: "visible"
					})
				}) : jQuery(t).css({
					display: "block"
				}).stop().animate({
					height: e,
					opacity: 1
				}, i, function() {
					jQuery(this).css({
						overflow: "visible"
					})
				})
			}).mouseleave(function() {
				var e = jQuery(this);
				jQuery.browser.msie ? jQuery(this).find("> .drop").stop().css({
					overflow: "hidden"
				}).animate({
					height: 0
				}, i, function() {
					jQuery(e).removeClass("hover")
				}) : jQuery(this).find("> .drop").stop().css({
					overflow: "hidden"
				}).animate({
					height: 0,
					opacity: 0
				}, i, function() {
					jQuery(e).removeClass("hover")
				})
			}), jQuery(this).find(".drop ul > li ").mouseenter(function() {
				jQuery(this).addClass("hover");
				var e = getPageSize()[2];
				e < jQuery(this).offset().left + 472 && jQuery(this).find("> .drop").css({
					left: "auto",
					right: 320
				}), jQuery.browser.msie ? jQuery(this).find("> .drop").css({
					display: "block"
				}).stop().animate({
					width: 320
				}, i, function() {
					jQuery(this).css({
						overflow: "visible"
					})
				}) : jQuery(this).find("> .drop").css({
					display: "block"
				}).stop().animate({
					width: 320,
					opacity: 1
				}, i, function() {
					jQuery(this).css({
						overflow: "visible"
					})
				})
			}).mouseleave(function() {
				jQuery(this).removeClass("hover"), jQuery.browser.msie ? jQuery(this).find("> .drop").stop().css({
					overflow: "hidden"
				}).animate({
					width: 0
				}, i, function() {
					jQuery(this).css({
						display: "none"
					})
				}) : jQuery(this).find("> .drop").stop().css({
					overflow: "hidden"
				}).animate({
					width: 0,
					opacity: 0
				}, i, function() {
					jQuery(this).css({
						display: "none"
					})
				})
			})
		})
	}! function(e) {
		e(document).ready(function() {
			initNav()
		})
	}(jQuery),
	function(e) {
		e(document).ready(function() {
			jQuery("#menu-main-nav li:has(ul)").addClass("parent")
		})
	}(jQuery);
});