/* all NEA.org pages use nea.js */ var NEA = {}; // flash constructor NEA.Fla = function(file, h){ this.file = file; this.h = h; } NEA.Fla.prototype.place = 'banner'; // different ones, have to change these to .prototype // (and change usage below to point at the object instance) NEA.Fla.w = 960; NEA.Fla.path = "/nav/images"; // collection of objects NEA.flash = { academy: new NEA.Fla("NEA_Academy_Flash.swf",184), assoc: new NEA.Fla("NEA_Association_Flash.swf",199), org: new NEA.Fla("NEA_org_Flash.swf",239), working: new NEA.Fla("NEA_Working_Flash.swf",184), tour: new NEA.Fla("NEA_Tour.swf",409), queue : [] } // different place NEA.flash['tour'].place = 'tour-swf'; // collect these from the calling page NEA.writeFlash = function(idx){ NEA.flash.queue[NEA.flash.queue.length] = idx; } NEA.png = {}; // courtesy of http://ajaxcookbook.org/png-alpha-transparency/ NEA.png.createPNGImage = function(src, width, height) { if (navigator.userAgent.indexOf("MSIE") != -1) { var element = document.createElement("div"); element.style.filter = "progid:DXImageTransform.Microsoft." + "AlphaImageLoader(src='" + src + "')"; // element.style.filters(1) = "DXImageTransform.Microsoft.Alpha".Opacity[50]; } else { var element = document.createElement("img"); element.src = src; } element.style.width = width + "px"; element.style.height = height + "px"; return element; } NEA.video = {}; NEA.video.art = { path: "/nav/images", icon: "icon-play.png", loading: "icon-load.gif" }; NEA.video.txt = { close: '
(close)
', mask: '
', box: '

Loading... Loading...

' } NEA.video.set = function(item,tag){ $(item).hover(function(){ $(item).find(tag).addClass('play-over'); },function(){ $(item).find(tag).removeClass('play-over'); }) }; NEA.video.get = function(obj){ $.ajax({ type: "GET", url: $(obj).attr('href'), timeout : 2000, global : false, data : encodeURI(new Date()), // prevent cache error: function(){ $('#icon-load').empty().append('Loading movie failed. If this continues, please contact NEA for assistance.').addClass('vid-error').append(NEA.video.txt.close); }, success: function(data){ //$('#vidlayer').fadeTo("fast",0.5) // broken in 1.1.3 in IE $('#icon-load').remove(); $('#vidbox').html(data); $('#btn-close').click(function(){ NEA.video.close(); }) } }); }; NEA.video.close = function(){ $('#vidlayer').remove(); $('#vidbox').remove(); }; NEA.video.addLayer = function(obj){ $('body').append(NEA.video.txt.mask).append(NEA.video.txt.box).find('#vidbox #icon-load').append(NEA.video.txt.close); $('#vidbox').css('top',$().scrollTop() + 20 + 'px'); NEA.video.get(obj); }; $(document).ready(function(){ // ************* all pages // this inserts an empty div to allow dual bg colors $('body').prepend("
<\/div>"); // better styles on HRs $('hr').wrap('
<\/div>'); // remove hr blurb from blurb page where it interferes // note: should not do this type of browser detection, really if (!(parseInt($.browser.version) < 6 && $.browser.msie == true)) { $('.drill hr.blurb').parents("div.hr").remove(); } else { // ie5 only fix for width of nav drop-downs $('link').each(function(){ if ($(this).attr('href').indexOf('academy.css') != -1) { $('body').addClass('academy'); } }) } // last list item cleanup (UI only touch) $("#nav-main li:last-child").addClass("last"); $("#site-info li:last-child").addClass("last"); $("#nav-section li:last-child").addClass("last"); // home pages only $('#content-col-a li:last-child a', $('body.home')).addClass('last'); $('#content-col-b li:last-child a', $('body.home')).addClass('last'); $('#content-rail li:last-child a', $('body.home')).addClass('last'); // all drills $('#nav-utils li:first-child a').addClass('last'); // VIDEO OVERLAYS // compliant browsers $('a.video').each(function(){ var src = $(this).find('img').attr('src'); $(this).find('img').attr('src',NEA.video.art.path + NEA.video.art.icon).addClass('play'); NEA.video.set(this,'img'); $(this).css('backgroundImage','url(' + src + ')').click(function(event){ NEA.video.addLayer(this); event.preventDefault(); }) }); // enable video overlays and pop-up layers for IE only if ($.browser.msie) { $('a.video img.play').remove(); var play = NEA.png.createPNGImage(NEA.video.art.path + NEA.video.art.icon, 57, 57); $('a.video').append(play).find('div').addClass('play') $('a.video').each(function(){ NEA.video.set(this,'div'); }) }; // init drop down menus for browsers which do not support LI hovers // if browser ie statement below not really needed except for testing w/ cc's removed /*@cc_on /*@if (@_jscript_version < 5.7) // ie6 and lower only if ($.browser.msie) { $("#nav-main > li").hover(function(){ $(this).addClass("o"); },function(){ $(this).removeClass("o"); }) } // browsers which don't support child selectors $('#nav-section .sub > a.on').addClass("on-sub"); // handle headers post-blurb $('#content-blurb + h2').addClass('post-blurb'); $('hr.blurb + h2').addClass('post-blurb'); $('#content-blurb + img + h2').addClass('post-img'); // http://www.mister-pixel.com/#Content__state=is_that_simple try { document.execCommand("BackgroundImageCache", false, true); } catch(err) {} /*@end @*/ // test for and activate tabs var tabs = false; if ($('#tab-1').get(0)){ // test for tab script $('#tab-1').tabs(); $('#tab-1 li:gt(0)').addClass('no-edge'); tabs = true; }; // only resize content div height if not on a tab page if (!tabs) { var sectionHeight = 0; var contentHeight = 0; $("#nav-section>li").each(function(){ sectionHeight += $(this).height(); }); contentHeight = $('#content-cols').height(); if (contentHeight < sectionHeight) { sectionHeight = sectionHeight - contentHeight; sectionHeight = contentHeight + sectionHeight; $('#content-cols').css('height',sectionHeight); } } $('a[@rel=external]').after(' '); // Flash objects must be written to the page after the DOM mods or IE6 doesn't fire // jQuery document.ready event /// THEREFORE THIS IF STATEMENT MUST BE LAST IN THE READY BLOCK!!! if (NEA.flash.queue.length > 0) { var x = 0; while (x < NEA.flash.queue.length) { var fla = new SWFObject(NEA.Fla.path + NEA.flash[NEA.flash.queue[x]].file, 'flash'+x, NEA.Fla.w, NEA.flash[NEA.flash.queue[x]].h, '8'); fla.addParam('wmode','transparent'); fla.write(NEA.flash[NEA.flash.queue[x]].place); x++; } } }); /** * From the dimensions plugin: not including the whole thing, too much for too little, but thanks guys * Returns how many pixels the user has scrolled to the bottom (scrollTop). * Works on containers with overflow: auto and window/document. * * @example $("#testdiv").scrollTop() * @result 100 * * @name scrollTop * @type Number * @cat Plugins/Dimensions */ jQuery.fn.scrollTop = function() { if ( this[0] == window || this[0] == document ) return self.pageYOffset || jQuery.boxModel && document.documentElement.scrollTop || document.body.scrollTop; return this[0].scrollTop; };