document.documentElement.className = 'js'; $.extend({URLEncode:function(c){var o='';var x=0;c=c.toString();var r=/(^[a-zA-Z0-9_.]*)/; while(x1 && m[1]!=''){o+=m[1];x+=m[1].length; }else{if(c[x]==' ')o+='+';else{var d=c.charCodeAt(x);var h=d.toString(16); o+='%'+(h.length<2?'0':'')+h.toUpperCase();}x++;}}return o;}, URLDecode:function(s){var o=s;var binVal,t;var r=/(%[^%]{2})/; while((m=r.exec(o))!=null && m.length>1 && m[1]!=''){b=parseInt(m[1].substr(1),16); t=String.fromCharCode(b);o=o.replace(m[1],t);}return o;} }); document.documentElement.className = 'js'; $(document).ready(function(){ //REMOVING THE LAST COMMA FROM CPES FAKE BYLINE $(".noc").each(function() { var str; str = $(this).text(); str = str.substr(0,(str.length)-2); $(this).text(str); }); //HIDING EXTRA MENU ITEMS $("div#sidebar2_all div.subMenu").each(function() { var listItems = $(this).find("ul li a"); for(var i = 0; i < listItems.length + 1; i++) { if (i > 6 ) { $(this).find("ul li:nth-child("+i+")").addClass("hidden"); $(".viewall").removeClass("hidden"); } } }); //CPE menus function MenuVal(q,s){ $("#Select"+s).val(q); } $("#btn_submit_cpe").click(function () { var q = $("#Select5").val(); var expert = $("#Select1").val(); var practice = $("#Select2").val(); var type = $("#Select4").val(); window.location = "66.htm?start=0&q=" + q + "&expert=" + expert + "&practice=" + practice + "&type=" + type });$(".subMenu").css({'display' : 'none'}); $("#Nav_Right > li > a").click(function(){ $(this).next("div.subMenu").toggle(); return false; }); $("ul#Nav_Right > li").each(function() { //skip the header with firstBlue class if ( $(this).attr("class") == "firstBlue" ) { return "continue"; } if ( $(this).find("div.subMenu > ul > li").size() <= 1 ) { if ($(this).find("div.subMenu > ul > li.viewall").size() > 0) { $(this).hide(); } else if ( ($(this).find("div.subMenu > ul > li.viewall").size() == 0) && ($(this).find("div.subMenu > ul > li").size() == 1) ){ return "continue"; } else { $(this).hide(); } } }); //hide header with firstblue class if list under it is empty if ( $("ul#Nav_Right > li:not(:hidden) ").size() >= 2 ) { //do nothing } else { $("ul#Nav_Right > li.firstBlue").hide(); } //NERA 50th FancyBoxes $("a#timeline").fancybox({ 'width' : 890, 'height' : 290, 'overlayOpacity' : 0.3});$("#con_Nav").css({'zIndex':'1000'}); $("#con_Nav > ul > li > ul").css({'margin-top':'5px'}); $("#con_Nav > ul > li").hover( function(){ //$(this).children("ul").cildren("li").css({'padding-top':'7px'}); $(this).children("ul").show(); }, function(){ $("#con_Nav > ul > li > ul").hide(); } ); //chooses the type of search experts vs site $("#search-submit").click(function () { if ($("input[@name='group1']:checked").val() == "experts") { window.location = "http://www.nera.com/Experts.htm?" + "submitExp=Submit&keyword=" + $("#search1").val(); } else { var myval = $("#search1").val(); window.location = "http://www.nera.com/Search.htm?start=0&q=" + escape(myval) } }); $('#search1').keyup(function(e) { if(e.keyCode == 13) { if ($("input[@name='group1']:checked").val() == "experts") { window.location = "http://www.nera.com/Experts.htm?" + "submitExp=Submit&keyword=" + $("#search1").val(); } else { var myval = $("#search1").val(); window.location = "http://www.nera.com/Search.htm?start=0&q=" + escape(myval) } } }); function PubSearch(){ var q = $("#qps").val(); var ty = "Publication"; var pt = $("#Select1").val(); var dt = $("#Select2").val(); var au = $("#Select3").val(); var pa = $("#pa").val(); var fa = $("select[name='farea']:visible").val(); var findex = $("#findex").val(); var pindex = $("#pindex").val(); var aindex = $("#aindex").val(); if(fa == null){ var fa = "" } var pafa = pa + ":" + fa window.location = "67_208.htm?start=0&q=" + q + "&ty=" + ty + "&pt=" + pt + "&dt=" + dt + "&au=" + au + "&pafa=" + pafa + "&findex=" + findex + "&pindex=" + pindex + "&aindex=" + aindex } $("#qps").keyup(function(e) { if(e.keyCode == 13) { PubSearch(); } }); $("#btn_submit_pub").click(function () { PubSearch(); }); //re-encodes double quotes in text box if they are present if ($("#qps, #q").length){ $("#qps, #q").val( $("#qps, #q").val().replace(/%22/g,'"') ); } //Clear the search box text $("#search1").focus(function () { $(this).val(""); }); //Hide extra Experts var myList = $(".rightExp").children("li"); for(var i = 0; i < myList.length + 1; i++) { if(i > 7) {$(".rightExp li:nth-child("+i+")").addClass("hidden"); $(".viewall").removeClass("hidden"); } } //HIDING EXTRA MENU ITEMS $("div#sidebar2_all div.subMenu").each(function() { var listItems = $(this).find("ul li a"); for(var i = 0; i < listItems.length + 1; i++) { if (i > 6 ) { $(this).find("ul li:nth-child("+i+")").addClass("hidden"); $(".viewall").removeClass("hidden"); } } });////CHANGING DATE FORMAT //parsing a string (YYYY-MM-DD) to a date object function parseISO8601(dateStringInRange) { var isoExp = /^\s*(\d{4})-(\d\d)-(\d\d)\s*$/, date = new Date(NaN), month, parts = isoExp.exec(dateStringInRange); if(parts) { month = +parts[2]; date.setFullYear(parts[1], month - 1, parts[3]); if(month != date.getMonth() + 1) { date.setTime(NaN); } } return date; } //setting a prototype with a new date format Date.prototype.toSpecialString = function () { return [ this.getDate(), ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] [this.getMonth()], this.getFullYear() ].join(' ') } function isDate (x) { return (null != x) && !isNaN(x) && ("undefined" !== typeof x.getDate); } function changeDateFormat(wrong_date_format) { var new_date = parseISO8601(wrong_date_format); if ( isDate(new_date) == false ) { new_date=""; } else { new_date = new_date.toSpecialString(); } return new_date; } //looping through all dates with .date class $(".date").each(function(index) { $(this).text( changeDateFormat( $(this).text() ) ); }); //FIXING PUBLICATION SEARCH DROPDOWNS & SAVING SEARCH TERMS function showFocusArea() { //index of the selected element var cur_index = $("#pa option").index($("#pa option:selected")); //clearing up the dropdown list $("select#farea").html(''); //creating new option elements and inserting them into the Focus Area dropdown $("ul.hidden li." + cur_index).each(function() { var li_value = $(this).text(); $("select#farea").append('"'); }); //showing or hiding caption and dropdown list var fa = $("#pa option:selected").val(); if (fa != "") { $(".fa").show(); $("select#farea").show(); } else { $(".fa").hide(); $("select#farea").hide(); } } $(".fa").hide(); $("#farea").hide(); //SHOWING SEARCH TERMS //POPULATING FORM WITH SELECTED ELEMENTS if (tindex != "") { $("form #title option[selected]").removeAttr("selected"); $("form #title option:nth-child("+(parseFloat(tindex)+1)+")").attr("selected", "selected"); } if (pindex != "") { $("form #pa option[selected]").removeAttr("selected"); $("form #pa option:nth-child("+(parseFloat(pindex)+1)+")").attr("selected", "selected"); showFocusArea(); } else { $(".fa").hide(); } if (findex != "") { //$(".fa").show(); $("form #farea option[selected]").removeAttr("selected"); $("form #farea option:nth-child("+(parseFloat(findex)+1)+")").attr("selected", "selected"); } if (aindex != "") { $("form #Select3 option[selected]").removeAttr("selected"); $("form #Select3 option:nth-child("+(parseFloat(aindex)+1)+")").attr("selected", "selected"); } $("#pa").change(function () { showFocusArea(); }); //Set hidden input values on change of dropdown indexes $("#Select3").change(function () { var aindex = $("#Select3 option").index($("#Select3 option:selected")); $("#aindex").val(aindex); }); $("#pa").change(function () { var tpindex = $("#pa option").index($("#pa option:selected")); $("#pindex").val(tpindex); }); $("#farea").change(function () { var tfindex = $("#farea option").index($("#farea option:selected")); $("#findex").val(tfindex); }); //HIDE RELATED EXPERTS/EDITORS FROM PUBLICATIONS PAGES IF EMPTY $("div#sidebar2_all div.smallFont").each(function() { if ($(this).find("p.rightNavHeader a").size() == 0 ) { $(this).find("p.rightNavHeader").hide(); } }); //RESET BUTTON CLICK jqstandard.js $("form.jqtransform input.btn_clear").click(function() { //clearing CPE search form $("select#expert option:nth-child(1)").attr("selected", "selected"); $("select#type option:nth-child(1)").attr("selected", "selected"); $("select#practice option:nth-child(1)").attr("selected", "selected"); $("input#q").val(""); //clearing Pub search form $("select#Select1 option:nth-child(1)").attr("selected", "selected"); $("select#Select2 option:nth-child(1)").attr("selected", "selected"); $("select#Select3 option:nth-child(1)").attr("selected", "selected"); $("select#pa option:nth-child(1)").attr("selected", "selected"); $("select#title option:nth-child(1)").attr("selected", "selected"); $("select#practice option:nth-child(1)").attr("selected", "selected"); $("select#language option:nth-child(1)").attr("selected", "selected"); $("select#office option:nth-child(1)").attr("selected", "selected"); $("select#farea option:nth-child(1)").attr("selected", "selected"); $("input#pindex").val(""); $("input#findex").val(""); $("input#aindex").val(""); $(".fa").hide(); $("#farea").hide(); }); });