$(document).ready(function(){
// SPECIFY LIGHT BOX STYLES AND LINK RELS FOR COLORBOX
$("a[rel='modalframe']").colorbox({fixedWidth:"80%", fixedHeight:"450", iframe:"true"});
$("a[rel='modalgallery']").colorbox({transition:"elastic", contentCurrent:"{current} / {total}"});
// FEATURE STORY SLIDER
$("#fs-slider").easySlider({controlsBefore: '<p id="fs-controls">',controlsAfter: '</\p>',auto: true, continuous: true, vertical: true, speed: 600, pause: 2800});
$("#fs-slider2").easySlider({controlsBefore: '<p id="fs-controls2">',controlsAfter: '</\p>',auto: true, continuous: false, speed: 600, pause: 2800, prevId: 'prevBtn2', nextId: 'nextBtn2'});
// SMOOTH SCROLLING INITIATION
$('#mag-nav').localScroll();$('#tocontent').localScroll();$('#bg').localScroll();
//PRETTYPHOTO LIGHTBOX INITIATION
$("a[rel^='prettyPhoto']").prettyPhoto();
//MAKE TABLE OF CONTENTS STORY BLOCKS CLICKABLE
$("ul.toc-3col li").click(function(){window.location=$(this).find("a").attr("href");});
$("ul.sections-2col li").click(function(){window.location=$(this).find("a").attr("href");});
$("ul.sb li").click(function(){window.location=$(this).find("a").attr("href");});
//CHECK HASH VALUES FOR MAIN NAVIGATION ANCHORS
var hash = window.location.hash.substr(1);var href = $('#mag-nav li a').each(function(){var href = $(this).attr('href');if(hash==href.substr(0,href.length-5)){var toLoad = hash+'.html #nav-panel-content';$('#nav-panel-content').load(toLoad)}});
// CALL PAGES VIA AJAX AND INSERT INTO MAIN HORIZONTAL NAVIGATION DROP-DOWN PANEL
//$('#mag-nav li a[href$="past-issues.html"]').click(function(){var toLoad = $(this).attr('href')+' #nav-panel-content';$('#nav-panel').slideUp("normal",loadContent);$('#nav-panel-hide').live("click", function(){$('#nav-panel').slideUp("normal");});window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5);function loadContent() {$('#nav-panel').load(toLoad,'',showNewContent())}function showNewContent() {$('#nav-panel').slideDown("normal");}return false;});
// FANCY HORIZONTAL RULES FOR IE TOO!
$("hr").wrap("<div class='hr'></\div>");
//DROP-CAPS FOR ARTICLES
swap_letter();function swap_letter(){var first_paragraph=$('div#lc p.cap')[0];if(!first_paragraph)return false;var node=first_paragraph;while(node.childNodes.length){node=node.firstChild}var text=node.nodeValue;var first_letter=text.substr(0,1);var match=/[a-zA-Z]/.test(first_letter);if(match){node.nodeValue=text.slice(1);$('<img />').attr('src','/sites/magazine/images/alphabet/'+first_letter.toLowerCase()+'.png').attr('alt',first_letter).addClass('drop-cap').prependTo(first_paragraph)}}
});
// CUSTOM FADE IN/FADE OUT TOGGLE FUNCTION CALLED 'fadeToggle()'
jQuery.fn.fadeToggle = function(speed, easing, callback) {return this.animate({opacity: 'toggle'}, speed, easing, callback);
};