This repository has been archived by the owner on Feb 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
idpselect.js
1 lines (1 loc) · 24.8 KB
/
idpselect.js
1
function IdPSelectLanguages(){this.langBundles={en:{"fatal.divMissing":'<div> specified as "insertAtDiv" could not be located in the HTML',"fatal.noXMLHttpRequest":"Browser does not support XMLHttpRequest, unable to load IdP selection data","fatal.wrongProtocol":'Policy supplied to DS was not "urn:oasis:names:tc:SAML:profiles:SSO:idpdiscovery-protocol:single"',"fatal.wrongEntityId":"entityId supplied by SP did not match configuration","fatal.noData":"Metadata download returned no data","fatal.loadFailed":"Failed to download metadata from ","fatal.noparms":"No parameters to discovery session and no defaultReturn parameter configured","fatal.noReturnURL":"No URL return parameter provided","fatal.badProtocol":"Return request must start with https:// or http://","idpPreferred.label":"Use a suggested selection:","idpEntry.label":"Or enter your organization's name","idpEntry.NoPreferred.label":"Enter your organization's name","idpList.label":"Or select your organization from the list below","idpList.NoPreferred.label":"Select your organization from the list below","idpList.defaultOptionLabel":"Please select your organization...","idpList.showList":"Allow me to pick from a list","idpList.showSearch":"Allow me to specify the site","submitButton.label":"Continue",helpText:"Help",defaultLogoAlt:"DefaultLogo"},de:{"fatal.divMissing":"Das notwendige Div Element fehlt","fatal.noXMLHttpRequest":"Ihr Webbrowser unterst\u00fctzt keine XMLHttpRequests, IdP-Auswahl kann nicht geladen werden","fatal.wrongProtocol":'DS bekam eine andere Policy als "urn:oasis:names:tc:SAML:profiles:SSO:idpdiscovery-protocol:single"',"fatal.wrongEntityId":"Die entityId ist nicht korrekt","fatal.loadFailed":"Metadaten konnten nicht heruntergeladen werden: ","fatal.noparms":"Parameter f\u00fcr das Discovery Service oder 'defaultReturn' fehlen","fatal.noReturnURL":"URL return Parmeter fehlt","fatal.badProtocol":"return Request muss mit https:// oder http:// beginnen","idpPreferred.label":"Vorherige Auswahl:","idpEntry.label":"Oder geben Sie den Namen (oder Teile davon) an:","idpEntry.NoPreferred.label":"Namen (oder Teile davon) der Institution angeben:","idpList.label":"Oder w\u00e4hlen Sie Ihre Institution aus einer Liste:","idpList.NoPreferred.label":"Institution aus folgender Liste w\u00e4hlen:","idpList.defaultOptionLabel":"W\u00e4hlen Sie Ihre Institution aus...","idpList.showList":"Institution aus einer Liste w\u00e4hlen","idpList.showSearch":"Institution selbst angeben","submitButton.label":"OK",helpText:"Hilfe",defaultLogoAlt:"Standard logo"},ja:{"fatal.divMissing":'"insertAtDiv" の ID を持つ <div> が HTML 中に存在しません',"fatal.noXMLHttpRequest":"ブラウザが XMLHttpRequest をサポートしていないので IdP 情報を取得できません","fatal.wrongProtocol":'DSへ渡された Policy パラメータが "urn:oasis:names:tc:SAML:profiles:SSO:idpdiscovery-protocol:single" ではありません',"fatal.wrongEntityId":"SP から渡された entityId が設定値と異なります","fatal.noData":"メタデータが空です","fatal.loadFailed":"次の URL からメタデータをダウンロードできませんでした: ","fatal.noparms":"DSにパラメータが渡されておらず defaultReturn も設定されていません","fatal.noReturnURL":"戻り URL が指定されていません","fatal.badProtocol":"戻り URL は https:// か http:// で始まらなければなりません","idpPreferred.label":"選択候補の IdP:","idpEntry.label":"もしくはあなたの所属機関名を入力してください","idpEntry.NoPreferred.label":"あなたの所属機関名を入力してください","idpList.label":"もしくはあなたの所属機関を選択してください","idpList.NoPreferred.label":"あなたの所属機関を一覧から選択してください","idpList.defaultOptionLabel":"所属機関を選択してください...","idpList.showList":"一覧から選択する","idpList.showSearch":"機関名を入力する","submitButton.label":"選択",helpText:"Help",defaultLogoAlt:"DefaultLogo"},"pt-br":{"fatal.divMissing":'A tag <div> com "insertAtDiv" não foi encontrada no arquivo HTML',"fatal.noXMLHttpRequest":'Seu navegador não suporta "XMLHttpRequest", impossível de carregador os dados do IdP selecionado',"fatal.wrongProtocol":'A política "Policy" fornecida para o DS não foi "urn:oasis:names:tc:SAML:profiles:SSO:idpdiscovery-protocol:single"',"fatal.wrongEntityId":"entityId oferecido pelo SP não confere com o da configuração","fatal.noData":"O arquivo de metadados não retornou nada;","fatal.loadFailed":"Falhou ao realizar download do metadado de ","fatal.noparms":'Sem parâmetros para sessão de descoberta e sem parâmetro "defaultReturn" configurado',"fatal.noReturnURL":"Não foi definida um endereço (URL) de retorno no parâmetro","fatal.badProtocol":"Retorno do endereço requisitado deve começar com https:// ou http://","idpPreferred.label":"Use estas Instituições sugeridas: ","idpEntry.label":"Ou informe o nome da sua Instituição","idpEntry.NoPreferred.label":"Informe o nome da sua Instituição","idpList.label":"Ou selecione sua Instituição através da lista abaixo","idpList.NoPreferred.label":"Selecione sua Instituição através da lista abaixo","idpList.defaultOptionLabel":"Por favor, selecione sua Instituição: ","idpList.showList":"Permitir que eu escolha um IdP através de uma lista","idpList.showSearch":"Permitir que eu especifique o IdP","submitButton.label":"Continuar ",helpText:"Ajuda",defaultLogoAlt:"Logo padrão"}}}function TypeAheadControl(l,f,j,g,i,b,h,e,a,c,d,k){this.elementList=l;this.textBox=f;this.origin=j;this.submit=g;this.results=0;this.alwaysShow=c;this.maxResults=d;this.ie6hack=a;this.maxchars=i;this.getName=b;this.getEntityId=h;this.geticon=e;this.getKeywords=k}TypeAheadControl.prototype.draw=function(b){var a=this;this.dropDown=document.createElement("ul");this.dropDown.className="IdPSelectDropDown";this.dropDown.style.visibility="hidden";this.dropDown.style.width=this.textBox.offsetWidth;this.dropDown.current=-1;this.textBox.setAttribute("role","listbox");document.body.appendChild(this.dropDown);this.textBox.setAttribute("role","combobox");this.textBox.setAttribute("aria-controls","IdPSelectDropDown");this.textBox.setAttribute("aria-owns","IdPSelectDropDown");this.dropDown.onmouseover=function(c){if(!c){c=window.event}var d;if(c.target){d=c.target}if(typeof d=="undefined"){d=c.srcElement}a.select(d)};this.dropDown.onmousedown=function(c){if(-1!=a.dropDown.current){a.textBox.value=a.results[a.dropDown.current][0]}};this.textBox.onkeyup=function(c){if(!c){c=window.event}a.handleKeyUp(c)};this.textBox.onkeydown=function(c){if(!c){c=window.event}a.handleKeyDown(c)};this.textBox.onblur=function(){a.hideDrop()};this.textBox.onfocus=function(){a.handleChange()};if(null==b||b){this.textBox.focus()}};TypeAheadControl.prototype.getPossible=function(b){var h=[];var j=0;var f=0;var e=0;var g;var i;b=b.toLowerCase();while(f<=this.maxResults&&j<this.elementList.length){var a=false;var c=this.getName(this.elementList[j]);if(c.toLowerCase().indexOf(b)!=-1){a=true}if(!a&&this.getEntityId(this.elementList[j]).toLowerCase().indexOf(b)!=-1){a=true}if(!a){var d=this.getKeywords(this.elementList[j]);if(null!=d&&d.toLowerCase().indexOf(b)!=-1){a=true}}if(a){h[f]=[c,this.getEntityId(this.elementList[j]),this.geticon(this.elementList[j])];f++}j++}this.dropDown.current=-1;return h};TypeAheadControl.prototype.handleKeyUp=function(b){var a=b.keyCode;if(27==a){this.textBox.value="";this.handleChange()}else{if(8==a||32==a||(a>=46&&a<112)||a>123){this.handleChange()}}};TypeAheadControl.prototype.handleKeyDown=function(b){var a=b.keyCode;if(38==a){this.upSelect()}else{if(40==a){this.downSelect()}}};TypeAheadControl.prototype.hideDrop=function(){var a=0;if(null!==this.ie6hack){while(a<this.ie6hack.length){this.ie6hack[a].style.visibility="visible";a++}}this.dropDown.style.visibility="hidden";this.textBox.setAttribute("aria-expanded","false");if(-1==this.dropDown.current){this.doUnselected()}};TypeAheadControl.prototype.showDrop=function(){var a=0;if(null!==this.ie6hack){while(a<this.ie6hack.length){this.ie6hack[a].style.visibility="hidden";a++}}this.dropDown.style.visibility="visible";this.dropDown.style.width=this.textBox.offsetWidth+"px";this.textBox.setAttribute("aria-expanded","true")};TypeAheadControl.prototype.doSelected=function(){this.submit.disabled=false};TypeAheadControl.prototype.doUnselected=function(){this.submit.disabled=true;this.textBox.setAttribute("aria-activedescendant","")};TypeAheadControl.prototype.handleChange=function(){var b=this.textBox.value;var a=this.getPossible(b);if(0===b.length||0===a.length||(!this.alwaysShow&&this.maxResults<a.length)){this.hideDrop();this.doUnselected();this.results=[];this.dropDown.current=-1}else{this.results=a;this.populateDropDown(a);if(1==a.length){this.select(this.dropDown.childNodes[0]);this.doSelected()}else{this.doUnselected()}}};TypeAheadControl.prototype.populateDropDown=function(d){this.dropDown.innerHTML="";var c=0;var a;var b;var f;while(c<d.length){a=document.createElement("li");a.id="IdPSelectOption"+c;f=d[c][0];if(null!==d[c][2]){b=document.createElement("img");b.src=d[c][2];b.width=16;b.height=16;b.alt="";a.appendChild(b);if(f.length>this.maxchars-2){f=f.substring(0,this.maxchars-2)}f=" "+f}else{if(f.length>this.maxchars){f=f.substring(0,this.maxchars)}}a.appendChild(document.createTextNode(f));a.setAttribute("role","option");this.dropDown.appendChild(a);c++}var e=this.getXY();this.dropDown.style.left=e[0]+"px";this.dropDown.style.top=e[1]+"px";this.showDrop()};TypeAheadControl.prototype.getXY=function(){var a=this.textBox;var c=0;var b=a.offsetHeight;while(a.tagName!="BODY"){c+=a.offsetLeft;b+=a.offsetTop;a=a.offsetParent}c+=a.offsetLeft;b+=a.offsetTop;return[c,b]};TypeAheadControl.prototype.select=function(b){var a=0;var c;this.dropDown.current=-1;this.doUnselected();while(a<this.dropDown.childNodes.length){c=this.dropDown.childNodes[a];if(c==b){c.className="IdPSelectCurrent";c.setAttribute("aria-selected","true");this.textBox.setAttribute("aria-activedescendant","IdPSelectOption"+a);this.doSelected();this.dropDown.current=a;this.origin.value=this.results[a][1];this.origin.textValue=this.results[a][0]}else{c.setAttribute("aria-selected","false");c.className=""}a++}this.textBox.focus()};TypeAheadControl.prototype.downSelect=function(){if(this.results.length>0){if(-1==this.dropDown.current){this.dropDown.current=0;this.dropDown.childNodes[0].className="IdPSelectCurrent";this.dropDown.childNodes[0].setAttribute("aria-selected","true");this.textBox.setAttribute("aria-activedescendant","IdPSelectOption"+0);this.doSelected();this.origin.value=this.results[0][1];this.origin.textValue=this.results[0][0]}else{if(this.dropDown.current<(this.results.length-1)){this.dropDown.childNodes[this.dropDown.current].className="";this.dropDown.current++;this.dropDown.childNodes[this.dropDown.current].className="IdPSelectCurrent";this.dropDown.childNodes[this.dropDown.current].setAttribute("aria-selected","true");this.textBox.setAttribute("aria-activedescendant","IdPSelectOption"+this.dropDown.current);this.doSelected();this.origin.value=this.results[this.dropDown.current][1];this.origin.textValue=this.results[this.dropDown.current][0]}}}};TypeAheadControl.prototype.upSelect=function(){if((this.results.length>0)&&(this.dropDown.current>0)){this.dropDown.childNodes[this.dropDown.current].className="";this.dropDown.current--;this.dropDown.childNodes[this.dropDown.current].className="IdPSelectCurrent";this.dropDown.childNodes[this.dropDown.current].setAttribute("aria-selected","true");this.textBox.setAttribute("aria-activedescendant","IdPSelectOption"+this.dropDown.current);this.doSelected();this.origin.value=this.results[this.dropDown.current][1];this.origin.textValue=this.results[this.dropDown.current][0]}};function IdPSelectUI(){var o;var Q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var aB;var M;var at;var af;var T;var d;var A;var l;var v;var i;var an;var f;var q;var U;var Z;var z;var Y;var L;var g;var F;var al;var I;var N;var ad;var ao;var ai;var c;var X;var B;var K;var O;var h;var aq;var P;var aD="idpSelect";var ab="IdPSelect";var aj;var y="";var S="";var ar=[];var ay="entityID";this.draw=function(aF){if(!k(aF)){return}aB=document.getElementById(aF.insertAtDiv);if(!aB){J(x("fatal.divMissing"));return}if(!e(aF.dataSource)){return}aC();r(aF.hiddenIdPs);o.sort(function(aH,aG){return aw(aH).localeCompare(aw(aG))});var aE=V();aB.appendChild(aE);aj.draw(aF.setFocusTextBox)};var k=function(aE){var aP;z=aE.preferredIdP;Y=aE.maxPreferredIdPs;L=aE.helpURL;g=aE.ie6Hack;F=aE.samlIdPCookieTTL;ad=aE.alwaysShow;ao=aE.maxResults;ai=aE.ignoreKeywords;if(aE.showListFirst){c=aE.showListFirst}else{c=false}if(aE.noWriteCookie){X=aE.noWriteCookie}else{X=false}if(aE.ignoreURLParams){B=aE.ignoreURLParams}else{B=false}A=aE.defaultLogo;l=aE.defaultLogoWidth;v=aE.defaultLogoHeight;i=aE.minWidth;an=aE.minHeight;f=aE.maxWidth;q=aE.maxHeight;U=aE.bestRatio;if(null==aE.doNotCollapse){Z=true}else{Z=aE.doNotCollapse}I=aE.maxIdPCharsButton;al=aE.maxIdPCharsDropDown;N=aE.maxIdPCharsAltTxt;var aF;if(typeof navigator=="undefined"){aF=aE.defaultLanguage}else{aF=navigator.language||navigator.userLanguage||aE.defaultLanguage}aF=aF.toLowerCase();if(aF.indexOf("-")>0){at=aF.substring(0,aF.indexOf("-"))}var aQ=new IdPSelectLanguages();af=aE.defaultLanguage;if(typeof aE.langBundles!="undefined"&&typeof aE.langBundles[aF]!="undefined"){T=aE.langBundles[aF]}else{if(typeof aQ.langBundles[aF]!="undefined"){T=aQ.langBundles[aF]}else{if(typeof at!="undefined"){if(typeof aE.langBundles!="undefined"&&typeof aE.langBundles[at]!="undefined"){T=aE.langBundles[at]}else{if(typeof aQ.langBundles[at]!="undefined"){T=aQ.langBundles[at]}}}}}if(typeof aE.langBundles!="undefined"&&typeof aE.langBundles[aE.defaultLanguage]!="undefined"){d=aE.langBundles[aE.defaultLanguage]}else{d=aQ.langBundles[aE.defaultLanguage]}if(!d){J("No languages work");return false}if(!T){p("No language support for "+aF);T=d}if(aE.testGUI){return true}var aL="urn:oasis:names:tc:SAML:profiles:SSO:idpdiscovery-protocol:single";var aH;var aG=false;var aN;var aM;var aJ=window;while(null!==aJ.parent&&aJ!==aJ.parent){aJ=aJ.parent}var aI=aJ.location;var aK=aI.search;if(B||null==aK||0==aK.length||aK.charAt(0)!="?"){if((null==aE.defaultReturn)&&!B){J(x("fatal.noparms"));return false}aP=aE.myEntityID;y=aE.defaultReturn;if(null!=aE.defaultReturnIDParam){ay=aE.defaultReturnIDParam}}else{aK=aK.substring(1);aN=aK.split("&");if(aN.length===0){J(x("fatal.noparms"));return false}for(aH=0;aH<aN.length;aH++){aM=aN[aH].split("=");if(aM.length!=2){continue}if(aM[0]=="entityID"){aP=decodeURIComponent(aM[1])}else{if(aM[0]=="return"){y=decodeURIComponent(aM[1])}else{if(aM[0]=="returnIDParam"){ay=decodeURIComponent(aM[1])}else{if(aM[0]=="policy"){aL=decodeURIComponent(aM[1])}else{if(aM[0]=="isPassive"){aG=(aM[1].toUpperCase()=="TRUE")}}}}}}}if(aL!="urn:oasis:names:tc:SAML:profiles:SSO:idpdiscovery-protocol:single"){J(x("fatal.wrongProtocol"));return false}if(aE.myEntityID!==null&&aE.myEntityID!=aP){J(x("fatal.wrongEntityId")+'"'+aP+'" != "'+aE.myEntityID+'"');return false}if(null===y||y.length===0){J(x("fatal.noReturnURL"));return false}if(!ag(y)){J(x("fatal.badProtocol"));return false}if(aG){var aR=b();if(aR.length==0){location.href=y;return false}else{var aO=ay+"="+encodeURIComponent(aR[0]);if(y.indexOf("?")==-1){aO="?"+aO}else{aO="&"+aO}location.href=y+aO;return false}}aH=y.indexOf("?");if(aH<0){S=y;return true}S=y.substring(0,aH);aK=y.substring(aH+1);aN=aK.split("&");for(aH=0;aH<aN.length;aH++){aM=aN[aH].split("=");if(aM.length!=2){continue}aM[1]=decodeURIComponent(aM[1]);ar.push(aM)}return true};var aC=function(){var aG=[];var aF;for(aF=0;aF<o.length;){var aE=w(o[aF]);if(null==aG[aE]){aG[aE]=aE;aF=aF+1}else{o.splice(aF,1)}}};var r=function(aG){if(null==aG||0==aG.length){return}var aF;var aE;for(aF=0;aF<aG.length;aF++){for(aE=0;aE<o.length;aE++){if(w(o[aE])==aG[aF]){o.splice(aE,1);break}}}};var ag=function(aF){if(null===aF){return false}var aE="://";var aG=aF.indexOf(aE);if(aG<0){return false}aF=aF.substring(0,aG);if(aF=="http"||aF=="https"){return true}return false};var aA=function(){if(null==navigator){return false}var aE=navigator.appName;if(null==aE){return false}return(aE=="Microsoft Internet Explorer")};var e=function(aH){var aG=null;try{aG=new XMLHttpRequest()}catch(aF){}if(null==aG){try{aG=new ActiveXObject("Microsoft.XMLHTTP")}catch(aF){}}if(null==aG){try{aG=new ActiveXObject("MSXML2.XMLHTTP.3.0")}catch(aF){}}if(null==aG){J(x("fatal.noXMLHttpRequest"));return false}if(aA()){aH+="?random="+(Math.random()*1000000)}aG.open("GET",aH,false);if(typeof aG.overrideMimeType=="function"){aG.overrideMimeType("application/json")}aG.send(null);if(aG.status==200){var aE=aG.responseText;if(aE===null){J(x("fatal.noData"));return false}o=JSON.parse(aE)}else{J(x("fatal.loadFailed")+aH);return false}return true};var W=function(aE){for(var aF=0;aF<o.length;aF++){if(w(o[aF])==aE){return o[aF]}}return null};var C=function(aL,aF){var aK=function(aO){var aM=null;var aN;if(null==aL.Logos){return null}for(aN in aL.Logos){if(aL.Logos[aN].lang==aO&&aL.Logos[aN].width!=null&&aL.Logos[aN].width>=i&&aL.Logos[aN].height!=null&&aL.Logos[aN].height>=an){if(aM===null){aM=aL.Logos[aN]}else{me=Math.abs(U-Math.log(aL.Logos[aN].width/aL.Logos[aN].height));him=Math.abs(U-Math.log(aM.width/aM.height));if(him>me){aM=aL.Logos[aN]}}}}return aM};var aH=null;var aG=document.createElement("img");ae(aG,"IdPImg");aH=aK(M);if(null===aH&&typeof at!="undefined"){aH=aK(at)}if(null===aH){aH=aK(null)}if(null===aH){aH=aK(af)}if(null===aH){if(!aF){return null}aG.src=A;aG.width=l;aG.height=v;aG.alt=x("defaultLogoAlt");return aG}aG.src=aH.value;var aI=aw(aL);if(aI.length>N){aI=aI.substring(0,N)+"..."}aG.alt=aI;var aE=aH.width;var aJ=aH.height;if(aE>f){aJ=(f/aE)*aJ;aE=f}if(aJ>q){aE=(q/aJ)*aE;aE=q}aG.setAttribute("width",aE);aG.setAttribute("height",aJ);return aG};var V=function(){var aF=ah("IdPSelector");var aE;aE=au(aF);m(aF,aE);R(aF,aE);return aF};var H=function(aG,aN,aF){var aE=ah(undefined,"PreferredIdPButton");var aM=document.createElement("a");var aL=ay+"="+encodeURIComponent(w(aG));var aH=y;var aJ=C(aG,aF);if(aH.indexOf("?")==-1){aL="?"+aL}else{aL="&"+aL}aM.href=aH+aL;aM.onclick=function(){az(w(aG))};if(null!=aJ){var aO=ah(undefined,"PreferredIdPImg");aO.appendChild(aJ);aM.appendChild(aO)}var aK=ah(undefined,"TextDiv");var aI=aw(aG);if(aI.length>I){aI=aI.substring(0,I)+"..."}aE.title=aI;aK.appendChild(document.createTextNode(aI));aM.appendChild(aK);aE.appendChild(aM);return aE};var ax=function(aE,aH){var aG=ah(undefined,"TextDiv");var aF=document.createTextNode(x(aH));aG.appendChild(aF);aE.appendChild(aG)};var a=function(aE,aG){if(null===aG||0===aG.length||"-"==aG.value){return}var aF=0;while(aF<aE.options.length){if(aE.options[aF].value==aG){aE.options[aF].selected=true;break}aF++}};var au=function(aJ){var aI=G();if(0===aI.length){return false}var aE=Z;for(var aG=0;aG<Y&&aG<aI.length;aG++){if(aI[aG]&&C(aI[aG],false)){aE=true}}var aH;if(aE){aH=ah("PreferredIdPTile")}else{aH=ah("PreferredIdPTileNoImg")}ax(aH,"idpPreferred.label");for(var aG=0;aG<Y&&aG<aI.length;aG++){if(aI[aG]){var aF=H(aI[aG],aG,aE);aH.appendChild(aF)}}aJ.appendChild(aH);return true};var aa=function(){var aF=document.createElement("form");O.appendChild(aF);aF.action=S;aF.method="GET";aF.setAttribute("autocomplete","OFF");var aE=0;for(aE=0;aE<ar.length;aE++){var aG=document.createElement("input");aG.setAttribute("type","hidden");aG.name=ar[aE][0];aG.value=ar[aE][1];aF.appendChild(aG)}return aF};var m=function(aL,aF){O=ah("IdPEntryTile");if(c){O.style.display="none"}var aG=document.createElement("label");aG.setAttribute("for",aD+"Input");if(aF){ax(aG,"idpEntry.label")}else{ax(aG,"idpEntry.NoPreferred.label")}var aJ=aa();aJ.appendChild(aG);var aI=document.createElement("input");aJ.appendChild(aI);aI.type="text";j(aI,"Input");var aK=document.createElement("input");aK.setAttribute("type","hidden");aJ.appendChild(aK);aK.name=ay;aK.value="-";var aH=s("Select");aH.disabled=true;aJ.appendChild(aH);aJ.onsubmit=function(){if(null===aK.value||0===aK.value.length||"-"==aK.value){return false}aI.value=aK.textValue;az(aK.value);return true};aj=new TypeAheadControl(o,aI,aK,aH,al,aw,w,ac,g,ad,ao,D);var aE=document.createElement("a");aE.appendChild(document.createTextNode(x("idpList.showList")));aE.href="#";ae(aE,"DropDownToggle");aE.onclick=function(){O.style.display="none";a(aq,aK.value);h.style.display="";P.focus();return false};O.appendChild(aE);u(O);aL.appendChild(O)};var R=function(aE,aH){h=ah("IdPListTile");if(!c){h.style.display="none"}var aL=document.createElement("label");aL.setAttribute("for",aD+"Selector");if(aH){ax(aL,"idpList.label")}else{ax(aL,"idpList.NoPreferred.label")}aq=document.createElement("select");j(aq,"Selector");aq.name=ay;h.appendChild(aq);var aM=n("-",x("idpList.defaultOptionLabel"));aM.selected=true;aq.appendChild(aM);var aG;for(var aI=0;aI<o.length;aI++){aG=o[aI];aM=n(w(aG),aw(aG));aq.appendChild(aM)}var aF=aa();aF.appendChild(aL);aF.appendChild(aq);aF.onsubmit=function(){if(aq.selectedIndex<1){return false}az(aq.options[aq.selectedIndex].value);return true};var aJ=s("List");P=aJ;aF.appendChild(aJ);h.appendChild(aF);var aK=document.createElement("a");aK.appendChild(document.createTextNode(x("idpList.showSearch")));aK.href="#";ae(aK,"DropDownToggle");aK.onclick=function(){O.style.display="";h.style.display="none";return false};h.appendChild(aK);u(h);aE.appendChild(h)};var s=function(aF){var aE=document.createElement("input");aE.setAttribute("type","submit");aE.value=x("submitButton.label");j(aE,aF+"Button");return aE};var u=function(aF){var aE=document.createElement("a");aE.href=L;aE.appendChild(document.createTextNode(x("helpText")));ae(aE,"HelpButton");aF.appendChild(aE)};var ah=function(aG,aE){var aF=document.createElement("div");if(undefined!==aG){j(aF,aG)}if(undefined!==aE){ae(aF,aE)}return aF};var n=function(aF,aG){var aE=document.createElement("option");aE.value=aF;if(aG.length>al){aG=aG.substring(0,al)}aE.appendChild(document.createTextNode(aG));return aE};var j=function(aF,aE){aF.id=aD+aE};var ae=function(aF,aE){aF.setAttribute("class",ab+aE)};var av=function(aE){return document.getElementById(aD+aE)};var az=function(aE){E(aE);ak(K)};var x=function(aE){var aF=T[aE];if(!aF){aF=d[aE]}if(!aF){aF="Missing message for "+aE}return aF};var w=function(aE){return aE.entityID};var ac=function(aG){var aE;if(null==aG.Logos){return null}for(aE=0;aE<aG.Logos.length;aE++){var aF=aG.Logos[aE];if(aF.height=="16"&&aF.width=="16"){if(null==aF.lang||M==aF.lang||(typeof at!="undefined"&&at==aF.lang)||af==aF.lang){return aF.value}}}return null};var aw=function(aF){var aE=ap(aF.DisplayNames);if(null!==aE){return aE}p("No Name entry in any language for "+w(aF));return w(aF)};var D=function(aF){if(ai||null==aF.Keywords){return null}var aE=ap(aF.Keywords);return aE};var ap=function(aE){var aF;for(aF in aE){if(aE[aF].lang==M){return aE[aF].value}}if(typeof at!="undefined"){for(aF in aE){if(aE[aF].lang==at){return aE[aF].value}}}for(aF in aE){if(aE[aF].lang==null){return aE[aF].value}}for(aF in aE){if(aE[aF].lang==af){return aE[aF].value}}return null};var G=function(){var aH=[];var aG=0;var aF;var aE;if(null!=z){for(aF=0;aF<z.length&&aF<Y-1;aF++){aH[aF]=W(z[aF]);aG++}}K=b();for(aF=aG,aE=0;aF<K.length&&aF<Y;aF++,aE++){aH.push(W(K[aE]))}return aH};var E=function(aE){var aF=[];while(0!==K.length){var aG=K.pop();if(aG!=aE){aF.unshift(aG)}}aF.unshift(aE);K=aF;return};var b=function(){var aK=[];var aJ,aH;var aM;aM=document.cookie.split(";");for(aJ=0;aJ<aM.length;aJ++){var aE=aM[aJ];var aI=aE.indexOf("=");var aL=aE.substring(0,aI);var aG=aE.substring(aI+1);if("_saml_idp"==aL.replace(/^\s+|\s+$/g,"")){aG=aG.replace(/^\s+|\s+$/g,"");aG=aG.replace("+","%20");aG=aG.split("%20");for(aH=aG.length;aH>0;aH--){if(0===aG[aH-1].length){continue}var aF=am(decodeURIComponent(aG[aH-1]));if(aF.length>0){aK.push(aF)}}}}return aK};var ak=function(aJ){var aG=[];var aI=aJ.length;if(X){return}if(aI>5){aI=5}for(var aH=aI;aH>0;aH--){if(aJ[aH-1].length>0){aG.push(encodeURIComponent(t(aJ[aH-1])))}}var aE=null;if(F){var aF=new Date();cookieTTL=F*24*60*60*1000;aE=new Date(aF.getTime()+cookieTTL)}document.cookie="_saml_idp="+aG.join("%20")+"; path = /"+((aE===null)?"":"; expires="+aE.toUTCString())};var t=function(aN){var aE="",aI,aG,aF,aM,aL,aK,aJ;for(var aH=0;aH<aN.length;){aI=aN.charCodeAt(aH++);aG=aN.charCodeAt(aH++);aF=aN.charCodeAt(aH++);aM=aI>>2;aL=((aI&3)<<4)+(aG>>4);aK=((aG&15)<<2)+(aF>>6);aJ=aF&63;if(isNaN(aG)){aK=aJ=64}else{if(isNaN(aF)){aJ=64}}aE+=Q.charAt(aM)+Q.charAt(aL)+Q.charAt(aK)+Q.charAt(aJ)}return aE};var am=function(aH){var aF="",aO,aM,aK,aN,aL,aJ,aI;var aG=0;var aE=/[^A-Za-z0-9\+\/\=]/g;aH=aH.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{aN=Q.indexOf(aH.charAt(aG++));aL=Q.indexOf(aH.charAt(aG++));aJ=Q.indexOf(aH.charAt(aG++));aI=Q.indexOf(aH.charAt(aG++));aO=(aN<<2)|(aL>>4);aM=((aL&15)<<4)|(aJ>>2);aK=((aJ&3)<<6)|aI;aF=aF+String.fromCharCode(aO);if(aJ!=64){aF=aF+String.fromCharCode(aM)}if(aI!=64){aF=aF+String.fromCharCode(aK)}aO=aM=aK="";aN=aL=aJ=aI=""}while(aG<aH.length);return aF};var J=function(aF){alert("FATAL - DISCO UI:"+aF);var aE=document.createTextNode(aF);aB.appendChild(aE)};var p=function(){}}(new IdPSelectUI()).draw(new IdPSelectUIParms());