var _ver="04.00.01.10",
aol=0,
_child,
_app=navigator.appName,
isIE4=(_app=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion.substring(0,1))>=4),
isNN=(_app.indexOf("Netscape")!=-1),isIE=(_app.indexOf("Microsoft")!=-1),
_agt=navigator.userAgent.toLowerCase(),_bv=parseInt(navigator.appVersion),
isWin=(_agt.indexOf('win')!=-1),isMac=(_agt.indexOf('mac')!=-1),isNN6=(_bv>=5),
_mime="application/x-mtx",_cv=hFF=_mc=_dbg=_sdr=0,
NNtrigger="0",_pU,_cID="CLSID:03F998B2-0E00-11D3-A498-00104B6EB52E",
_newID="CLSID:1B00725B-C455-4DE6-BFB6-AD540AD427CD",
_gnns=_gac=_gurl=_gnam=_gprp="",
_dv="http://www.viewpoint.com/developerzone/download/",
_re=_dv+'redirector.html?',_N="none",_TR="Trigger",_rtyp=1,
_IC="ISceneComponent",_CF="ComponentFileName",_SC="SceneComponent.mtc",_BK="BroadcastKeyFileURL",
_bU=_dv+'vet_install_popup_'
MTSPlugin.prototype.genid=0
if(isMac)_pU=_bU+"mac.html"
else{_gurl=_bU+"ns.html";_gnam="vet_install"
	_gprp="width=500,height=400,toolbar=no,location=no,resizable=no"
	_pU="Javascript:MTSopenBrWindow(_gurl,_gnam,_gprp)"
}
if(isIE4&&(!(isMac)))document.write("<SCRIPT LANGUAGE=\"VBScript\">\nDim p_o\nFunction ie_chk(n)\nie_chk=1\nOn Error Resume Next\nSet p_o=CreateObject(n)\nif IsObject(p_o) then\nie_chk=0\nend if\nEnd Function\n</SCRIPT>\n")
function MTSDebugger(i){_dbg=i}
function MTSConsole(msg){_mtsConsole()}
function c_i(){if(isIE4||(isNN&&!isNN6)){if(_child.closed){_isin=IsMTSInstalled();if(_isin)location.reload();}else setTimeout("c_i()",1000)}}
function MTSopenBrWindow(u,n,f){_child=window.open(u,n,f);setTimeout("c_i()",1000)}
function mimeAndPluginReady(mimetype,pluginName){
	for(var i=0;i<navigator.plugins.length;i++){
		if(navigator.plugins[i].name.toLowerCase()==pluginName.toLowerCase()){
			for(var j=0;j<navigator.plugins[i].length;j++){
				var mim=navigator.plugins[i][j]
				if(mim.enabledPlugin&&(mim.type==mimetype)){
					if(aol==1)_cID=_newID
					return true
				}
			}
			return false
		}
	}
	return false
}
function testAx(){var x="AxMetaStream.MetaStreamCtl"
	if((aol==1)&&(ie_chk(x+"Secondary")==0)){_cID=_newID;return true}
	if(ie_chk(x)==0) return true
	if((aol==0)&&(ie_chk(x+"Secondary")==0)){_cID=_newID;return true}
	return false
}
function IsMTSInstalled(){var i=true,m="MetaStream"+(isMac?"3":" 3 Plugin")
	if(isIE4&&(!(isMac)))i=testAx()
	else i=mimeAndPluginReady(_mime,m)
	return i
}
var _isin=IsMTSInstalled();
MTSPlugin.prototype.createParams=function(pi){this.newParamString=""
	var cMV="50332936",gMV="50332496";this.LN=_N;var parms=""
	if(pi!=null){var tA=pi.split(";")
		for(var i=0;i<tA.length;i++){
			if(tA[i]!=""){var tV=tA[i].split("=");re= / /g;
				tV[0]=tV[0].replace(re,"");var tv0l=tV[0].toLowerCase()
				if(tv0l=="genieminimumversion"){tV[1]=tV[1].replace(re,"");gMV=tV[1]}
				else if(tv0l=="componentminimumversion"){tV[1]=tV[1].replace(re,"");cMV=tV[1]}
				else if(tv0l=="classid"){tV[1]=tV[1].replace(re,"");_cID=tV[1]}
				else if(tv0l=="layer"){tV[1]=tV[1].replace(re,"");this.LN=tV[1]}
				else if(tv0l=="nntrigger"){tV[1]=tV[1].replace(re,"");NNtrigger=tV[1]}
				else if(tv0l=="contenttype"){tV[1]=tV[1].replace(re,"");_rtyp=tV[1]}
				else if(tv0l=="imagelink"){tV[1]=tV[1].replace(re,"");this.ImageLink=tV[1]}
				else if(tv0l=="popup"){tV[1]=tV[1].replace(re,"");this.popUp=tV[1]}
				else{var idx=1,token1=tV[idx-1],token2=tV[idx];idx++
					while (tV[idx]!=null){token2+="="+tV[idx];idx++}
					parms+=AddParm(token1,token2)
					this.newParamString+=token1+"="+token2+";"
				}
			}
		}
	}
	parms+=AddParm("ComponentMinimumVersion",cMV);parms+=AddParm("GenieMinimumVersion",gMV);parms+=AddParm("VMPClassID",_cID);parms+=AddParm("PageURL",window.location.href)
	this.newParamString+="parentlocation="+parent.location
	return parms
}
function AddParm(n,v){if(isIE&&isWin)return MTSParm(n,v);else return (n+" = "+"'"+v+"' ")}
function GetCookie(a){var e,m=" "+document.cookie+";",N=" "+a+"=",s=m.indexOf(N);if(s!=1){s+=N.length;e=m.indexOf(";",s);return (unescape(m.substring(s,e)))}}
function SetCookie(n,v){document.cookie=n+"="+escape(v)}
function ClearCookie(n){var e=new Date();e.setTime(e.getTime()-(3*24*60*60*1000));document.cookie=n+"=ImOutOfHere; expires="+e.toGMTString()}
function MTS_IsString(s){if(s=="")return true;for(var i=0;i<s.length;i++){if(((s.charAt(i)<"0")||(s.charAt(i)>"9"))&&(s.charAt(i)!=".")&&(s.charAt(i)!="-"))return true}return false}
function MTSWrapValue(v){var rs=v.toString();if(MTS_IsString(rs))rs="'"+rs+"'";return rs}
function MTSPlugin(file,width,height,bkey,alt,parmsc){
	if((alt.toLowerCase()=="classic")||(alt.toLowerCase()=="none")){alt=_N;if(MTSPlugin.prototype.genid==0)NNtrigger="1"}
	var str=_N,na=this.name="MetaCtl"+MTSPlugin.prototype.genid.toString()
	MTSPlugin.prototype.genid++;this.LN=_N;	this.ImageLink="0"
	var parms=this.createParams(parmsc)
	if((alt.length!=0)&&(!_isin))str=alt
	if((NNtrigger=="1")&&(_cv==0)&&isNN)TriggerJS()
	if((((str.toLowerCase()==_N)&&(!isMac))||((GetCookie(na)=="1")&&(!isMac)))&&((!(this.popUp=="1"))||(str.toLowerCase()==_N))||(_isin)){
		if(isWin&&isIE){var ch
			if(file!="")ch=MTSParm("Source",file)
			ch+=MTSParm("Component",_IC)+MTSParm(_CF,_SC)+MTSParm(_BK,bkey)
			ch+=parms;ch+=MTSParm("properties",this.newParamString)
			var cbURL="https://components.viewpoint.com/MTSInstallers/MetaStream3.cab"+"?url="+window.location.href+"#Version=3,0,2,62"
			str=MTSMarkup("object",ch,"id",na,"classid",_cID,"width",width,"height",height,((MTSPlugin.prototype.genid==1)?"codebase":"dummy"),cbURL)
			if(_dbg==1)MTSConsole(str,na)
			document.write(str)
		}else{var tag
			if((isMac)&&(isNN)&&(!_isin))tag="PLUGINSPAGE"
			else if((isMac)&&(isIE)&&(!_isin))MTSJumpToRedirector(this.LN)
			else tag="PluginURL"
			str=MTSMarkup("embed","<properties='"+this.newParamString+"'>","component",_IC,"componentfilename",_SC,"source",file,"type",_mime,"width",width,"height",height,"border",true,"script",true,"name",na,tag,_pU,_BK,bkey,parms)
			if(this.LN!=_N){
				if(_dbg==1)MTSConsole(str,this.name)
				if(isIE)document.write(str)
				else{_gnns=str;var v="document."+this.LN+".document.write(_gnns);";eval(v)}
			}else{
				if(_dbg==1)MTSConsole(str,na)
				document.write(str)
			}
			if(GetCookie(na+_TR)=="1"){ClearCookie(na+_TR)
				if(this.popUp!='1')TriggerJS()
			}
		}
		if(this.ImageLink=="1")ClearCookie(na)
	}else{
		if((this.ImageLink!="1"&&this.popUp=="1")||((GetCookie(na)=="1")&&(this.popUp=="1"))||(str.toLowerCase()=="popup")||(isMac&&((str==_N)||(GetCookie(na)=="1")))){
			if(this.ImageLink=="1")ClearCookie(na)
			if((alt!=_N)&&(alt.toLowerCase()!="popup")){_gac=alt
				if((isNN)&&(this.LN!=_N)){var outStr="document."+this.LN+".document.write(_gac);"
					if(_dbg==1)MTSConsole(outStr,na)
					eval(outStr)
				}else{
					if(_dbg==1)MTSConsole(alt,na)
					document.write(alt)
				}
			}
			MTSJumpToRedirector(this.LN)
		}else{
			if(this.ImageLink=="1")str=MTSMarkup("A",str,"HREF","JavaScript:mtsClick();")
			_gac=str
			if((isNN)&&(this.LN!=_N)){var outStr="document."+this.LN+".document.write(_gac);"
				if(_dbg==1)MTSConsole(outStr,na)
				eval(outStr)
			}else{
				if(_dbg==1)MTSConsole(str,na)
				document.write(str)
			}
		}
	}
	if(isMac&&isIE){
		if(hFF==0){document.write("<div id='HiddenLayer' style='position:absolute;left:-1000px;top:-1000px;width:0px;height:0;z-index:0;visibility:hidden'><form name='MTS3'><input type=text name='mts3_js_jsfield'></form></div>")
			setInterval('ExecValue()',3);hFF=1
		}
	}
}
function mtsClick(){var t=""
	for(var i=0;i<MTSPlugin.prototype.genid;i++){t="MetaCtl"+i.toString();SetCookie(t,'1');if((isNN))SetCookie(t+_TR,'1')}
	location.reload()
}
function ExecValue(){document.MTS3.mts3_js_jsfield.value="MTS3_Req";var v=document.MTS3.mts3_js_jsfield.value;
	if((v!="")&&(v!="MTS3_Req")){eval(v);v="";document.MTS3.mts3_js_jsfield.value=""}
	if(v=="MTS3_Req")document.MTS3.mts3_js_jsfield.value=""
}
MTSPlugin.prototype.Console=function(m){_mtsConsole(m,this._mtsPID())}
MTSPlugin.prototype.Execute=function(){return this._mtsCall()}
MTSPlugin.prototype.SetProperty=function(n,p,v,t){return this.Execute("SetProperty",n,p,MTSWrapValue(v),t)}
MTSPlugin.prototype.GetProperty=function(n,p,t){return this.Execute("GetProperty",n,p,t)}
MTSPlugin.prototype.TriggerAnim=function(a){return this.Execute("TriggerAnimation",_anim(a))}
MTSPlugin.prototype.ReverseAnim=function(a){return this.Execute("ReverseAnimation",_anim(a))}
MTSPlugin.prototype.StopAnim=function(a){return this.Execute("StopAnimation",_anim(a))}
MTSPlugin.prototype.StartAnim=function(a){return this.Execute("StartAnimation",_anim(a))}
MTSPlugin.prototype.ResetAnim=function(a){return this.Execute("ResetAnimation",_anim(a))}
MTSPlugin.prototype.ToggleCollapse=function(n){return this.Execute("ToggleCollapsed",_inst(n))}
MTSPlugin.prototype.SetCollapsed=function(n,v){return this.SetProperty(_inst(n),'clps',MTSWrapValue(v),'mts_int')}
MTSPlugin.prototype.ToggleVisible=function(n){return this.Execute("ToggleVisible",_inst(n))}
MTSPlugin.prototype.SetVisible=function(n,v){return this.SetProperty(_inst(n),'visb',MTSWrapValue(v),'mts_int')}
MTSPlugin.prototype.ClearScene=function(){return this.Execute("ClearScene")}
MTSPlugin.prototype.TogglePano=function(v){return this.Execute("TogglePano",MTSWrapValue(v))}
MTSPlugin.prototype.Render=function(){return this.Execute("Render")}
MTSPlugin.prototype.LoadMTX=function(p){return this.Execute("LoadMTX",p)}
MTSPlugin.prototype.ResetCamera=function(){return this.Execute("ResetCamera")}
MTSPlugin.prototype.GetVer=function(c){return this.Execute("GetVersion",c)}
MTSPlugin.prototype.GetLastErrCode=function(){return this.Execute("GetLastErrCode")}
MTSPlugin.prototype.GetLastPluginErr=function(t){return this.Execute("GetLastPluginErr",t)}
MTSPlugin.prototype.SetPluginErr=function(t,v){return this.Execute("SetPluginErr",t,v)}
MTSPlugin.prototype.GetAllPluginErrFor=function(t){return this.Execute("GetAllPluginErrFor",t)}
MTSPlugin.prototype.ClearAllPluginErrs=function(t){return this.Execute("ClearAllPluginErrs",t)}
MTSPlugin.prototype.PostEvent=function(n,d){var a=arguments,x=d;for(var i=2;i<a.length;i++)x+=(","+arguments[i]);return this.Execute("PostEvent",n,x)}
function MTSMarkup(tag,c){var a=arguments
	if(a.length==0)return ""
	var i,s="<"+a[0]
	for(i=2;i<a.length;i+=2){
		if(a[i+1]!=null)s+=(" "+a[i]+"=\'"+a[i+1]+"\'")
		else s+=" "+a[i]
	}
	s+=(c.length?(">"+c+"</"+a[0]+">"):("/>"))
	return s
}
function MTSParm(n,v){return MTSMarkup("param","","name",n,"value",v.toString())}
MTSPlugin.prototype._mtsPID=function(){return this.name}
function _mtsConsole(){if(_dbg!=1)return;var a=(arguments.length==0)?arguments.caller:arguments;var ct=a.length
	if(ct==0)return
	var msg=a[0].toString(),
		pn=(ct==1)?"Default":((a[1].constructor==MTSPlugin)?a[1].name:a[1].toString())
	if(_mc==0){
		_mc=window.open("","console","width=300,height=300,resizable,scrollbars")
		_mc.document.write('<title>debug_output<\/title><plaintext>');
		_mc.focus()
	}
	if(!_mc.closed)_mc.document.writeln(pn+"> "+msg)
}
function _anim(n){var s='MTSAnimator.';return n.indexOf(s)==0?n:s+n}
function _inst(n){var s='MTSInstance.';return n.indexOf(s)==0?n:s+n}
MTSPlugin.prototype._mtsCall=function(){var ar=(arguments.length==0)?arguments.caller:arguments
	var c=ar.length
	if(++c<2){alert('too little arguments for functions call');return false}
	var rg=ar[0]+'(',l=c-2,i,li=c-1,pn=this._mtsPID()
	for(i=1;i<li;i++){
		rg+=ar[i]
		if(i<l)rg+=','
	}
	rg+=')'
	var pID=pn,r,replace= /MetaCtl/i;
	pID=pID.replace(replace,"")
	if(isMac&&isIE){var s=("MTS3_JS"+pn+":"+(rg)+";"),x='document.MTS3.mts3_js_jsfield.value=s;'
		eval(x)
		r=document.MTS3.mts3_js_jsfield.value;document.MTS3.mts3_js_jsfield.value=""
		if(_dbg==1)MTSConsole(s)
	}else{var p
		if(isWin&&isIE)p='document.all.'+pn+'.PluginCommand(\"'+rg+'\",0,0);'
		else{if(this.LN==_N)p='document.'+pn+'.DoCommand(\"'+rg+'\");'
			else p='document.'+this.LN+'.document.embeds.'+pn+'.DoCommand(\"'+rg+'\");'
		}
		r=eval(p)
		if(_dbg==1)MTSConsole(rg,pn)
	}
	return r
}
function MTSJumpToRedirector(ln){
	if(_sdr<1){_sdr++
		var t="var _FS='left='+Math.round((screen.availWidth-500)/2)+',top='+Math.round((screen.availHeight-400)/2)+',width='+500+',height='+400+',toolbar=no,location=no,resizable=no';_child=window.open(_re+_rtyp,'install_win',_FS);setTimeout('c_i()',1000);if(isIE)var mtsWindowTimer=setInterval('mtsChangeStatus()',500);var _mt=0;function mtsChangeStatus(){if(_mt==0){_child.status=window.location.href;_mt++;}}"
		var mtsWS=MTSMarkup("script",t,"language","javascript")
		if(_dbg==1)MTSConsole(mtsWS)
		if((isNN)&&(ln!="none")){_child=window.open(_re+_rtyp,'install_win','width=500,height=400,toolbar=no,location=no,resizable=no');setTimeout("c_i()",1000)}
		else document.write(mtsWS)
	}
}
function TriggerJS(){NNtrigger="0"
	var sp="https://components.viewpoint.com/MTSInstallers/MetaStream3.jar"+"?url="+window.location.href,_cv=2
	if(_app=="Netscape"&&parseInt(navigator.appVersion.substring(0,1))>=4&&navigator.platform=="Win32"&&navigator.javaEnabled()){
		tr=netscape.softupdate.Trigger
		if(tr.UpdateEnabled()){upd=true
			if((mimeType=navigator.mimeTypes[_mime])!=null&&(plugin=mimeType.enabledPlugin)!=null){
				descr_str=String(plugin.description)
				li=descr_str.lastIndexOf("r")
				if(li>=0){vers=parseInt(descr_str.substring(li+1).toString())
					if(!isNaN(vers)&&vers>=_cv)upd=false
				}
			}
			if(upd)tr.StartSoftwareUpdate(sp,tr.DEFAULT_MODE)
		}
	}
}
