function addCommas(nStr) { nStr += ''; x = nStr.split('.'); x1 = x[0]; x2 = x.length > 1 ? '.' + x[1] : ''; var rgx = /(\d+)(\d{3})/; while (rgx.test(x1)) { x1 = x1.replace(rgx, '$1' + ',' + '$2'); } return x1 + x2; } //anylinkcssmenu.init("menu_anchors_class") ////Pass in the CSS class of anchor links (that contain a sub menu) anylinkcssmenu.init("anchorclass"); anylinkcssmenu.init("ac_top"); jQuery.noConflict(); jQuery(document).ready(function () { jQuery('#storyslider').bxSlider(); // bxSlider theRotator(); $('div.rotator').fadeIn(1000); $('div.rotator ul li').fadeIn(1000); // tweek for IE jQuery("a[rel=image_group]").fancybox({ 'transitionIn' : 'none', 'transitionOut' : 'none', 'titlePosition' : 'over', 'titleFormat' : function(title, currentArray, currentIndex, currentOpts) { return 'Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' ' + title : '') + ''; } }); jQuery("a#ftlink").fancybox({ 'width' : '75%', 'height' : '75%', 'autoScale' : false, 'transitionIn' : 'none', 'transitionOut' : 'none', 'type' : 'iframe' }); jQuery("a[rel=group_cartoon]").fancybox({ 'transitionIn' : 'none', 'transitionOut' : 'none', 'titlePosition' : 'over', 'titleFormat' : function(title, currentArray, currentIndex, currentOpts) { return 'Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' ' + title : '') + ''; } }); jQuery("a#poll_link").fancybox({ 'width' : '45%', 'height' : '55%', 'autoScale' : false, 'transitionIn' : 'none', 'transitionOut' : 'none', 'type' : 'iframe' }); jQuery("a#subscribelogin").fancybox({ 'width' : '25%', 'height' : '25%', 'autoScale' : true, 'transitionIn' : 'none', 'transitionOut' : 'none', 'type' : 'iframe' }); //weather feed top //jQuery('#weather').weatherfeed(['JMXX0002']); jQuery('#kgn').weatherfeed(['JMXX0002']); jQuery('#mbj').weatherfeed(['JMXX0003']); jQuery('#ngrl').weatherfeed(['JMXX0009']); jQuery('#ochi').weatherfeed(['JMXX0005']); jQuery('#spntwn').weatherfeed(['JMXX0008']); jQuery('#ptanto').weatherfeed(['JMXX0012']); jQuery('#blkrvr').weatherfeed(['JMXX0010']); jQuery('#flmth').weatherfeed(['JMXX0001']); jQuery('#chrsta').weatherfeed(['JMXX0011']); //accordion jQuery(function(){ jQuery(".accordiono h3").eq(0).addClass("active"); jQuery(".content").eq(0).show(); jQuery(".accordiono h3").click(function(){ jQuery(this).next(".content").slideToggle(400) .siblings(".content:visible").slideUp(400); jQuery(this).toggleClass("active"); jQuery(this).siblings("h3").removeClass("active"); }); }); //twitter jQuery("#tweetr").click(function(){ jQuery("#twitter").getTwitter({ userName: "jamaicaobserver", numTweets: 15, loaderText: "Loading tweets...", slideIn: true, slideDuration: 750, showHeading: false, headingText: "Latest Tweets", showProfileLink: true, showTimestamp: true }); }); //full page ad jQuery("a#fullscreen").fancybox({ 'width' : '80%', 'height' : '95%', 'autoScale' : false, 'transitionIn' : 'elastic', 'transitionOut' : 'elastic', 'type' : 'iframe' }); jQuery('.sexy-bookmarks a.external').attr("target", "_blank"); var sexyBaseHeight=jQuery('.sexy-bookmarks').height(); var sexyFullHeight=jQuery('.sexy-bookmarks ul.socials').height(); if (sexyFullHeight>sexyBaseHeight) { jQuery('.sexy-bookmarks-expand').hover( function() { jQuery(this).animate({ height: sexyFullHeight+15+'px'}, {duration: 200, queue: false}); }, function() { jQuery(this).animate({ height: sexyBaseHeight+'px'}, {duration: 200, queue: false}); } ); } // autocentering // if (jQuery('.sexy-bookmarks-center')) { var sexyFullWidth=jQuery('.sexy-bookmarks').width(); var sexyBookmarkWidth=jQuery('.sexy-bookmarks:first ul.socials li').width(); var sexyBookmarkCount=jQuery('.sexy-bookmarks:first ul.socials li').length; var numPerRow=Math.floor(sexyFullWidth/sexyBookmarkWidth); var sexyRowWidth=Math.min(numPerRow, sexyBookmarkCount)*sexyBookmarkWidth; var sexyLeftMargin=(sexyFullWidth-sexyRowWidth)/2; jQuery('.sexy-bookmarks-center').css('margin-left', sexyLeftMargin+'px'); } //ad floater alwaysOnTop.init({ targetid: 'mediakitad', orientation: 3, position: [0, 400], fadeduration: [1000, 1000], frequency: 0.95 //hideafter: 15000 }); //ad floater for easter cookbook alwaysOnTop.init({ targetid: '300x600_ad', orientation: 2, position: [770, 350] //hideafter: 20000, //externalsource: '/www/cookbookad.html' }); }); jQuery(".swShowPage").click(function(event){ //prevent the default action for the click event event.preventDefault(); //get the full url - like mysitecom/index.htm#home var full_url = this.href; //split the url by # and get the anchor target name - home in mysitecom/index.htm#home var parts = full_url.split("#"); var trgt = parts[1]; //get the top offset of the target anchor var target_offset = jQuery("#"+trgt).offset(); var target_top = target_offset.top; //goto that anchor by setting the body scroll top to anchor top jQuery('html, body').animate({scrollTop:target_top}, 500); });