/*
	$Id:
*/

function isTargetPlugin(pnm, pvn) {
	var result = false;
	if ( typeof(navigator.plugins) != "undefined" ) {
		if ( typeof(navigator.plugins[pnm]) != "undefined" ) {
			for (var i=0; i<=parseInt(pvn)*5; i++) {
				if ( navigator.plugins[pnm].description.indexOf(i+".0",0) != -1 ) result = i;
			}
		}
	}
	return result;
}
if (document.all && navigator.userAgent.indexOf("Win",0) != -1 && navigator.userAgent.indexOf("Opera",0) == -1) {
	document.writeln('<script type="text/VBscript">');
	document.writeln('Function isPlugin(plugName, targetVer)');
	document.writeln('	Dim i, plg, range');
	document.writeln('	On Error Resume Next');
	document.writeln('	isPlugin = False');
	document.writeln('	range = targetVer * 5');
	document.writeln('	For i=range To 0 Step -1');
	document.writeln('		Set plg = CreateObject(plugName & "." & i)');
	document.writeln('		if IsObject(plg) Then');
	document.writeln('			isPlugin = CStr(i)');
	document.writeln('			isPlugin = i');
	document.writeln('			Exit For');
	document.writeln('		End If');
	document.writeln('	Next');
	document.writeln('End Function');
	document.writeln('</sc'+ 'ript>');
}

function PluginDetection() {
	this.targetPlugName = "";
	this.targetVersion = 0;
	this.resultVersion = 0;
}
PluginDetection.prototype.pluginNameConv = function() {
	if (arguments[0].indexOf("Shockwave",0) != -1 && arguments[0].indexOf("Flash",0) != -1 ) {
		if (document.all && navigator.userAgent.indexOf("Win",0) != -1 && navigator.userAgent.indexOf("Opera",0) == -1) return "ShockwaveFlash.ShockwaveFlash";
		else return "Shockwave Flash";
	} else {
		return arguments[0];
	}
}
PluginDetection.prototype.setTargetPlugVersion = function(version) {
	if (!!version && version > 0) this.targetVersion = version;
}
PluginDetection.prototype.setTargetPlugName = function(nm) {
	if (!!nm) this.targetPlugName = this.pluginNameConv(nm);
}
PluginDetection.prototype.getPlugVersion = function() {
	if (document.all && navigator.userAgent.indexOf("Win",0) != -1 && navigator.userAgent.indexOf("Opera",0) == -1) {
		this.resultVersion = isPlugin( this.targetPlugName, this.targetVersion);
	} else {
		this.resultVersion = isTargetPlugin( this.targetPlugName, this.targetVersion);
	}
	return this.resultVersion;
}
PluginDetection.prototype.getAssessment = function() {
	if (document.all && navigator.userAgent.indexOf("Win",0) != -1 && navigator.userAgent.indexOf("Opera",0) == -1) {
		this.resultVersion = isPlugin( this.targetPlugName, this.targetVersion);
	} else {
		this.resultVersion = isTargetPlugin( this.targetPlugName, this.targetVersion);
	}
//	alert( this.resultVersion );
	return ( this.resultVersion >= this.targetVersion)? true : false ;
}
