/* * techexploror.js * Copyright (c) 2004 Integre Technical Publishing. All Rights Reserved. * * Email to techexplorer@integretechpub.com. * */ function isNetscape() { return navigator.appName == "Netscape"; } function isIE() { return navigator.appName == "Microsoft Internet Explorer"; } function isIntroPluginNetscape( ) { if ( !isNetscape() ) return false; return navigator.plugins["Integre techexplorer Hypermedia Browser, Introductory Edition"] != null; } function isProPluginNetscape( ) { if ( !isNetscape() ) return false; var bPro = (navigator.plugins["Integre techexplorer Hypermedia Browser [Trial Version], Professional Edition"] != null || navigator.plugins["Integre techexplorer Hypermedia Browser, Professional Edition"] != null); return bPro; } function isActiveXControl( ) { if ( !isIE() ) return false; var aObjects = document.body.all.tags("OBJECT"); if (aObjects.length > 0) { i = 0; while ( aObjects.length > i) { if (aObjects[i].classid == "clsid:5AFAB315-AD87-11D3-98BB-002035EFB1A4") { return true; } i++; } } return false; } function isTEJavaEnabled() { if ( (isNetscape() && isProPluginNetscape()) || isActiveXControl() ) { return true; } return false; } function setTEDimensions(dummyTE, latexString, width, oldheight) { if ( isTEJavaEnabled() ) { newheight = 0; count = 0; while ( !dummyTE.isReady() ); newheight = dummyTE.getHeightFromTeXStringAndWidth( latexString, width ); } else { newheight = oldheight; } return newheight; } function displayAutosizeLaTeX(dummyTE, latexString, defaultWidth, defaultHeight) { var content = AutosizeLaTeXString(dummyTE, latexString, defaultWidth, defaultHeight) document.write( content ); document.close(); } function AutosizeLaTeXString(dummyTE, latexString, defaultWidth, defaultHeight) { var content = ""; if (isActiveXControl()) { content += ""; content += ""; content += ""; content += ""; content += ""; } else { width = 0; height = 0; depth = 0; count = 0; if (isNetscape() && isProPluginNetscape()) { while ( !dummyTE.isReady() ); width = dummyTE.getWidthFromTeXString( latexString ); height = dummyTE.getHeightFromTeXString( latexString ); depth = dummyTE.getDepthFromTeXString( latexString ); } else { width = defaultWidth; height = defaultHeight; depth = defaultHeight/2; } content = content + ""; } return content; } function displayLaTeXWithFixedWidth(dummyTE, latexString, width, height, controlName, pluginName) { var newheight = setTEDimensions(dummyTE, latexString, width, height ) content = ""; if (isActiveXControl()) { content = content + ""; content = content + " "; content = content + " "; content = content + ""; } else { content = content + ""; content = content + ""; } document.write( content ); document.close(); }