var     browser=0;
if ( document.all ) browser=1; else if ( document.layers ) browser=2;


  function pluginDetected() {
    if ( browser == 1 ) { 
      document.writeln('<SCRIPT LANGUAGE="VBScript"\>');
      document.writeln('on error resume next');
      document.writeln('ipix1 = IsObject(CreateObject("IPIX.Viewers.5"))');
      document.writeln('ipix2 = IsObject(CreateObject("IPIX.ActiveXCtrl.2"))');
      document.writeln('ipix3 = IsObject(CreateObject("IPIX.ActiveXCtrl.5"))');
      document.writeln('If ipix1 = True or ipix2 = True or ipix3 = True Then');
      document.writeln('ipixmode = 1');
      document.writeln('Else');
      document.writeln('ipixmode = 0');
      document.writeln('End if');
      document.writeln('</SCRIPT\>');
      return ipixmode;
    } else if ( browser == 2 ) { 
      navigator.plugins.refresh(true);
      numPlugins = navigator.plugins.length;
      if (numPlugins > 0) {
        for (k = 0; k < numPlugins; k++) {
          plugin = navigator.plugins[k];
          if (plugin.description.indexOf("IPIX") != -1) {
            numTypes = plugin.length;
            for (j = 0; j < numTypes; j++) {
              mimetype = plugin[j];
              if (mimetype)       {
                if (mimetype.enabledPlugin && (mimetype.suffixes.indexOf("ipx") != -1)) {
                  return 1;
                }
              }
            }
          }
        }
      }
      return 0;
    }
  }

   function isjavainstalled(){
	    if(browser==2) return true;
		if(oClientCaps)
		if(oClientCaps.isComponentInstalled("{08B0E5C0-4FCB-11CF-AAA5-00401C608500}","componentid") ||  oClientCaps.isComponentInstalled("MSJava","ProgID")) return true;
		return false;
   }

  function putIPX(fname,width,height){ 
    if ( browser == 1 ) { 
      document.writeln('      <object id="IpixX1" width="' + width + '" height="' + height + '"');
      document.writeln('        CLASSID="CLSID:11260943-421B-11D0-8EAC-0000C07D88CF"');
      document.writeln('        CODEBASE="http://www.ipix-i.com/download/ipixx.cab#version=6,2,0,5" name="ipix" vspace="0" hspace="0"');
      document.writeln('        border="0">');
      document.writeln('        <param name="_Version" value="65536">');
      document.writeln('        <param name="_ExtentX" value="11924">');
      document.writeln('        <param name="_ExtentY" value="9278">');
      document.writeln('        <param name="_StockProps" value="0">');
      document.writeln('        <param name="IPXFILENAME" value="ipix/' + fname +'">');
      document.writeln('      </object>');
    } else if ( browser == 2 ) { 
      document.writeln('      <embed src="' + fname + '"');
      document.writeln('        width="' + width + '" height="' + height + '" palette="FOREGROUND"');
      document.writeln('        type="application/x-ipix"');
      document.writeln('        pluginspage="http://www.ipix.com/cgi-bin/download.cgi"');
      document.writeln('        name="ipix" vspace="0" hspace="0" border="0"');
      document.writeln('        _version="65536" _extentx="11924" _extenty="9278"');
      document.writeln('        _stockprops="0" ipxfilename="' + fname + '">');
      document.writeln('      </embed>');
    }
  }

  function putHotmedia(fname,width,height){
    document.writeln(' <APPLET codebase="hotmedia" CODE="hm35.class" NAME="HotMedia" WIDTH="'+width+'" HEIGHT="'+height+'"  MAYSCRIPT>');
    document.writeln('          <param name="mvrfile" value="../hotmedia/' + fname + '">');
    document.writeln('          <PARAM NAME="../minimarket.html" value="winopen_1()">');
    document.writeln('          <PARAM NAME="../indoorpool.html" value="winopen_2()">');
    document.writeln('          <PARAM NAME="../gamesroom.html" value="winopen_3()">');
    document.writeln('          <PARAM NAME="../grandmasters.html" value="winopen_4()">');
    document.writeln('          <PARAM NAME="../loungebar.html" value="winopen_5()">');
    document.writeln('          <PARAM NAME="../studio.html" value="winopen_6()">');
    document.writeln('          <PARAM NAME="../twobedroom.html" value="winopen_7()">');
    document.writeln(' </APPLET>');
  }

  function putJava(fname,width,height){
    document.writeln('      <applet archive="IpixViewer.jar" name="IpixViewer" code="IpixViewer.class"');
    document.writeln('        width="' + width + '" height="' + height + '" vspace="0" hspace="0">');
    document.writeln('        <param name="URL" value="ipix/' + fname + '">');
    document.writeln('        <param name="SpinSpeed" value="5">');
    document.writeln('        <param name="SpinStyle" value="flat">');
    document.writeln('      </applet>');
  }

  function putError(fname,width,height) {
	  document.writeln('<div style="width:'+width+'px; height:'+height+'px; background: url(preview/'+fname+'.jpg) top left no-repeat;">');
   
  }

  function warn(msg) {
    if ( browser>0 ) {
      
    } else {
      putError(fname,width,height);
    }
  }


    function putipx(fname,width,height) {
	if ( browser>0 ) {

		if ( navigator.javaEnabled() && isjavainstalled() ) putJava(fname+".ipx",width,height);
		else {

			if (pluginDetected()) 
				putIPX(fname+".ipx",width,height);
			else 
				putError(fname,width,height);

		}
			

    } else {
      putError(fname,width,height);
    }
  }

















