function hideShowTabs(n){for(i=0;i<URLArray.length;i++)$("#"+URLArray[i]).removeClass("selected"),$("."+URLArray[i]).hide();formatName=n;n=="Conference"?($("#radio0").click(),$("#bottomDetailContainer").hide()):($("#bottomDetailContainer").show(),$("#NotesContainer").show(),$("#NotesContainer").find("."+formatName).children().length===0&&$("#NotesContainer").hide());$("#"+n).addClass("selected");$("."+n).show();var t=$("#courseofferingdetail").height();$("#sideLeft").height(t);window.location.href.indexOf(formatName)==-1&&history.pushState(null,null,window.location.pathname+"?f="+formatName)}function getURLParameterFormatName(){var t=window.location.search.substring(1),n;return t!==null&&t!==""&&(n=t.split("="),n.length>=2&&n.indexOf("f")!==-1)?n[n.indexOf("f")+1]:""}function PrintBtn(){try{$(".edu_btn_print").length&&$(".edu_btn_print").click(function(){window.location.href="?f="+formatName+"&print=2"})}catch(n){}}function CatchHashLinks(){links=document.getElementsByTagName("a");for(var n=0;n<links.length;n++)(links[n].hash!=""||links[n].href.substr(links[n].href.length-1)=="#")&&links[n].hostname+links[n].pathname==window.location.hostname+window.location.pathname&&(links[n].href="javascript:location.replace('"+links[n].href+"')")}function writeSymposiumDescription(n,t){$("#NotesContainer").show();for(var i=0;i<t;i++)$("#description"+i).hide(),$("#descriptionNotes"+i).hide();$("#description"+n).show();$("#descriptionNotes"+n).show();$("#descriptionNotes"+n).children().length===0&&$("#NotesContainer").hide()}function OnMyScheduleSuccess(n,t){AttachMouseOver(n,t);HighlightPres(n,t)}function AttachMouseOver(n,t){(t==="Add"||t==="All")&&(n=t==="All"?".action a.added":n+" .action a.added",ontext="Delete",offtext="Added",imagebase="//"+window.location.hostname+"/images/app/confdetail/",onimage=imagebase+"ScheduleDelete.png",offimage=imagebase+"ScheduleAdded.png",$(n).hover(function(){$(this).text(ontext).removeClass("added").addClass("modmyschedule").siblings("img").attr("src",onimage)},function(){$(this).text(offtext).removeClass("modmyschedule").addClass("added").siblings("img").attr("src",offimage)}))}function HighlightPres(n,t){t!=="None"&&(t==="Add"?$(n).closest(".presentation").hasClass("highlight")||$(n).closest(".presentation").switchClass("","highlight",2e3):$(n).closest(".presentation").hasClass("highlight")&&$(n).closest(".presentation").switchClass("highlight","",2e3))}function RotateCarousel(){var i=$(".SymposiumContainer").width(),n,t;for($(".SymposiumWrap").animate({right:0}),n=$(".SymposiumContainer"),n.show(),$(n[0]).appendTo(".SymposiumWrap"),$(n).hide(),$(n).find(".VerticalSpacer").hide(),$(n).find(".ConferenceComponent").removeClass("symBorder"),t=1;t<4;t++)$(n[t]).show(),t!=3&&($(n[t]).find(".VerticalSpacer").show(),$(n[t]).find(".ConferenceComponent").addClass("symBorder"))}function initializeCheckBox(n,t,i,r){for(var s,h,f,c,l,e=document.getElementsByName("filter-format"),o=document.getElementsByName("filter-level"),u=0;u<e.length;u++)e[u].checked=!1,CheckSet.formatList.push(0);for(u=0;u<o.length;u++)o[u].checked=!1,CheckSet.levelList.push(0);if(n!="")for(s=n.split(","),f=0;f<s.length;f++)for(u=0;u<e.length;u++)s[f]===e[u].getAttribute("id")&&(e[u].checked=!0,CheckSet.formatList[u]=1);else for(u=0;u<e.length;u++)e[u].checked=!0,CheckSet.formatList[u]=1;if(t!="")for(h=t.split(","),f=0;f<h.length;f++)for(u=0;u<o.length;u++)h[f]===o[u].getAttribute("id")&&(o[u].checked=!0,CheckSet.levelList[u]=1);else for(u=0;u<o.length;u++)o[u].checked=!0,CheckSet.levelList[u]=1;i!=""&&(i.indexOf("&amp;")!=-1?(c=i.split("&amp;").join("&"),document.getElementById("u86_input").namedItem(c).selected=!0,CheckSet.category=c):(document.getElementById("u86_input").namedItem(i).selected=!0,CheckSet.category=i));r!=""&&(r.indexOf("&amp;")!=-1?(l=r.split("&amp;").join("&"),document.getElementById("u89_input").namedItem(l).selected=!0,CheckSet.tia=l):(document.getElementById("u89_input").namedItem(r).selected=!0,CheckSet.tia=r));pageCount=$("#num_resultstop :selected").val();CheckSet.sortPreference=$("#sortBox :selected").val();callAjaxUpdate()}function processCheckChange(n,t){var u,f,r,e,o,i;if(n==="format")for(u=document.getElementsByName("filter-format"),i=0;i<u.length;i++)t===u[i].getAttribute("id")&&(CheckSet.formatList[i]^=1),u[i].checked?GetCookie("format")!=""?GetCookie("format").includes(u[i].getAttribute("id"))||SetCookie("format",GetCookie("format")+","+u[i].getAttribute("id")):SetCookie("format",u[i].getAttribute("id")):(r=GetCookie("format").replace(u[i].getAttribute("id"),""),r.includes(",,")&&(r=r.replace(",,",",")),r.charAt(0)==","&&(r=r.substring(1,r.length)),r.charAt(r.length-1)==","&&(r=r.substring(0,r.length-1)),SetCookie("format",r));else if(n==="level")for(f=document.getElementsByName("filter-level"),i=0;i<f.length;i++)t===f[i].getAttribute("id")&&(CheckSet.levelList[i]^=1),f[i].checked?GetCookie("level")!=""?GetCookie("level").includes(f[i].getAttribute("id"))||SetCookie("level",GetCookie("level")+","+f[i].getAttribute("id")):SetCookie("level",f[i].getAttribute("id")):(r=GetCookie("level").replace(f[i].getAttribute("id"),""),r.includes(",,")&&(r=r.replace(",,",",")),r.charAt(0)==","&&(r=r.substring(1,r.length)),r.charAt(r.length-1)==","&&(r=r.substring(0,r.length-1)),SetCookie("level",r));else if(n==="category"){for(e=document.getElementsByClassName("cat-list"),i=0;i<e.length;i++)if(e[0].selected===!0){CheckSet.category="";SetCookie("category","");break}else if(e[i].selected){CheckSet.category=e[i].id;SetCookie("category",e[i].id);break}}else if(n==="tia")for(o=document.getElementsByClassName("tia-list"),i=0;i<o.length;i++)if(o[i].selected){CheckSet.tia=o[i].id;SetCookie("tia",o[i].id);break}setDefaults();n==="level"||n==="format"?(CheckSet.tia="",callAjaxUpdate()):n==="category"?(document.getElementById("u89_input").namedItem("All-Courses").selected=!0,CheckSet.tia="",callAjaxTIA()):n==="tia"&&callAjaxEducation()}function resetCheckBox(){for(var t,r="",u="",i=document.getElementsByName("filter-format"),n=0;i[n];n++)i[n].checked=!0,CheckSet.formatList[n]=1,r+=i[n].id+",";for(SetCookie("level",u),t=document.getElementsByName("filter-level"),n=0;t[n];n++)t[n].checked=!0,CheckSet.levelList[n]=1,u+=t[n].id+",";SetCookie("format",r);document.getElementById("u86_input").namedItem("All-Courses").selected=!0;CheckSet.category="";SetCookie("category","");document.getElementById("u89_input").namedItem("All-Courses").selected=!0;CheckSet.tia="";SetCookie("tia","");setDefaults();callAjaxUpdate()}function callAjaxEducation(){var n=CheckSet;n.category=n.category.split("-").join(" ");n.tia=n.tia.split("-").join(" ");n.category=n.category.replace("All Courses","");n.tia=n.tia.replace("All Courses","");n.category.split(" ")[0]!=="Optoelectronics"&&n.category.split(" ")[0]!=="Sensing"&&(n.category=n.category.split("and").join("&"));n.tia.split(" ")[0]!=="Optoelectronics"&&n.tia.split(" ")[0]!=="Sensing"&&(n.tia=n.tia.split("and").join("&"));n.category=n.category.replace("Micro Nano","Micro/Nano");n.tia=n.tia.replace("Micro Nano","Micro/Nano");$.ajax({method:"GET",url:"/education/ajax/educationCourses",data:{request:"Results\t"+JSON.stringify(n)}}).done(displayCourses).fail(function(n,t){console.log("Request failed: "+t)})}function callAjaxUpdate(){$.ajax({method:"GET",async:!1,url:"/education/ajax/educationCourses",data:{request:"Categories\t"+JSON.stringify(CheckSet)}}).done(updateCategories).done(callAjaxTIA).fail(function(n,t){console.log("Request failed: "+t)})}function callAjaxTIA(){$.ajax({method:"GET",url:"/education/ajax/educationCourses",data:{request:"TIA\t"+JSON.stringify(CheckSet)}}).done(updateTIA).done(callAjaxEducation).fail(function(n,t){console.log("Request failed: "+t)})}function displayCourses(n){var i,t,r;for($("#resultsContainer").empty(),typeof n=="string"&&(n=JSON.parse(n)),AjaxResults=n,modelSize=AjaxResults.length,displayResultsCounter(),i=currentResults(),sortCourses(),t=0;t<i;t++)$("#resultsContainer").append(DisplayResult(AjaxResults[t]));currentResults()>=modelSize?$("#loadMoreButton").hide():$("#loadMoreButton").show();r=$("#findcourse").height();$("#sideLeft").height(r)}function DisplayResult(n){var r=CheckSet.formatList,i="",u="",f=document.getElementById("SPIE Conference")!=null&&document.getElementById("SPIE Conference").checked,e=document.getElementById("In-Company")!=null&&document.getElementById("In-Company").checked,o=document.getElementById("Online")!=null&&document.getElementById("Online").checked,s=document.getElementById("Course Recording")!=null&&document.getElementById("Course Recording").checked,t;return n.AvailableInCompany&&r[1]?i="InCompany":n.AvailableOnline&&r[2]?i="Online":n.AvailableAtConference&&r[0]?i="Conference":n.AvailableCourseRecording&&r[3]&&(i="CourseRecording"),n.Level===1?u="Introductory":n.Level===2?u="Intermediate":n.Level===3&&(u="Advanced"),t='<div style="display: table; width: 100%; padding: 10px; background: #f2f2f2; border-bottom: 2px solid #fff;"><div style="display: table-cell; width: 108px">'+n.CourseCode+'<\/div><div style="display: table-cell; width: 320px"><a href="/education/courses/coursedetail/'+n.CourseCode+"?f="+i.replace(/ /g,"")+'" class="course-title">'+n.Title+'<\/a><\/div><div style="display: table-cell; width: 30px"><\/div><div style="display: table-cell; width: 100px">'+u+'<\/div><div style="display: table-cell">',n.AvailableAtConference&&f&&(t+="<text>SPIE Conference<br/><\/text>"),n.AvailableInCompany&&e&&(t+="<text>In Company<br/><\/text>"),n.AvailableOnline&&o&&(t+="<text>Online<br/><\/text>"),n.AvailableCourseRecording&&s&&(t+="<text>Course Recording<br/><\/text>"),t+"<\/div><\/div>"}function loadMore(){pageModifier++;displayCourses(AjaxResults)}function displayResultsCounter(){$(".resultsCounterContainer").empty();var n="Showing <b>"+currentResults()+"<\/b> of <b>"+modelSize+"<\/b> Results";$(".resultsCounterContainer").append(n)}function setDefaults(){pageModifier=1}function currentResults(){return modelSize<pageCount*pageModifier?modelSize:pageCount*pageModifier}function setResultSize(){pageCount=$("#num_resultstop :selected").val();displayCourses(AjaxResults)}function setSort(){sortCourses();displayCourses(AjaxResults)}function sortCourses(){var n=$("#sortBox :selected").val();n==="CourseCode"?sortSets():n==="TitleASC"?AjaxResults.sort(GetSortOrder("HtmlTitle")):n==="TitleDESC"?AjaxResults.sort(GetSortOrder("HtmlTitle")).reverse():n==="Level"&&AjaxResults.sort(GetSortOrder("Level"))}function sortSets(){for(var n,t,r={},i=0;i<modelSize;i++)n=AjaxResults[i].CourseCode,t="",isLetter(n[0])&&isLetter(n[0])&&(t+=n.substring(0,2)),t!=""&&(r[t]="");AjaxResults.sort(GetCourseSortOrder("CourseCode",Object.keys(r).sort()))}function GetSortOrder(n){return function(t,i){return t[n]>i[n]?1:t[n]<i[n]?-1:0}}function GetCourseSortOrder(n,t){return function(i,r){for(var f=i[n],e=r[n],o=0,s=0,h="",c="",u=0;u<t.length;u++)f[0]==t[u][0]&&f[1]==t[u][1]&&(o=u),e[0]==t[u][0]&&e[1]==t[u][1]&&(s=u);for(u=0;u<f.length;u++)isNaN(f[u])||(h+=f[u]);for(u=0;u<e.length;u++)isNaN(e[u])||(c+=e[u]);return o<s?-1:s<o?1:o==s?h-c:0}}function isLetter(n){return n.length===1&&n.toLowerCase().match(/[a-z]/i)}function updateCategories(n){for(var i=document.getElementsByClassName("cat-list"),t=0;t<i.length;t++)i[t].disabled=n[t]==0?!0:!1,i[t].innerHTML=i[t].value+" ("+n[t]+")",i[t].selected===!0&&(n[t]===0?nullifyTIA():callAjaxTIA())}function updateTIA(n){var f=CheckSet.category,i,t,r,u;if($("#TIAContainer").empty(),i='<select id="u89_input" size="14" style="width: 100%; height: 227px;" onchange="processCheckChange(\'tia\', \'\')">',i+='<option value="All" id="All-Courses" class="tia-list" name="TIAList" >All Courses ('+n[0].Amount+")<\/option>",CheckSet.category!=="")for(t=1;t<n.length;t++)r="",n[t].Amount==0&&(r='disabled="disabled"'),u=n[t].Check?'selected="selected"':"",i+=n[t].Name.Length>28?'<option value="'+n[t].Code+'" id="'+n[t].Code+'" class="tia-list"'+r+u+">"+n[t].Name+" ("+n[t].Amount+")<\/option>":'<option value="'+n[t].Code+'" id="'+n[t].Code+'" class="tia-list"'+r+u+">"+n[t].Name+" ("+n[t].Amount+")<\/option>";i+="<\/select>";$("#TIAContainer").append(i)}function nullifyTIA(){$("#TIAContainer").empty();var n='<select id="u89_input" size="14" style="width: 100%; height: 227px;" onchange="processCheckChange(\'tia\', \'\')">';n+='<option value="All" id="All-Courses" class="tia-list" name="TIAList" selected="selected">All Courses (0)<\/option>';n+='<\/select>"';$("#TIAContainer").append(n)}function courseRow(n,t,i,r,u){for(var h=n,c=t,l=i,a=r,e=u,s=e.split("\t"),f,e="",o=0;s[o];o++)e+="<text>"+s[o]+"<\/text> <br />\n";f="";f+='<div style="display: table; width: 100%; padding: 10px; background: #f2f2f2; border-bottom: 2px solid white"> \n';f+='<div style="display: table-cell; width: 108px">'+h+"<\/div> \n";f+='<div style="display: table-cell; width: 320px"> \n';f+='<a href="'+l+'" class="course-title">'+c+"<\/a> \n<\/div> \n";f+='<div style="display: table-cell; width: 30px"><\/div> \n';f+='<div style="display: table-cell; width: 100px"> \n'+a+"\n<\/div> \n";f+='<div style="display: table-cell"> \n'+e+"<\/div> \n";f+="<\/div> \n";console.log("Current: \n"+f);document.getElementById("demo").innerHTML=f}function paginationBar(n,t,i){var f=n,t=t,u=f/t,i,r;return u=Math.ceil(u),i=i,r="",r+='<div class="results_pagination"> \n',r+='<div style="display: block; float: left; margin-right: 32px; margin-bottom: 8px;"> \n Sort: &nbsp;&nbsp;',r+='<select name="sort" id="sort'+i+'" onchange="showCourseList(sort'+i+')" style="font-size: 12px;"> \n',r+='<option value="CourseCode" selected="selected"> Course Number <\/option> \n',r+='<option value="TitleASC"> Title: A to Z <\/option> \n',r+='<option value="TitleDESC"> Title: Z to A <\/option> \n',r+='<option value="Level"> Course Level <\/option> \n',r+="<\/select> \n<\/div> \n",r+='<div style="display: block; float: left; margin-right: 32px; margin-bottom: 8px"> \n Display: &nbsp;&nbsp;',r+='<select name="num_results" id="num_results'+i+'" onchange="showCourseList(num_results'+i+')" style="font-size: 12px;"> \n',r+='<option value="30" selected="selected"> 30 per page <\/option> \n',r+='<option value="60"> 60 per page <\/option> \n',r+='<option value="90"> 90 per page <\/option> \n',r+='<option value="99999999"> All <\/option> \n',r+="<\/select> \n<\/div> \n",r+='<div style="display: block; float: right; margin-bottom: 4px"> \n',r+='<div style="display: block; float: left; width: 20px">&nbsp;<\/div> \n',r+='<div style="display: block; float: left; margin-left: 7px"> \n',r+=' <form id="page_input" action="" method="" onsubmit=""> \n',r+='<b>Page <input type="text" name="start_at_input" id="start_at_input" value="1" class="pageinationfld" style="font-size: 12px; color: #ed1c24; text-align: center; border: 1px solid #000; width: 30px; font-weight: bold; min-height: 18px;"> ',r+="of "+u+"<\/b> \n",r+="<\/form> \n",r+='<div style="display: block; float: left; margin-left: 7px"> \n',r+='<form style="margin: 0; padding: 0;" id="frmPagingNext" name="frmPagingNext" action="/education/courses/findcourse?" method="GET"> \n',r+='<input type="hidden" name="start_at" id="start_at" value="25">',r+='<input id="btnPagingNext" name="go" type="image" value="submit" alt="Next" src="/images/global/pagenext.gif" onmouseover="this.src=\'/images/global/pagenext_over.gif\'" onmouseout="this.src=\'/images/global/pagenext.gif\'"> \n',r+="<\/form> \n<\/div> \n",r+="<\/div> \n",r+="<\/div> \n",r+='<div style="clear: both;"><\/div> \n',r+="<\/div> \n",console.log("Current: \n"+r),document.getElementById("demo2").innerHTML=r,r}var formatName,URLArray=["InCompany","Online","Conference","CourseRecording"],SPIEAjax;$(document).ready(PrintBtn(),CatchHashLinks(),AttachMouseOver(this,"All"));var CheckSet={formatList:[],levelList:[],category:"",tia:"",sortPreference:""},pageCount=30,pageModifier=1,AjaxResults=null,modelSize=0;SPIEAjax=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");try{SPIEAjax.responseText=""}catch(err){}SPIEAjax.ArrayResults=[];SPIEAjax.onreadystatechange=function(){SPIEAjax.readyState==4&&SPIEAjax.status==200&&this.responseText!=""&&(this.ArrayResults=this.responseText.split("\t"),window[this.ArrayResults[0]](this.ArrayResults[1]))};SPIEAjax.Request=function(n,t){this.open("GET","/education/ajax/"+n+"?request="+encodeURIComponent(t)+"&rnd="+Math.random(),!0);this.send()};SPIEAjax.Version="1.0.0 20130806a"