﻿var IpixModule = Class.create(); IpixModule.prototype = { initialize: function(item, width, height, container) { this.index = item.index; this.width = width; this.height = height; this.container = container; this.browser = new Browser(); }, PutIPX: function() { if(!this.browser) { this.PutNoBrowser(); return false; } if(this.pluginDetected()) { this.live_DoFSCommand(); this.PutByPlugIn(); return true; } else return false; }, PutNoBrowser: function() { this.container.innerHTML = "Ошибка при определении типа браузера."; }, pluginDetected: function() { if(this.browser.isIE) { var html = "<script language='VBScript'\>"; html += "on error resume next "; html += "ipix1 = IsObject(CreateObject('IPIX.Viewers.5')) "; html += "ipix2 = IsObject(CreateObject('IPIX.ActiveXCtrl.2')) "; html += "ipix3 = IsObject(CreateObject('IPIX.ActiveXCtrl.5')) "; html += "If ipix1 = True or ipix2 = True or ipix3 = True Then "; html += "ipixmode = 1 "; html += "Else "; html += "ipixmode = 0 "; html += "End if "; html += "</script\>"; this.container.innerHTML = html; return true; } else if (this.browser.isOpera || this.browser.isSafari) { 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 true; } } } } } return false; } }, PutByPlugIn: function() { var str; str = '<em style="position: relative;"><object style="position: absolute; left: -558; top: 0;" id="IpixX1" width='+this.width+' height='+this.height; str += 'classid="CLSID:11260943-421B-11D0-8EAC-0000C07D88CF"'; str += 'codebase="http://www.ipix.com/download/ipixx.cab#version=6,2,0,5">'; if (this.browser.isIE) { str += '<param name="IPXFILENAME" value="/ipix/'+this.index+'.ipx">'; str += '<param name="wmode" value="transparent">'; } else { str += '<embed src="/ipix/'+this.index+'.ipx" border=0 width='+this.width+' height='+this.height+' '; str += 'palette="foreground" type="application/x-ipix" wmode="transparent" '; str += 'pluginsPage="http://www.ipix.com/cgi-bin/download.cgi">'; str += '</embed>'; } str += '</object></em>'; this.container.innerHTML += str; }, IfJavaInstalled: function() { var oClientCaps; if(!this.browser.isIE) return true; oClientCaps = document.body; oClientCaps.style.behavior = "url(#default#clientCaps)"; bMSvmAvailable = oClientCaps.isComponentInstalled("{08B0E5C0-4FCB-11CF-AAA5-00401C608500}","componentid"); return (bMSvmAvailable) ? true : false; }, live_DoFSCommand: function() { var ms = '<object id="IpixX1" width="' + this.width + '" height="' + this.height + '"'; ms += 'classid="clsid:11260943-421B-11D0-8EAC-0000C07D88CF" CODEBASE="http://www.ipix-i.com/download/ipixx.cab#version=6,2,0,5"'; ms += 'name="ipix" vspace="0" hspace="0" border="0">'; ms += '<param name="_Version" value="65536">'; ms += '<param name="_ExtentX" value="11924">'; ms += '<param name="_ExtentY" value="9278">'; ms += '<param name="wmode" value="transparent">'; ms += '<param name="_StockProps" value="0">'; ms += '<param name="IPXFILENAME" value="/ipix/' + this.index + '.ips">'; ms += '<embed src="/ipix/' + this.index + '.ips" width="' + this.width + '" height="' + this.height + '"'; ms += 'wmode="transparent" palette="FOREGROUND" type="application/x-ipix" pluginspage="http://www.ipix.com/cgi-bin/download.cgi" name="ipix" vspace="0" hspace="0" border="0" _version="65536" _extentx="11924"'; ms += '_extenty="9278" _stockprops="0" ipxfilename="/ipix/' + this.index + '.ipx"></embed></object>'; this.container.innerHTML += ms; } };
