// openWindow function

function openWindow(windowURL,windowLevel){
  var versionString=navigator.appVersion, app=navigator.appName, versionNum=parseFloat(versionString), macFlag=false;
	if ((app.indexOf('Netscape') != -1) && (versionString.indexOf("Macintosh") != -1)) {
		macFlag=true;
	}
//grab url to pass to forms (case 2)
	var url = location.href
	var locationurl = url.slice(7)

	switch(windowLevel){
		case (1):
			window.open(windowURL, 'mainWin')
			break
		case (2):
			if (macFlag==true) {
				window.open(windowURL+'&referringurl='+locationurl, 'quizformPop', 'width=440,height=500,scrollbars=1,status=1');
			} else {
				window.open(windowURL+'&referringurl='+locationurl, 'quizformPop', 'width=430,height=500,scrollbars=1');
			}
			break
		case (3):
			window.open(windowURL, 'studyPop', 'width=700,height=295,scrollbars=0');
			break
		case (4):
			if (macFlag==true) {
				window.open(windowURL, 'widePop', 'width=700,height=500,scrollbars=1,status=1')
			} else {
				window.open(windowURL, 'widePop', 'width=700,height=500,scrollbars=1')
			}
			break
		case (5):
			if (macFlag==true) {
				window.open(windowURL, 'narrowPop', 'width=456,height=500,scrollbars=1,status=1')
			} else {
				window.open(windowURL, 'narrowPop', 'width=456,height=500,scrollbars=1')
			}
			break
		case (6):
			if (macFlag==true) {
				window.open(windowURL, 'auxPop', 'width=700,height=500,scrollbars=1,status=1')
			} else {
				window.open(windowURL, 'auxPop', 'width=700,height=500,scrollbars=1')
			}
			break
		case (7):
			if (macFlag==true) {
				window.open(windowURL, 'ratPop', 'width=371,height=250,scrollbars=1,status=1')
			} else {
				window.open(windowURL, 'ratPop', 'width=371,height=250,scrollbars=1')
			}
			break
		case (12):
			if (macFlag==true) {
				window.open(windowURL, 'quizformPopXtra', 'width=440,height=500,scrollbars=1,status=1');
			} else {
				window.open(windowURL, 'quizformPopXtra', 'width=430,height=500,scrollbars=1');
			}
			break
		case (13):
			if (macFlag==true) {
				window.open(windowURL, 'studyPopXtra', 'width=700,height=295,scrollbars=1,status=1')
			} else {
				window.open(windowURL, 'studyPopXtra', 'width=700,height=295,scrollbars=1')
			}
			break
		case (14):
			if (macFlag==true) {
				window.open(windowURL, 'widePopXtra', 'width=700,height=500,scrollbars=1,status=1')
			} else {
				window.open(windowURL, 'widePopXtra', 'width=700,height=500,scrollbars=1')
			}
			break
		case (15):
			if (macFlag==true) {
				window.open(windowURL, 'narrowPopXtra', 'width=456,height=500,scrollbars=1,status=1')
			} else {
				window.open(windowURL, 'narrowPopXtra', 'width=456,height=500,scrollbars=1')
			}
			break
		case (16):
			if (macFlag==true) {
				window.open(windowURL, 'auxPopXtra', 'width=700,height=500,scrollbars=1,status=1')
			} else {
				window.open(windowURL, 'auxPopXtra', 'width=700,height=500,scrollbars=1')
			}
			break
		default:
			alert("Invalid windowLevel (" + windowLevel + ") in openWindow")
	}
}

// printing script

function printWindow() {
  var versionString=navigator.appVersion, app=navigator.appName, versionNum=parseFloat(versionString);
	if ((versionString.indexOf('MSIE 5') != -1) && (versionString.indexOf("Macintosh") != -1)) {
		alert('Sorry, printing from the page isn\'t supported in Internet Explorer for Macintosh.\rThis is either a programmer\'s honest mistake or a covert Microsoft plot to take over the world.\rPrint using the print button or go to "Print..." in the file menu.')
	} else {
		window.print();
	}
}

