/** * This is the Code 42 Software application extension to jQuery. jQuery must * already be loaded * This includes: * auth : authentication * url : URL manipulation routines * safe : null-safe value routines * date : date parsing routines * nav : nav routines */ //////////////////////////////////////////////////////////////////////////////// // // Browser validation code - Jquery 1.2.x does *not* work in Safari 2 or older!!! // alert($.browser.safari + $.browser.version); // //////////////////////////////////////////////////////////////////////////////// if ($.browser.safari && $.browser.version < 522) { top.location.href="incompatible.html"; } //////////////////////////////////////////////////////////////////////////////// // // Required native Javascript / JQuery extensions // //////////////////////////////////////////////////////////////////////////////// // Date formatting Date.prototype.format=function(format){var returnStr='';var replace=Date.replaceChars;for(var i=0;i ul > li").each( function() { var anchor = $(this).find("a:first"); $.c42.nav.setClick(this,anchor); $.c42.nav.setHover(this); } ); // Assign home click support $.c42.nav.setClick( $("#home") ); // Customize search box for safari if ($.browser.safari) { $("#search-input").attr("results","5"); } } /** * Selected menu items are set by matching resource */ $.c42.nav.menuInit = function () { var resourceName = $.c42.getResourceName(); var el = $(".menu").find("a[href='" + resourceName +"']:first"); if (el) { // match the element whose href is the current document el.parent("li").addClass("selected"); } // Add hover support // Add click 'anywhere support $(".menu").find("li").each( function() { var anchor=$(this).find("a:first"); $(this).hover( function() { $(this).addClass("hover"); anchor.addClass("hover"); }, function() { $(this).removeClass("hover"); anchor.removeClass("hover"); } ); $.c42.nav.setClick(this,anchor); } ); } /** * Set an item click to the same href as an anchor */ $.c42.nav.setClick = function (item, anchor) { var href = anchor == undefined?"index.html":$(anchor).attr("href"); $(item).click( function() { top.location.href=href; } ); } /** * Assign a hover over effect for list items */ $.c42.nav.setHover = function (item) { if (!$(item).hasClass("selected")) { $(item).hover( function() { $(item).addClass("hover");}, function() { $(item).removeClass("hover");} ); } }