// JavaScript Document
	newWindow= window
	var panelHeight=0
	var panelWidth=0
	var version=""
	var versionType = ""
	var versionNum = "0"
	var MS=""
	var goforit=false
	var query=""

	panelWidth = window.screen.width-8
	if (document.all) {panelWidth-=2}
	panelHeight = window.screen.height-8
	//if (document.all) {panelHeight-=20}

	//alert(panelHeight)

	if(panelHeight>1050 && panelHeight<1200){panelHeight=1180}
	else if(panelHeight>850 && panelHeight<1025){panelHeight=1004}
	else if(panelHeight>750 && panelHeight<865){panelHeight=844}
	else if(panelHeight>600 && panelHeight<769){panelHeight=748}
	else if(panelHeight>480 && panelHeight<601){panelHeight=580}
	else if(panelHeight>400 && panelHeight<481){panelHeight=460}

	function checkVersion(){
		self.name="main"
		if (panelWidth<700 || panelHeight<500){
			alert("We are very sorry, Vutest has been optimised\nfor use only with a minimum display setting of 800 x 600\n\nClick on OK for instructions on how to change the setting.")
			location.href="smallscreen.htm"
		}
		else if(navigator.userAgent.indexOf('Opera') > -1) {
			versionType="o"
			if(navigator.userAgent.indexOf('Opera 7') > -1){versionNum="7"}else{versionNum="0"}
			version = versionType + versionNum
		}
		else if(navigator.appVersion.indexOf('AOL') > -1) {
			version="AOL"
		}
		else if (navigator.appName.indexOf('Netscape') > -1) {
			versionType = 'n'
			versionNum = navigator.appVersion.substring(0,1)
			version = versionType + versionNum
		}
		else if (navigator.appVersion.indexOf('MSIE') > -1) {
			versionType = 'e'
			MS = navigator.appVersion.indexOf('MSIE')
			versionNum = navigator.appVersion.substring(MS+5, MS+6)
			version = versionType + versionNum
		}

		goforit=true
	}

	function openWindowCom(queryversion){
		if(queryversion==1){openWindow2ComDemo()}else{openWindow2Com()}
	}

	function openWindow(type){
		if(version=="n5" || version=="n6" || version=="e5" || version=="e6" || version=="o7"){
			if(version=="o7"){
				alert("Switch Opera to Full Screen View by keying F11 now. Key F11 to return when the tests are completed.")
			}
			document.getElementById("idwait").style.visibility="visible"
			document.getElementById("links").style.visibility="hidden"
			document.getElementById("vline").style.visibility="hidden"
			if(query=="com"){
				setTimeout("openWindow2Com()",2000)
			}
			else{
				setTimeout("openWindow2()",2000)
			}
			setTimeout("deleteMarquee()",30000)
		}
		else if(version=="AOL"){
			location.href="aoletc.htm"
		}
		else if(panelWidth<700){
			alert("We are very sorry, Vutest has been optimised\nfor use only with Internet Explorer with a\nminimum display setting of 800 x 600\n\nClick OK for instructions on how to use Internet Explorer")
			location.href="ieetc.htm"
		}
		else if(query=="com"){
			openWindow2Com()
			query=""
		}
		else{
			openWindow2()
		}
	}

	function openWindow2(){
			newWindow=window.open('PersonalTest/page0.aspx','newWindow','resizable=no,scrollbars=no,titlebar=no,toolbar=no,menubar=no,left=0,top=0,width='+panelWidth+',height='+panelHeight)
			isPopupBlocker()
	}
	
	function openToddlerWin(){
			newWindow=window.open('/TodlerTest/page0.aspx','newWindow','resizable=no,scrollbars=no,titlebar=no,toolbar=no,menubar=no,left=0,top=0,width='+panelWidth+',height='+panelHeight)
			isPopupBlocker()
	}

	function openWindow2Com(){
			newWindow=window.open('/vutest/com/page0.htm','newWindow','resizable=no,scrollbars=no,titlebar=no,toolbar=no,menubar=no,left=0,top=0,width='+panelWidth+',height='+panelHeight)
			isPopupBlocker()
	}

	function openWindow2ComDemo(){
			newWindow=window.open('/vutest/com/page0.php?type=demo','newWindow','resizable=no,scrollbars=no,titlebar=no,toolbar=no,menubar=no,left=0,top=0,width='+panelWidth+',height='+panelHeight)
			isPopupBlocker()
	}

	function deleteMarquee(){
		document.getElementById("idwait").style.visibility="hidden"
		document.getElementById("links").style.visibility="visible"
		document.getElementById("vline").style.visibility="visible"
	}

	function closeWindow(){
			if(newWindow && !newWindow.closed){
				newWindow.close()
				self.name=""
				}
			}

	function isPopupBlocker() {
		if (newWindow==null || typeof(newWindow)=="undefined") {
			alert("Please allow popups for this eye test to function.\n\nClick OK,\nand then Click on the yellow pop up bar near the\ntop of your screen.")

			return true
		} else {
			return false
		}
	}
