/* Source and licensing information for the line(s) below can be found at http://images.medicaldaily.com/sites/medicaldaily.com/modules/medicaldaily_header/js/medicaldaily_header.js. */
(function($){var hideTimeout;function showMenuItem(section){hideMenuItem();var activeMenu;$('.page-nav li a').each(function(){if($.trim($(this).text())==$.trim(section)){activeMenu=$(this);return false;}});if(activeMenu.length==0){return false;}
$('.flyout-menu .link-title').each(function(){var flyoutItem=$(this).closest('.flyout-menu-item');var featuredItems;if(flyoutItem.length>0&&$.trim($(this).text())==$.trim(section)){var featuredItems=flyoutItem.find('.featured-items');if(featuredItems.length>0){flyoutItem.addClass('active');activeMenu.addClass('highlighted');}
return false;}});setTimeout(function(){$('.flyout-menu').addClass('initialized');},400);}
function hideMenuItem(){clearTimeout(hideTimeout);$('.flyout-menu-item').removeClass('active');$('.page-nav li a').removeClass('highlighted');$('.flyout-menu').removeClass('initialized');}
$(document).ready(function(){$('.page-nav li a').mouseenter(function(){var section=$(this).text();showMenuItem(section);});$('.flyout-menu-item').mouseenter(function(){var section=$(this).find('.link-title').text();showMenuItem(section);});$('.page-nav li a').mouseleave(function(){hideTimeout=setTimeout(function(){hideMenuItem();},300);});$('.flyout-menu-item').mouseleave(function(){hideTimeout=setTimeout(function(){hideMenuItem();},300);});});})(jQuery);;;
/* Source and licensing information for the above line(s) can be found at http://images.medicaldaily.com/sites/medicaldaily.com/modules/medicaldaily_header/js/medicaldaily_header.js. */
(function ($) {
// Initializes jw player player
Drupal.behaviors.fusionJWPlayer = {
initialized: false,
contentPlaybackTriggerEvent: '',
attach: function(context, settings) {
var fusionJWPlayer = this;
var jw_debug = settings.fusion_jwplayer.debug;
var timerStart = Date.now();
if (jw_debug) {
console.log("preparing load jw", Date.now()-timerStart);
}
var jw_loaded = false;
var jw_script = document.createElement('script');
jw_script.defer = true;
jw_script.type = 'text/javascript';
jw_script.src = settings.fusion_jwplayer.player_src;
if(jw_script.addEventListener){
jw_script.addEventListener("load",function(){
jw_loaded = true;
if (jw_debug) {
console.log("loaded jw", Date.now()-timerStart);
}
if($('body').hasClass('not-front')) {
fusionJWPlayer.init();
}
},false);
}
var node = document.getElementsByTagName('script')[0];
node.parentNode.insertBefore(jw_script, node);
$(document).on('fusionJWPlayerJSinit', function(e) {
fusionJWPlayer.init();
});
},
init: function() {
if (this.initialized) {
return;
}
if ($('#fusion_jwplayer').length == 0) {
return;
}
this.initialized = true;
var fusionJWPlayer = this;
var settings = Drupal.settings.fusion_jwplayer;
var playlist = settings.playlist;
var ibtplayer = jwplayer("fusion_jwplayer");
if(ibtGetCookie("fqv") == 1) settings.autostart = false;
var setup = {
advertising: {
"vpaidmode": "insecure",
"client": "googima",
"tag": settings.adtag,
"admessage": "This ad will end in xx seconds"
},
playlist: playlist,
hlslabels:{"800":"High","420":"Low"},
autostart: settings.autostart,
displaydescription: true,
visualplaylist: false,
logo: {
file: settings.logo,
position: "top-right",
link: "/",
},
volume: 50,
//related: {"oncomplete": "autoplay", "autoplaytimer": 3, "file": settings.related, "onclick": "play", "heading": "More videos"},
skin: {"active": settings.bg}
};
if (settings.preload) {
setup.preload = settings.preload;
}
setup.displaytitle = false;
if (settings.displaytitle) {
setup.displaytitle = true;
}
ibtplayer.setup(setup);
jwplayer().on('adImpression',function(){
fusionJWPlayer.comscore('adstart');
});
jwplayer().on('firstFrame',function(){
fusionJWPlayer.comscore('');
});
ibtplayer.on('ready',function(){
if (typeof dataLayer != 'undefined') {
dataLayer.push({
'jw_ready': true,
'event': 'jw_ready'
});
}
});
},
comscore: function(trackingType) {
// This is tracking pixel when video plays
var comscoreTrackingUrl = "http://b.scorecardresearch.com/p?c1=1&c2=7922264&c5=02";
// This is tracking pixel when ad plays
if (trackingType == "adstart") {
comscoreTrackingUrl = "http://b.scorecardresearch.com/p?c1=1&c2=7922264&c5=01";
}
jQuery('body').append('');
}
};
})(jQuery);;/**/
(function($){
$(document).ready(function() {
var addthisScript = document.createElement('script');
addthisScript.setAttribute('src', 'http://s7.addthis.com/js/300/addthis_widget.js#domready=1');
document.getElementsByTagName("head")[0].appendChild(addthisScript);
});
})(jQuery);/**/
/* Source and licensing information for the line(s) below can be found at http://images.medicaldaily.com/sites/all/modules/modules-custom/ibtmedia/ibtmedia_top_stories/js/ibtmedia_top_stories.js. */
(function($){$(document).ready(function(){if($('.most-popular').length>0&&typeof $('.most-popular').tabs!="undefined"){$('.most-popular').tabs();}
$('.item-shares-wrapper').mouseenter(function(){$(this).find('.item-shares').addClass('hidden');$(this).find('.addthis_toolbox').removeClass('hidden');});$('.item-shares-wrapper').mouseleave(function(){$(this).find('.item-shares').removeClass('hidden');$(this).find('.addthis_toolbox').addClass('hidden');});});})(jQuery);;
/* Source and licensing information for the above line(s) can be found at http://images.medicaldaily.com/sites/all/modules/modules-custom/ibtmedia/ibtmedia_top_stories/js/ibtmedia_top_stories.js. */
/* Source and licensing information for the line(s) below can be found at http://images.medicaldaily.com/sites/all/modules/modules-contrib/datalayer/datalayer.js. */
(function($){Drupal.behaviors.dataLayer={langPrefixes:function langPrefixes(){var languages=Drupal.settings.dataLayer.languages,langList=[];for(var lang in languages){if(languages[lang].prefix!==''){langList.push(languages[lang].prefix);}}
return langList;},attach:function(){return}};})(jQuery);;;
/* Source and licensing information for the above line(s) can be found at http://images.medicaldaily.com/sites/all/modules/modules-contrib/datalayer/datalayer.js. */
/* Source and licensing information for the line(s) below can be found at http://images.medicaldaily.com/sites/all/libraries/swipe/swipe2.js. */
function Swipe(container,options){"use strict";var noop=function(){};var offloadFn=function(fn){setTimeout(fn||noop,0)};var browser={addEventListener:!!window.addEventListener,touch:('ontouchstart'in window)||window.DocumentTouch&&document instanceof DocumentTouch,transitions:(function(temp){var props=['transitionProperty','WebkitTransition','MozTransition','OTransition','msTransition'];for(var i in props)if(temp.style[props[i]]!==undefined)return true;return false;})(document.createElement('swipe'))};if(!container)return;var element=container.children[0];var slides,slidePos,width,length;options=options||{};var index=parseInt(options.startSlide,10)||0;var speed=options.speed||300;options.continuous=options.continuous!==undefined?options.continuous:true;function setup(){slides=element.children;length=slides.length;if(slides.length<2)options.continuous=false;if(browser.transitions&&options.continuous&&slides.length<3){element.appendChild(slides[0].cloneNode(true));element.appendChild(element.children[1].cloneNode(true));slides=element.children;}
slidePos=new Array(slides.length);width=container.getBoundingClientRect().width||container.offsetWidth;element.style.width=(slides.length*width)+'px';var pos=slides.length;while(pos--){var slide=slides[pos];slide.style.width=width+'px';slide.setAttribute('data-index',pos);if(browser.transitions){slide.style.left=(pos* -width)+'px';move(pos,index>pos?-width:(indexindex?to:index)-diff-1),width*direction,0);to=circle(to);move(index,width*direction,slideSpeed||speed);move(to,0,slideSpeed||speed);if(options.continuous)move(circle(to-direction),-(width*direction),0);}else{to=circle(to);animate(index* -width,to* -width,slideSpeed||speed);}
index=to;offloadFn(options.callback&&options.callback(index,slides[index]));}
function move(index,dist,speed){translate(index,dist,speed);slidePos[index]=dist;}
function translate(index,dist,speed){var slide=slides[index];var style=slide&&slide.style;if(!style)return;style.webkitTransitionDuration=style.MozTransitionDuration=style.msTransitionDuration=style.OTransitionDuration=style.transitionDuration=speed+'ms';style.webkitTransform='translate('+dist+'px,0)'+'translateZ(0)';style.msTransform=style.MozTransform=style.OTransform='translateX('+dist+'px)';}
function animate(from,to,speed){if(!speed){element.style.left=to+'px';return;}
var start=+new Date;var timer=setInterval(function(){var timeElap=+new Date-start;if(timeElap>speed){element.style.left=to+'px';if(delay)begin();options.transitionEnd&&options.transitionEnd.call(event,index,slides[index]);clearInterval(timer);return;}
element.style.left=(((to-from)*(Math.floor((timeElap/speed)*100)/100))+from)+'px';},4);}
var delay=options.auto||0;var interval;function begin(){interval=setTimeout(next,delay);}
function stop(){delay=0;clearTimeout(interval);}
var start={};var delta={};var isScrolling;var events={handleEvent:function(event){switch(event.type){case'touchstart':this.start(event);break;case'touchmove':this.move(event);break;case'touchend':offloadFn(this.end(event));break;case'webkitTransitionEnd':case'msTransitionEnd':case'oTransitionEnd':case'otransitionend':case'transitionend':offloadFn(this.transitionEnd(event));break;case'resize':offloadFn(setup.call());break;case'orientationchange':offloadFn(setup.call());break;}
if(options.stopPropagation)event.stopPropagation();},start:function(event){var touches=event.touches[0];start={x:touches.pageX,y:touches.pageY,time:+new Date};isScrolling=undefined;delta={};element.addEventListener('touchmove',this,false);element.addEventListener('touchend',this,false);},move:function(event){if(event.touches.length>1||event.scale&&event.scale!==1)return
if(options.disableScroll)event.preventDefault();var touches=event.touches[0];delta={x:touches.pageX-start.x,y:touches.pageY-start.y}
if(typeof isScrolling=='undefined'){isScrolling=!!(isScrolling||Math.abs(delta.x)0||index==slides.length-1&&delta.x<0)?(Math.abs(delta.x)/width+1):1);translate(index-1,delta.x+slidePos[index-1],0);translate(index,delta.x+slidePos[index],0);translate(index+1,delta.x+slidePos[index+1],0);}}},end:function(event){var duration=+new Date-start.time;var isValidSlide=Number(duration)<250&&Math.abs(delta.x)>20||Math.abs(delta.x)>width/2;var isPastBounds=!index&&delta.x>0||index==slides.length-1&&delta.x<0;if(options.continuous)isPastBounds=false;var direction=delta.x<0;if(!isScrolling){if(isValidSlide&&!isPastBounds){if(direction){if(options.continuous){move(circle(index-1),-width,0);move(circle(index+2),width,0);}else{move(index-1,-width,0);}
move(index,slidePos[index]-width,speed);move(circle(index+1),slidePos[circle(index+1)]-width,speed);index=circle(index+1);}else{if(options.continuous){move(circle(index+1),width,0);move(circle(index-2),-width,0);}else{move(index+1,width,0);}
move(index,slidePos[index]+width,speed);move(circle(index-1),slidePos[circle(index-1)]+width,speed);index=circle(index-1);}
options.callback&&options.callback(index,slides[index]);}else{if(options.continuous){move(circle(index-1),-width,speed);move(index,0,speed);move(circle(index+1),width,speed);}else{move(index-1,-width,speed);move(index,0,speed);move(index+1,width,speed);}}}
element.removeEventListener('touchmove',events,false)
element.removeEventListener('touchend',events,false)},transitionEnd:function(event){if(parseInt(event.target.getAttribute('data-index'),10)==index){if(delay)begin();options.transitionEnd&&options.transitionEnd.call(event,index,slides[index]);}}}
setup();if(delay)begin();if(browser.addEventListener){if(browser.touch)element.addEventListener('touchstart',events,false);if(browser.transitions){element.addEventListener('webkitTransitionEnd',events,false);element.addEventListener('msTransitionEnd',events,false);element.addEventListener('oTransitionEnd',events,false);element.addEventListener('otransitionend',events,false);element.addEventListener('transitionend',events,false);}
window.addEventListener('resize',events,false);window.addEventListener('orientationchange',events,false);}else{window.onresize=function(){setup()};}
return{setup:function(){setup();},slide:function(to,speed){stop();slide(to,speed);},prev:function(){stop();prev();},next:function(){stop();next();},getPos:function(){return index;},getNumSlides:function(){return length;},kill:function(){stop();element.style.width='auto';element.style.left=0;var pos=slides.length;while(pos--){var slide=slides[pos];slide.style.width='100%';slide.style.left=0;if(browser.transitions)translate(pos,0,0);}
if(browser.addEventListener){element.removeEventListener('touchstart',events,false);element.removeEventListener('webkitTransitionEnd',events,false);element.removeEventListener('msTransitionEnd',events,false);element.removeEventListener('oTransitionEnd',events,false);element.removeEventListener('otransitionend',events,false);element.removeEventListener('transitionend',events,false);window.removeEventListener('resize',events,false);window.removeEventListener('orientationchange',events,false);}
else{window.onresize=null;}}}}
if(window.jQuery||window.Zepto){(function($){$.fn.Swipe=function(params){return this.each(function(){$(this).data('Swipe',new Swipe($(this)[0],params));});}})(window.jQuery||window.Zepto)};;
/* Source and licensing information for the above line(s) can be found at http://images.medicaldaily.com/sites/all/libraries/swipe/swipe2.js. */
/* Source and licensing information for the line(s) below can be found at http://images.medicaldaily.com/sites/all/modules/modules-custom/ibtg/ibtg_slideshow/ibtg_slideshow.js. */
var is_touch_device='ontouchstart'in document.documentElement;var ads_updating=false;function updateAds(){if(typeof googletag!='undefined'){googletag.cmd.push(function(){googletag.pubads().refresh()});}}
function updateStats(curIndex){$document_title=document.title.split('|');if(typeof Webtrends!=undefined){Webtrends.multiTrack({args:{"DCS.dcsuri":window.location.href+"?slide="+curIndex,"WT.ti":$document_title[0]+' - Slide - '+curIndex}});}
if(typeof _gaq!='undefined'){_gaq.push(['_trackPageview',window.location.href+"?slide="+curIndex]);}
if(typeof clicky!='undefined'){clicky.log(window.location.href+"?slide="+curIndex,$document_title[0]+' - Slide - '+curIndex);}}
function carouselInit(carousel,start_num){carousel.addClass('init');if(!start_num)start_num=1;if(is_touch_device){carousel.addClass('touch-device');}
if(carousel.hasClass('single-image')){return false;}
var carousel_thumbs=jQuery('.carousel-thumbs');var swipe=new Swipe(carousel.get(0),{startSlide:start_num-1,speed:400,auto:0,stopPropagation:true,callback:function(index,elem){var classes=jQuery(elem).attr('class').split(" ");for(i=0;i-1){var slide_num=parseInt(class_each.replace('item-',''));}}
carousel.find('.index .position').text(slide_num);carouselAdjustHeight(carousel,slide_num);carousel.find('.carousel-index .position').text(slide_num);var hash_url='#slide/'+slide_num;window.location.hash=hash_url;index=slide_num-1;if(carousel.find('.carousel-pager').length>0){carousel.find('.pager-btn').removeClass('pager-btn-active');carousel.find('.pager-btn-'+(index+1)).addClass('pager-btn-active');}
if(carousel.hasClass('update-ads')){updateAds();}
if(carousel_thumbs.find('.thumb-btn').length>0){carousel_thumbs.find('.thumb-btn').removeClass('thumb-active');carousel_thumbs.find('#thumb-btn-'+(index+1)).addClass('thumb-active');var thumb_page=Math.ceil((index+1)/5)-1;carouselThumbsGoto(thumb_page);}
updateStats(index+1);}});carousel.data('swipe',swipe);carousel.find('.carousel-next').click(function(){carousel.data('swipe').next();});carousel.find('.carousel-prev').click(function(){carousel.data('swipe').prev();});if(carousel.find('.pager-btn').length>0){carousel.find('.pager-btn').click(function(){carousel.find('.pager-btn').removeClass('pager-btn-active');jQuery(this).addClass('pager-btn-active');carousel.data('swipe').slide(jQuery(this).index());});}}
function carouselAdjustHeight(carousel,index){if(carousel.hasClass('adjust-height')){var control_height=0;var control=carousel.find('.control');if(carousel.hasClass('add-control-height')&&control.length>0){control_height=control.height();}
var div_height=carousel.find('.carousel-items .item-'+index).height()+control_height;carousel.animate({'height':div_height},200);}
if(carousel.hasClass('adjust-control-height')){carousel.find('.control').height(carousel.find('.carousel-items .item-'+index+' .image').height());}}
function carouselThumbsInit(){jQuery('.carousel-thumbs-wrap').each(function(){var carousel_thumbs=jQuery(this);var carousel=jQuery('.carousel');var swipe=new Swipe(carousel_thumbs.get(0),{startSlide:0,speed:400,auto:0,stopPropagation:true,});carousel_thumbs.data('swipe',swipe);carousel_thumbs.find('.carousel-thumbs-next').click(function(){carousel_thumbs.data('swipe').next();carouselThumbsRefresh(carousel,carousel_thumbs);});carousel_thumbs.find('.carousel-thumbs-prev').click(function(){carousel_thumbs.data('swipe').prev();carouselThumbsRefresh(carousel,carousel_thumbs);});carouselThumbsRefresh(carousel,carousel_thumbs);});}
function carouselThumbsGoto(num){jQuery('.carousel-thumbs-wrap').each(function(){var carousel_thumbs=jQuery(this);var swipe=new Swipe(carousel_thumbs.get(0),{startSlide:0,speed:400,auto:0,stopPropagation:true,});carousel_thumbs.data('swipe',swipe);carousel_thumbs.data('swipe').slide(num);});}
function carouselThumbsRefresh(carousel,carousel_thumbs){carousel_thumbs.find('.thumb-btn').click(function(){var div_id=jQuery(this).attr('id');$div_num=div_id.split('thumb-btn-');carousel_thumbs.find('.thumb-btn').removeClass('thumb-btn-active');jQuery(this).addClass('thumb-btn-active');carousel.data('swipe').slide($div_num[1]-1);});}
jQuery(document).ready(function(){carouselReady();if(jQuery('.carousel-thumbs-wrap').length>0){jQuery('.carousel-thumbs-wrap').each(function(){carouselThumbsInit();});}});jQuery(document).on('lazyload',function(){carouselReady();});function carouselReady(){if(jQuery('.carousel:not(.init)').length>0){jQuery('.carousel').each(function(){var carousel=jQuery(this);carousel.find('.image:first img').one('load',function(){if(window.location.hash.indexOf('#slide/')>-1){var urlParts=window.location.hash.split('/');var start=urlParts[1];}
carouselInit(carousel,start);carousel.find('.carousel-index .position').text(start);}).each(function(){if(this.complete)jQuery(this).load();});});}};;
/* Source and licensing information for the above line(s) can be found at http://images.medicaldaily.com/sites/all/modules/modules-custom/ibtg/ibtg_slideshow/ibtg_slideshow.js. */
/* Source and licensing information for the line(s) below can be found at http://images.medicaldaily.com/sites/all/modules/modules-custom/ibtg/ibtg_slideshow/js/ibtg_slideshow_big_shots.js. */
(function($){$(document).ready(function(){var $bigshot;var $bigshotOverlay;var bigshotViewCount=0;var ads_updating=false;var swipe='';var imageNode='';var imageNodeFixed='';var bigshotsContent;$('.big-shots').on('click','.cover',function(){$bigshot=$(this).closest('.big-shots');var data_slide_num=0;if($bigshot.attr('data-slide-num')>0)data_slide_num=$bigshot.attr('data-slide-num');if($bigshot.attr('data-id')=='front_page'||(document.URL.indexOf('/node/')>-1&&parseInt($bigshot.attr('data-id'))=='NaN')){var cur_url=document.URL.split('/node/');imageNode=cur_url[1];imageNodeFixed=imageNode;}
loadBigShots($bigshot.attr('data-id'),data_slide_num);return false;});function loadBigShots(nid,slideNumber){var window_height=$(window).height();$('body').css('height',window_height);$('body').addClass('noscroll');bigshotViewCount=0;$bigshot=$('.big-shots[data-id*="'+nid+'"]');var useAjaxLoad=$bigshot.attr('data-path');if(useAjaxLoad){var ajaxBigShotsURL=useAjaxLoad+nid+'/'+$bigshot.attr('revision');if(imageNodeFixed)ajaxBigShotsURL='/ajax/bigshots/image_node/'+imageNodeFixed;var html=$bigshot.find('.content').html();if(html==''){$.ajax({"type":"GET","dataType":"jsonp","jsonpCallback":"jsonCallback","url":ajaxBigShotsURL,"success":function(data){bigshotsContent=data.html;loadBigShotsAppend(nid,slideNumber);}});}else{loadBigShotsAppend(nid,slideNumber);}}}
function loadBigShotsAppend(nid,slideNumber){$('body').append('');$('body').append('');$bigshotContent=$('#big-shots-content');$bigshotOverlay=$('#big-shots-overlay');$bigshotOverlay.fadeIn(200,function(){$bigshotContent.empty().html(bigshotsContent).fadeIn(200,function(){loadBigShotsSlide(slideNumber);});});}
function loadBigShotsSlide(slideNumber){slideNumber=parseInt(slideNumber);var total=$bigshotContent.find('.sets .set').length;var slide=$bigshotContent.find('.sets .set').eq(slideNumber);if(slide.hasClass('current')){return;}
var prevSlide=slide.prev();var nextSlide=slide.next();if(nextSlide.length==0){nextSlide=$bigshotContent.find('.sets .set').eq(0)}
if(prevSlide.length==0){prevSlide=$bigshotContent.find('.sets .set').eq(total-1)}
$bigshotContent.find('.sets .set').removeClass('current');slide.addClass('current');$bigshotContent.find('.nav .current, .counter .current').html(slideNumber+1);$bigshotContent.find('.slide .image-container').html('');$bigshotContent.find('.slide .caption').html(slide.find('.description').html());$bigshotContent.find('.slide .credit').html(slide.find('.credit').html());$bigshotContent.find('.slide .article_text').html(slide.find('.title_text').html());$bigshotContent.find('.slide .slide_title').html(slide.find('.title_text').html());var type_bigshot=$bigshotContent.find('.slide h1 strong').html();if(type_bigshot){$bigshotContent.find('.slide h1 .article_title').html(slide.find('.title_text').html());$bigshotContent.find('.slide .row .article_title').html(slide.find('.title_text').html());$bigshotContent.find('.bigshots-subtitle').html(slide.find('.title_text').html());}else{$bigshotContent.find('.slide .row .article_title').html('');$bigshotContent.find('.slide .row .article_title').css('margin-bottom','0');$bigshotContent.find('.bigshots-subtitle').html(slide.find('.title_text').html());}
var hash_url='#big-shots/'+$bigshot.attr('data-id')+'/'+slideNumber;if(slide.find('.node_slide').html()&&$bigshot.attr('data-id')=='front_page')imageNode=slide.find('.node_slide').html();if(imageNode)hash_url+='/'+imageNode;window.location.hash=hash_url;swipe=new Swipe($bigshotContent.find('.swipe').get(0),{startSlide:1,speed:400,auto:0,continuous:false,stopPropagation:true,transitionEnd:function(index,elem){var next=slideNumber;if(index==0){next=slideNumber-1;}
else if(index==2){next=slideNumber+1;}
if(next<0){next=total-1;}
else if(next>=total){next=0;}
loadBigShotsSlide(next);}});var nid=$bigshot.attr('data-id');var title=$bigshot.find('.cover .title').html();var node_url=slide.find('.node_url').html();var article_title=slide.find('.title_text').html();var article_description=slide.find('.description').html();var host='http://'+window.location.host;var share_url=host+node_url+'#big-shots/'+nid+'/'+slideNumber;if(nid=='front_page')share_url=host+node_url;if($('.social-share').length>0){$('.social-share').html($('.addthis_toolbox_'+nid)[0].outerHTML);$('.addthis_toolbox_'+nid+' .addthis_button_twitter').html('').attr('tw:url',share_url);$('.addthis_toolbox_'+nid+' .addthis_button_facebook').html('').attr('fb:like:href',share_url);$('.addthis_toolbox_'+nid+' .addthis_button_google_plusone_share').html('').attr('g:plusone:href',share_url);$('.addthis_toolbox_'+nid+' .addthis_button_tweet').html('').attr('tw:url',share_url);$('.addthis_toolbox_'+nid+' .addthis_button_facebook_like').html('').attr('fb:like:href',share_url);$('.addthis_toolbox_'+nid+' .addthis_button_google_plusone').html('').attr('g:plusone:href',share_url);$('.addthis_toolbox_'+nid+' .addthis_button_linkedin_counter').html('').attr('addthis:url',share_url);$('.addthis_toolbox_'+nid+' .addthis_button_email').html('').attr('addthis:url',share_url);$('.addthis_toolbox_'+nid).attr('addthis:url',share_url);$('.addthis_toolbox_'+nid).attr('addthis:title',article_title);$('.addthis_toolbox_'+nid).attr('addthis:description',article_description);addthis.toolbox('.addthis_toolbox_'+nid);setTimeout(function(){$('.addthis_toolbox_'+nid+' .flyout>iframe').remove();},1000);}
if($('.bigshots-share').length>0){var medias=['facebook','twitter','tumblr'];$.each(medias,function(key,value){element=$('.bigshots-share .'+value);if(element.length){url=element.attr('data-href');url=url.replace('URL',encodeURIComponent(share_url));element.attr('href',url);}});}
bigshotViewCount++;if(bigshotViewCount>=700000){bigshotViewCount=0;showAd();}else if(bigshotViewCount<0){}else{updateBigShotsAds('Right1',$bigshotContent.find('.slide .ad'));updateBigShotsAdsTracking(bigshotViewCount);$.event.trigger({type:'dynamicdfp',positions:['right']});}}
$('body').on('click','#big-shots-content .next',function(){var next=parseInt($bigshotContent.find('.sets .set.current').index())+1;var total=$bigshotContent.find('.sets .set').length;if(next>=total){next=0;}
if(swipe!=''){swipe.next();}
else{loadBigShotsSlide(next);}});$('body').on('click','#big-shots-content .previous',function(){var next=parseInt($bigshotContent.find('.sets .set.current').index())-1;var total=$bigshotContent.find('.sets .set').length;if(next<0){next=total-1;}
if(swipe!=''){swipe.prev();}
else{loadBigShotsSlide(next);}});$('body').on('click','#big-shots-content .all',function(){$bigshotContent.find('.nav-slides').hide();$bigshotContent.find('.thumbs').show().find('.image').each(function(){var $image=$(this);if($image.find('img').length==0){var thumbUrl=$image.html();$image.html('');}});if($('.bigshots-toggle').hasClass('active')){$('.bigshots-toggle').removeClass('active').text('Thumbnails');$bigshotContent.find('.thumbs').hide();$bigshotContent.find('.nav-slides').show();$bigshotContent.find('.counter').removeClass('toggle');}
else{$('.bigshots-toggle').addClass('active').text('Slideshow');$bigshotContent.find('.counter').addClass('toggle');}});$('body').on('click','#big-shots-content .bigshots-close',function(){closeBigShots();});$('#big-shots-content .share-toggle').click(function(){if($(this).hasClass('active')){$(this).removeClass('active').parent().removeClass('expand');}
else{$(this).addClass('active').parent().addClass('expand');}});$('body').on('click','#big-shots-content .nav-slides > .close',function(){closeBigShots();});$('body').on('click','#big-shots-content .thumbs .image',function(){$bigshotContent.find('.thumbs').hide();$bigshotContent.find('.nav-slides').show();$bigshotContent.find('.counter').removeClass('toggle');$bigshotContent.find('.all').removeClass('active');if($(this).parent('figure')){loadBigShotsSlide($(this).parent('figure').index());}else{loadBigShotsSlide($(this).index());}});$('body').on('click','#big-shots-content .thumbs .close',function(){$bigshotContent.find('.thumbs').hide();$bigshotContent.find('.nav-slides').show();});$('body').on('click','#big-shots-content .continue',function(){closeAd();bigshotViewCount=1;});function closeBigShots(){$('body').css('height','');if(imageNodeFixed){imageNodeFixed='';$('.big-shots .content').html('');}
$('body').removeClass('noscroll');window.location.hash='';$bigshotContent.remove();$bigshotOverlay.remove();history.pushState("",document.title,window.location.pathname);window.scrollTo(0,$('.big-shots').offset().top);}
function showAd(){$bigshotContent.find('.nav-slides').hide();$bigshotContent.find('.box-message').show();updateBigShotsAds('Right1',$bigshotContent.find('.oas-ad-container'));updateBigShotsAdsTracking(bigshotViewCount);}
function closeAd(){$bigshotContent.find('.nav-slides').show();$bigshotContent.find('.box-message').hide();}
$('body').on('click','#big-shots-content .share',function(){$bigshotContent.find('.social-share').toggleClass('hidden-xs');$bigshotContent.find('.share').toggleClass('active');});function updateBigShotsAds(listpos,pos){if(typeof OAS_sitepage=='undefined'){return false;}
if(!ads_updating){ads_updating=true;var positions=listpos.split(',');var rnds=new String(Math.random());rnds=rnds.substring(2,11);var url='http://oascentral.ibtimes.com/RealMedia/ads/adstream_mjx.ads/'+OAS_sitepage+'/'+rnds+'@'+listpos+'?';jQuery.ajax({url:url,dataType:"script",cache:true,success:function(){jQuery.each(positions,function(key,position){pos=position.toLowerCase();var oas_data1='OAS_AD(\''+position+'\');<\/SCRIPT>';var el=jQuery('#big-shots-content .oas-'+pos);el.writeCapture().html(oas_data1);});}});ads_updating=false;}}
function updateBigShotsAdsTracking(index){var document_title=document.title.split('|');if(typeof Webtrends!='undefined'){Webtrends.multiTrack({args:{"DCS.dcsuri":window.location.href+"?slide="+index,"WT.ti":document_title[0]+' - '+index}});}
if(typeof _gaq!='undefined'){_gaq.push(['_trackPageview',window.location.href+"?slide="+index]);}
if(typeof clicky!='undefined'){clicky.log(window.location.href+"?slide="+index,document_title[0]+' - '+index);}}
function calculateSlideNumber(current,direction){var total=$bigshotContent.find('.sets .set').length;if(direction=='next'){var next=parseInt($bigshotContent.find('.sets .set.current').index())+1;if(next>=total){next=0;}}else if(direction=='prev'){var next=parseInt($bigshotContent.find('.sets .set.current').index())-1;if(next<0){next=total-1;}}
return next;}
$('body').on('click','#big-shots-content .image-container',function(e){var width=$(this).width();var current=parseInt($bigshotContent.find('.sets .set.current').index());if((width/2)-1&&$bigshotContent.find('.box-message').is(':hidden')){if(swipe!=''){if(e.keyCode==37){swipe.prev();}
else if(e.keyCode==39){swipe.next();}}
else{loadBigShotsSlide(next);}}}});if(window.location.hash.indexOf('#big-shots/')>-1){var urlParts=window.location.hash.split('/');var nid=urlParts[1];var slideNumber=urlParts[2];if(nid=='front_page'){slideNumber=0;imageNode=urlParts[3];imageNodeFixed=imageNode;}
loadBigShots(nid,slideNumber);}
if(typeof Drupal.settings.ibtg_slideshow!='undefined'){if(Drupal.settings.ibtg_slideshow.type=='rc-bigshots'){var slideNumber=0;$bigshot=$('.big-shots').closest('.big-shots');var nid=$bigshot.attr('data-id');var hash_url='#big-shots/'+nid+'/'+slideNumber;window.location.hash=hash_url;$('body').append('');$('body').append('');$bigshotContent=$('#big-shots-content');$bigshotOverlay=$('#big-shots-overlay');loadBigShotsSlide(slideNumber);}}});})(jQuery);;;
/* Source and licensing information for the above line(s) can be found at http://images.medicaldaily.com/sites/all/modules/modules-custom/ibtg/ibtg_slideshow/js/ibtg_slideshow_big_shots.js. */