/**
 * Created by Nguyen Hai Van on 1/21/2015.
 */
$(document).ready(function(){
    $(function(){$(".bxslider").bxSlider({mode:"fade",speed:1500,captions:true,auto:true,pager:false})});
    $(function(){$(".article-has-images").bxSlider({auto:true,mode:"fade",speed:1500,controls:false,pager:false})});
    $(function(){$(".video-list").bxSlider({auto:true,mode:"vertical",speed:1500,controls:true,pager:false,slideWidth:350,minSlides:2,maxSlides:2,slideMargin:10})})

    /*Slide gallery*/
    $(function(){var e=.6;$("#thumbs ul.thumbs li").opacityrollover({mouseOutOpacity:e,mouseOverOpacity:1,fadeSpeed:"fast",exemptionSelector:".selected"});var t=$("#thumbs").galleriffic({delay:4800,numThumbs:10,preloadAhead:-1,enableTopPager:true,enableBottomPager:true,maxPagesToShow:100,imageContainerSel:"#slideshow",controlsContainerSel:"#controls",captionContainerSel:"#caption",loadingContainerSel:"#loading",renderSSControls:true,renderNavControls:true,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:false,autoStart:true,syncTransitions:true,defaultTransitionDuration:900,onSlideChange:function(t,n){this.find("ul.thumbs").children().eq(t).fadeTo("fast",e).end().eq(n).fadeTo("fast",1);this.$captionContainer.find("div.photo-index").html(n+1+" <b><i>/</b></i> "+this.data.length)},onPageTransitionOut:function(e){this.fadeTo("fast",0,e)},onPageTransitionIn:function(){var e=this.find("a.prev").css("visibility","hidden");var t=this.find("a.next").css("visibility","hidden");if(this.displayedPage>0)e.css("visibility","visible");var n=this.getNumPages()-1;if(this.displayedPage<n)t.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 xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=document.body.scrollWidth;yScroll=window.innerHeight+window.scrollMaxY}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight}else if(document.documentElement&&document.documentElement.scrollHeight>document.documentElement.offsetHeight){xScroll=document.documentElement.scrollWidth;yScroll=document.documentElement.scrollHeight}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight}var windowWidth,windowHeight;if(self.innerHeight){windowWidth=self.innerWidth;windowHeight=self.innerHeight}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight}if(yScroll<windowHeight){pageHeight=windowHeight}else{pageHeight=yScroll}if(xScroll<windowWidth){pageWidth=windowWidth}else{pageWidth=xScroll}return[pageWidth,pageHeight,windowWidth,windowHeight]}
    function initNav(){var e=jQuery("#menu-main-nav");var t=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});if(!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 n=jQuery(this).find("> .drop");if(jQuery.browser.msie){jQuery(n).css({display:"block"}).stop().animate({height:e},t,function(){jQuery(this).css({overflow:"visible"})})}else{jQuery(n).css({display:"block"}).stop().animate({height:e,opacity:1},t,function(){jQuery(this).css({overflow:"visible"})})}}).mouseleave(function(){var e=jQuery(this);if(jQuery.browser.msie){jQuery(this).find("> .drop").stop().css({overflow:"hidden"}).animate({height:0},t,function(){jQuery(e).removeClass("hover")})}else{jQuery(this).find("> .drop").stop().css({overflow:"hidden"}).animate({height:0,opacity:0},t,function(){jQuery(e).removeClass("hover")})}});jQuery(this).find(".drop ul > li ").mouseenter(function(){jQuery(this).addClass("hover");var e=getPageSize()[2];if(e<jQuery(this).offset().left+236*2){jQuery(this).find("> .drop").css({left:"auto",right:320})}if(jQuery.browser.msie){jQuery(this).find("> .drop").css({display:"block"}).stop().animate({width:320},t,function(){jQuery(this).css({overflow:"visible"})})}else{jQuery(this).find("> .drop").css({display:"block"}).stop().animate({width:320,opacity:1},t,function(){jQuery(this).css({overflow:"visible"})})}}).mouseleave(function(){jQuery(this).removeClass("hover");if(jQuery.browser.msie){jQuery(this).find("> .drop").stop().css({overflow:"hidden"}).animate({width:0},t,function(){jQuery(this).css({display:"none"})})}else{jQuery(this).find("> .drop").stop().css({overflow:"hidden"}).animate({width:0,opacity:0},t,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)
});