var wwh=screen.width /2;
var whh=screen.height /2;
var ww=screen.width -5;
var wh=screen.height -5;
var qfspage1="1-qfs.htm";
var qsspage1="1-q.htm";
var qfspage2="2-qfs.htm";
var qsspage2="2-q.htm";
var qfspage3="3-qfs.htm";
var qsspage3="3-q.htm";
var qfspage4="4-qfs.htm";
var qsspage4="4-q.htm";

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function uff1() {
	window.open("360/1-q.htm","vr1",'width=720,height=450,resizable=no');
}

function hilfeq() {
	window.open("hilfe/hilfe-q.htm","hilfe",'width=500,height=550,scrollbars=yes');
}

function hilfej() {
	window.open("hilfe/hilfe-j.htm","hilfe",'width=500,height=550,scrollbars=yes');
}

function hilfed() {
	window.open("hilfe/hilfe-d.htm","hilfe",'width=500,height=550,scrollbars=yes');
}

function qfs1()
{
	window.moveTo(0,0)
	window.resizeTo(ww,wh)
	window.location.replace(qfspage1)
}

function qss1()
{
	window.resizeTo(728,494)
	window.moveTo(wwh -300,whh -210)
	window.location.replace(qsspage1)
}

function qfs2()
{
	window.moveTo(0,0)
	window.resizeTo(ww,wh)
	window.location.replace(qfspage2)
}

function qss2()
{
	window.resizeTo(728,494)
	window.moveTo(wwh -300,whh -210)
	window.location.replace(qsspage2)
}

function qfs3()
{
	window.moveTo(0,0)
	window.resizeTo(ww,wh)
	window.location.replace(qfspage3)
}

function qss3()
{
	window.resizeTo(728,494)
	window.moveTo(wwh -300,whh -210)
	window.location.replace(qsspage3)
}

function qfs4()
{
	window.moveTo(0,0)
	window.resizeTo(ww,wh)
	window.location.replace(qfspage4)
}

function qss4()
{
	window.resizeTo(728,494)
	window.moveTo(wwh -300,whh -210)
	window.location.replace(qsspage4)
}

function zu() {
	self.close();
}

var minQTVersion = "5.0.0";			//sets minimal version checked for QuickTime
var minDevalVRVersion = "0.2.9.20"; //sets minimal version checked for DevalVR
var devalVRpage="1-d.htm"; //sets the html page to open if DevalVR is installed
var installpage="1-j.htm"; //sets the html page to open if any plugins are not installed

var isIE=(document.all!=null && navigator.userAgent.indexOf('Opera')==-1);
var isWindows=(navigator.platform.indexOf('Win')!=-1);
var pluginDevalVRInstalled = 0;
var pluginQTInstalled = 0;

function openvrpage(devalurl,installurl)
{
	devalVRpage=devalurl;
	installpage=installurl;
	
	if(isWindows)
	{
		if (!isIE) 
		{
			if (navigator.mimeTypes && navigator.mimeTypes["application/x-devalvrx"] && navigator.mimeTypes["application/x-devalvrx"].enabledPlugin)
			{
				var words = navigator.plugins["DevalVR 3D Plugin"].description.split(" ");
				var version = words[3].split(",");
				var min = minDevalVRVersion.split(".");
				for (var i = 0; i < 4; i++)
				{
					if(parseInt(version[i])>parseInt(min[i])) 
					{
						pluginDevalVRInstalled=1;
						break;
					}
					else if(parseInt(version[i])<parseInt(min[i]))
					{
						break;
					}
					else if(parseInt(version[i])==parseInt(min[i]) && i==3)
						pluginDevalVRInstalled=1;
				}
			}	
		    if(navigator.mimeTypes && navigator.mimeTypes["video/quicktime"] && navigator.mimeTypes["video/quicktime"].enabledPlugin)
		    {
				var qtnumber=-1;
				for (var i = 0; i < navigator.plugins.length; i++)
				{
					if(navigator.plugins[i].name.indexOf("QuickTime Plug-in")!=-1)
					{
						qtnumber=i;
						break;
					}
				}
				if(qtnumber!=-1)
				{
					var words = navigator.plugins[qtnumber].name.split(" ");
					var version = words[2].split(".");
					var min = minQTVersion.split(".");
					for (var i = 0; i < 3; i++)
					{
						if(parseInt(version[i])>parseInt(min[i])) 
						{
							pluginQTInstalled=1;
							break;
						}
						else if(parseInt(version[i])<parseInt(min[i]))
						{
							break;
						}
						else if(parseInt(version[i])==parseInt(min[i]) && i==2)
							pluginQTInstalled=1;
					}
				}
			}
		}
		else 
		{
			try{
				devalvrobj=new ActiveXObject('DevalVRXCtrl.DevalVRXCtrl.1');
				if(devalvrobj) 
				{
					pluginDevalVRInstalled=1;
				}
			}catch(e){}
			try
			{
				objQuickTime=new ActiveXObject('QuickTimeCheckObject.QuickTimeCheck.1');
				if (objQuickTime)
				{
					if(objQuickTime.IsQuickTimeAvailable(0))
					{
						pluginQTInstalled=1;
					}
				}
			}catch(e){}
		}
		if (pluginQTInstalled) 
		{
			//Do nothing, continue in this page (QuickTime page)
		} 
		else if(pluginDevalVRInstalled)
		{
			//Jump to DevalVR page
			window.location.replace(devalVRpage);
		}
		else
		{
			//Jump to installation page
			window.location.replace(installpage);
		}
	}
}

var klick="";
function clickIE() {if (document.all) {(klick);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(klick);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
