/*
 * Copyright CADMAI Software GmbH.
 * All rights reserved.
 *
 * Redistribution (includes making available on a web location) is permitted 
 * provided that the following conditions are met:
 *
 * The redistributor must hold one of these licenses:
 * a valid CADMAI WebGl-Publisher license (SingleWebGlPubLic)
 * a valid CADMAI WebGl-Publisher Revit export license (SingleWebGlRevitExportLic)
 * a valid CADMAI WebGl-Publisher Inventor export license (SingleWebGlInventorExportLic)
 * or a written permission of CADMAI Software GmbH 
 *
 * The redistributor / user does not have the right to change, translate,
 * back-develop, decompile or disassemble the software.
 * 
 * Redistributions must retain the above copyright notice, 
 * this list of conditions and the following disclaimer.
 *   
 * Neither the name of CADMAI Software GmbH nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 "\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74";var xO=function(){this.sj="";this.Xu=null;this._n=null;this.id="";};var CmiLayerBrowser=function(Ch,bN){var Y_=null;var Am=null;var wg=null;var w2=Ch;var T0=0;var T9="\x4c\x61\x79\x65\x72";Am=document.getElementById(bN);var Ut=function(a,b){if(a.sj==b.sj)return 0;else if(a.sj<b.sj)return-1;else return 1;};this.buildLayerList=function(wC,sort,mJ,MD){var _W;var Zq;var WM=0;var pn=true;if((wC==null)||(Am==null))return-1;wg=wC;if((MD==undefined)||(MD.length==0))T9=wg.getModelName();else T9=MD;Y_=new Array();Zq=wg.getLayerCollection();for(var G=0;G<Zq.length;G++){pn=Zq[G].contentVisible;WM++;_W=new xO();_W._n=Zq[G];_W.sj=Zq[G].getLayerName();_W.id="\x4c\x61\x79"+WM.toString();Y_.push(_W);}if(sort)Y_.sort(Ut);if(mJ>=1){T0=mJ;}};this.clearContent=function(){var body=Am.getElementsByTagName("\x74\x62\x6f\x64\x79")[0];while(body.hasChildNodes()){body.removeChild(body.firstChild);}Y_=null;wg=null;};this.switchCollectionState=function(EZ){if((Y_==null)||(Am==null))return-1;var u1=EZ.split("\x2d");if(u1[0]=="\x63\x6f\x6c\x6c\x61\x70\x73")T0=1;else T0=2;return this.rebuildLayerViewTable();};this.switchVisibilityState=function(EZ){if((Y_==null)||(Am==null))return-1;var u1=EZ.split("\x2d");var EP=null;var IC=document.getElementById(EZ);EP=Ux(Y_,u1[1]);if(EP!=null){if(IC.checked){EP._n.contentVisible=true;}else{EP._n.contentVisible=false;EP._n.contentHighlighted=false;}if(wg)wg.getCmiWindow().drawScene();return this.rebuildLayerViewTable();}return-1;};this.switchHighlightState=function(EZ){if((Y_==null)||(Am==null))return-1;var u1=EZ.split("\x2d");var EP=null;var IC=document.getElementById(EZ);EP=Ux(Y_,u1[1]);if(EP!=null){if(IC.checked){if((EP._n)&&(EP._n.contentVisible))EP._n.contentHighlighted=true;}else{EP._n.contentHighlighted=false;}if(wg)wg.getCmiWindow().drawScene();return this.rebuildLayerViewTable();}return-1;};var Ux=function(Io,Zf){var EP=null;for(var G=0;G<Io.length;G++){if(Io[G].id==Zf)return Io[G];}return null;};this.rebuildLayerViewTable=function(){if((Y_==null)||(Am==null))return-1;var body=Am.getElementsByTagName("\x74\x62\x6f\x64\x79")[0];while(body.hasChildNodes()){body.removeChild(body.firstChild);}if(Y_.length>0){if(T0>0){Tj(body,T9);lp(body,Y_,"\x26\x6e\x62\x73\x70\x3b\x26\x6e\x62\x73\x70\x3b");}else{lp(body,Y_,"");};}var k="\x43\x4d\x49\x5f\x49\x4e\x46\x4f\x7c\x4c\x61\x79\x65\x72\x56\x69\x65\x77\x55\x70\x64\x61\x74\x65\x64\x7c"+"";var DX=CmiHelpers.FT(k,0);Am.dispatchEvent(DX);return 0;};var Tj=function(A6,sj){var uI;var b9;var Wv="";var prefix="";uI=document.createElement("\x74\x72");b9=document.createElement("\x74\x64");if(T0==2)Wv="\x3c\x63\x6f\x64\x65\x3e"+prefix+"\x3c\x2f\x63\x6f\x64\x65\x3e"+"\x3c\x61\x20\x69\x64\x3d\x22\x63\x6f\x6c\x6c\x61\x70\x73\x2d\x43\x6f\x6c\x6c\x65\x63\x74\x6f\x72"+"\x22\x20\x6f\x6e\x63\x6c\x69\x63\x6b\x3d\x22\x6a\x61\x76\x61\x73\x63\x72\x69\x70\x74\x3a"+w2+"\x2e\x73\x77\x69\x74\x63\x68\x43\x6f\x6c\x6c\x65\x63\x74\x69\x6f\x6e\x53\x74\x61\x74\x65\x28\x27\x63\x6f\x6c\x6c\x61\x70\x73\x2d\x43\x6f\x6c\x6c\x65\x63\x74\x6f\x72\x27\x29\x22\x3e\x3c\x63\x6f\x64\x65\x3e\x2d\x26\x6e\x62\x73\x70\x3b\x3c\x2f\x63\x6f\x64\x65\x3e"+sj+"\x3c\x2f\x61\x3e\x26\x6e\x62\x73\x70\x3b";else Wv="\x3c\x63\x6f\x64\x65\x3e"+prefix+"\x3c\x2f\x63\x6f\x64\x65\x3e"+"\x3c\x61\x20\x69\x64\x3d\x22\x65\x78\x70\x61\x6e\x64\x2d\x43\x6f\x6c\x6c\x65\x63\x74\x6f\x72"+"\x22\x20\x6f\x6e\x63\x6c\x69\x63\x6b\x3d\x22\x6a\x61\x76\x61\x73\x63\x72\x69\x70\x74\x3a"+w2+"\x2e\x73\x77\x69\x74\x63\x68\x43\x6f\x6c\x6c\x65\x63\x74\x69\x6f\x6e\x53\x74\x61\x74\x65\x28\x27\x65\x78\x70\x61\x6e\x64\x2d\x43\x6f\x6c\x6c\x65\x63\x74\x6f\x72\x27\x29\x22\x3e\x3c\x63\x6f\x64\x65\x3e\x2b\x26\x6e\x62\x73\x70\x3b\x3c\x2f\x63\x6f\x64\x65\x3e"+sj+"\x3c\x2f\x61\x3e\x26\x6e\x62\x73\x70\x3b";b9.style.cursor="\x70\x6f\x69\x6e\x74\x65\x72";b9.innerHTML=Wv;uI.appendChild(b9);b9=document.createElement("\x74\x64");Wv="";b9.innerHTML=Wv;uI.appendChild(b9);b9=document.createElement("\x74\x64");Wv="";b9.innerHTML=Wv;uI.appendChild(b9);A6.appendChild(uI);return 0;};var lp=function(A6,Io,prefix){var uI;var b9;var Wv="";if(T0==1)return 0;for(var G=0;G<Io.length;G++){uI=document.createElement("\x74\x72");b9=document.createElement("\x74\x64");Wv="\x3c\x63\x6f\x64\x65\x3e"+prefix+"\x3c\x2f\x63\x6f\x64\x65\x3e"+Io[G].sj;b9.innerHTML=Wv;uI.appendChild(b9);b9=document.createElement("\x74\x64");if(Io[G]._n.contentVisible)Wv="\x3c\x69\x6e\x70\x75\x74\x20\x74\x79\x70\x65\x3d\x27\x63\x68\x65\x63\x6b\x62\x6f\x78\x27\x20\x69\x64\x3d\x27\x53\x68\x2d"+Io[G].id+"\x27\x20\x6f\x6e\x63\x6c\x69\x63\x6b\x3d\x22\x6a\x61\x76\x61\x73\x63\x72\x69\x70\x74\x3a"+w2+"\x2e\x73\x77\x69\x74\x63\x68\x56\x69\x73\x69\x62\x69\x6c\x69\x74\x79\x53\x74\x61\x74\x65\x28\x27\x53\x68\x2d"+Io[G].id+"\x27\x29\x22\x20\x63\x68\x65\x63\x6b\x65\x64\x3e\x3c\x2f\x69\x6e\x70\x75\x74\x3e";else Wv="\x3c\x69\x6e\x70\x75\x74\x20\x74\x79\x70\x65\x3d\x27\x63\x68\x65\x63\x6b\x62\x6f\x78\x27\x20\x69\x64\x3d\x27\x53\x68\x2d"+Io[G].id+"\x27\x20\x6f\x6e\x63\x6c\x69\x63\x6b\x3d\x22\x6a\x61\x76\x61\x73\x63\x72\x69\x70\x74\x3a"+w2+"\x2e\x73\x77\x69\x74\x63\x68\x56\x69\x73\x69\x62\x69\x6c\x69\x74\x79\x53\x74\x61\x74\x65\x28\x27\x53\x68\x2d"+Io[G].id+"\x27\x29\x22\x3e\x3c\x2f\x69\x6e\x70\x75\x74\x3e";b9.innerHTML=Wv;uI.appendChild(b9);b9=document.createElement("\x74\x64");if(Io[G]._n.contentHighlighted)Wv="\x3c\x69\x6e\x70\x75\x74\x20\x74\x79\x70\x65\x3d\x27\x63\x68\x65\x63\x6b\x62\x6f\x78\x27\x20\x69\x64\x3d\x27\x48\x6c\x2d"+Io[G].id+"\x27\x20\x6f\x6e\x63\x6c\x69\x63\x6b\x3d\x22\x6a\x61\x76\x61\x73\x63\x72\x69\x70\x74\x3a"+w2+"\x2e\x73\x77\x69\x74\x63\x68\x48\x69\x67\x68\x6c\x69\x67\x68\x74\x53\x74\x61\x74\x65\x28\x27\x48\x6c\x2d"+Io[G].id+"\x27\x29\x22\x20\x63\x68\x65\x63\x6b\x65\x64\x3e\x3c\x2f\x69\x6e\x70\x75\x74\x3e";else Wv="\x3c\x69\x6e\x70\x75\x74\x20\x74\x79\x70\x65\x3d\x27\x63\x68\x65\x63\x6b\x62\x6f\x78\x27\x20\x69\x64\x3d\x27\x48\x6c\x2d"+Io[G].id+"\x27\x20\x6f\x6e\x63\x6c\x69\x63\x6b\x3d\x22\x6a\x61\x76\x61\x73\x63\x72\x69\x70\x74\x3a"+w2+"\x2e\x73\x77\x69\x74\x63\x68\x48\x69\x67\x68\x6c\x69\x67\x68\x74\x53\x74\x61\x74\x65\x28\x27\x48\x6c\x2d"+Io[G].id+"\x27\x29\x22\x3e\x3c\x2f\x69\x6e\x70\x75\x74\x3e";b9.innerHTML=Wv;uI.appendChild(b9);A6.appendChild(uI);}return 0;};};
