
var	browserName=navigator.appName;
var	browserVer=parseInt(navigator.appVersion);
var	version ;

if(browserVer >=4)
	version="4";
else
	version="3";

// if (version=="4") {
	var	bullet_on=new Image;
	bullet_on.src="http://www.meniscus.com/cexpress06/images/menubutton-on.gif";
	var	bullet_off=new Image;
	bullet_off.src="http://www.meniscus.com/cexpress06/images/menubutton-off.gif";
// }
/* ------------------------------------------------------------------------ */
	function	chartPop(pProject, pState, pDiv) {
		var	x = new Array(840,600) ;
		var	y = new Array((screen.width-x[0])/2, (screen.height-x[0])/2) ;
		window.open('chart.asp?project=' + pProject + '&state=' + pState + '&div=' + pDiv, 'chart', 'resizable=yes, scrollbars=yes, status=yes, width='+x[0]+',height='+x[1]+', left='+y[0]+', top='+y[1]) ;
	}
/* ------------------------------------------------------------------------ */
function	contentEdit(pID) {
	var	u = 'http://www.meniscus.com/cexpress06/asp/maintenance/contentedit.asp'
	var	x = new Array(880,660) ;
	var	y = new Array((screen.width-x[0])/2, (screen.height-x[0])/2) ;
	window.open(u+'?id=' + pID, 'contentEdit'+pID, 'resizable=yes, scrollbars=yes, status=yes, width='+x[0]+',height='+x[1]+', left='+y[0]+', top='+y[1]) ;
}
/* ------------------------------------------------------------------------ */
function displayDiv(pDiv) {
	var	i, j, k, o, x, y, z ;
	var	george = new Array('GeorgeBlack','GeorgeBlue','GeorgeOrange','GeorgeGreen') ;
	y = pDiv.split(",") ;
	with(document) {
		x = getElementsByTagName('div') ;
		k = new Array(x.length, y.length) ;
		for (i = 0; i < k[0]; i++) {
			with (x[i]) {
				for(j = 0; j < k[1]; j++) {
					if (id == y[j]) {
						if (George) {
							className = className + ' ' + george[j] ;
						}
						style.display = 'block' ;
						if (id == y[y.length-1]) {
							style.backgroundColor = 'White' ;
							window.scrollTo(0,offsetTop)
}	}	}	}	}	}	}
/* ------------------------------------------------------------------------ */
function	finish(pProj) {
	var	i, j, k, o, x, y, z ;
	if (Module1 + Module2 == 2) {
		with (document) {
			x = getElementById('caseboth') ;
			if (x != null) {
				with (x) {
					style.display = 'block' ;
		}	}	}
	} else if (Module1 == 1) {
		with (document) {
			x = getElementById('case01') ;
			if (x != null) {
				with (x) {
					style.display = 'block' ;
		}	}	}
	} else if (Module2 == 1) {
		with (document) {
			x = getElementById('case02') ;
			if (x != null) {
				with (x) {
					style.display = 'block' ;
}	}	}	}	}
/* ------------------------------------------------------------------------ */
function FrontMatter(pAnchor) {
	var	i, j, k, o, x, y, z ;
// if George { alert(pAnchor) ; }
	getFrontMatter(pAnchor) ;
	x = top.RMiddle.document.body.getElementsByTagName('div') ;
	j = x.length ;
	for (i=0; i < j; i++) {
		with (x[i]) { className = (id == pAnchor) ? 'displayon' : 'displayoff' ; }
	}
	if (pAnchor == 'start') {
//		FrontStart() ;
}	}
/* ------------------------------------------------------------------------ */
function FrontStart() {
	var	i, j, k, o, x, y, z ;
	var	bModule1 = false ;
	var	bModule2 = false ;
	var	sCase01 = 'case01' ;
	var	sCase02 = 'case02' ;
	x = new String('ICE' + Project + '=') ;
	i = x.length ;
	y = document.cookie.split('; ') ;
	for (j=0; j < y.length; j++) {
		z = unescape(y[j]) ;
		if (x == z.substr(0,i)) {
			x = z.substr(i).split('&') ;
			y = 'module1=' ;
			for (i=0 ; i < x.length; i++) {
				z = x[i].substr(0,y.length) ;
				if (z == y) {
					bModule1 = true ;
					break ;
			}	}
			y = 'module2=' ;
			for (i=0 ; i < x.length; i++) {
				z = x[i].substr(0,y.length) ;
				if (z == y) {
					bModule2 = true ;
					break ;
			}	}
			break ;
	}	}
	with (top.RMiddle.document) {
		if (bModule1) {
			x = getElementsByTagName('span') ;
			j = x.length ;
			for (i=0; i < j; i++) {
				with (x[i]) {
					if (id == sCase01) {
						style.visibility = 'visible' ;
		}	}	}	}
		if (bModule2) {
			x = getElementsByTagName('span') ;
			j = x.length ;
			for (i=0; i < j; i++) {
				with (x[i]) {
					if (id == sCase02) {
						style.visibility = 'visible' ;
		}	}	}	}
		x = getElementById('assess') ;
		if ( x != null) {
			with (x) {
				y = 'Javascript: void(0);' ;
				if (bModule1 && bModule2) {
					y ='Javascript: FrontMatter(\'learn\');' ;
				} else {
				}
				href = y ;
}	}	}	}
/* ------------------------------------------------------------------------ */
function getFrontMatter(pAnchor) {
	var	i, j, k, o, x, y, z ;
	x = new String(top.RMiddle.document.location.href) ;
	y = new String('&state=') ;
	z = new String('&state=2') ;
	with (x) {
		i = indexOf(y)
		y = slice(i) ;
		if (y != z) {
			y = slice(0,i) + z + '#' + pAnchor ;
			top.RMiddle.document.location = y ;
}	}	}
/* ------------------------------------------------------------------------ */
function	insertFigure(pProj,pFig) {
	var	i, j, k, o, x, y, z ;
	x  = '<nobr>(<span class="imagelink" ' ;
	x += 'onmouseover="javascript: document.getElementById(\'fig' + pFig +'\').className=\'displayon\'">Figure ' + pFig +'</span>)</nobr> ' ;
	x += '<span id="fig' + pFig + '" class="displayoff">' ;
	x += '<p class="clickon">Click on image to hide<br>' ;
	x += '<img border="1" ' ;
	x += 'onclick="javascript: document.getElementById(\'fig' + pFig + '\').className=\'displayoff\'; return(false)" ' ;
	x += 'src=\'../images/' + pProj + '/Figure' + pFig + '.jpg\'><br>' ;
	x += '</p></span>' ;
	document.write(x) ;
// alert(x) ;
}
/* ------------------------------------------------------------------------ */
function	insertTable(pProj,pTbl) {
	var	i, j, k, o, x, y, z ;
	x  = '(<span class="imagelink" ' ;
	x += 'onmouseover="javascript: document.getElementById(\'tbl' + pTbl +'\').className=\'displayon\'">Table ' + pTbl +'</span>) ' ;
	x += '<span id="tbl' + pTbl + '" class="displayoff">' ;
	x += '<p class="clickon">Click on image to hide<br>' ;
	x += '<img border="1" ' ;
	x += 'onclick="javascript: document.getElementById(\'tbl' + pTbl + '\').className=\'displayoff\'" ' ;
	x += 'src=\'../images/' + pProj + '/Table' + pTbl + '.jpg\'><br>' ;
	x += '</p></span>' ;
	document.write(x) ;
// alert(x) ;
}
/* ------------------------------------------------------------------------ */
function LogOut() {

	var strURL ;

	if (confirm("Log-out of CExpress?")) {
//		alert("You chose to logout") ;
		strURL = "Control.asp?s=16" ;
		top.CExpress.Control.location.replace(strURL) ;
}	}
/* ------------------------------------------------------------------------ */
function outAbbreviations() {
	with (parent.Bottom.btnAbbreviation) {
		src='http://www.meniscus.com/cexpress06/images/btn-abbreviations.gif';
}	}

/* ------------------------------------------------------------------------ */
function outAns(pAnswer) {
	var	i, j, k, o, w, x, y, z ;
	var	bcolor = 'White' ;
	var	fcolor = 'Black' ;
	with (parent) {
		with (RMiddle) {
			with (document) {
				y = new Array('ansa','ansb','ansc','ansd') ;
				if ((x = getElementById(y[pAnswer])) != null) {
					with (x.style) {
						backgroundColor = bcolor ;
						color           = fcolor ;
						textDecoration  = 'none' ;
		}	}	}	}
		with (RBottom) {
			with (document) {
				y = new Array('btna','btnb','btnc','btnd') ;
				z = new Array('a','b','c','d') ;
				if ((x = getElementById(y[pAnswer])) != null) {
					x.src='http://www.meniscus.com/cexpress06/images/btn-' + z[pAnswer] + '.gif';
}	}	}	}	}

/* ------------------------------------------------------------------------ */
function outBack() {
	var	i, j, k, o, x, y, z ;
	with (document) {
		x = getElementById('btnBack') ;
		if (x != null) {
			with (x) {
				src='http://www.meniscus.com/cexpress06/images/btn-back.gif';
}	}	}	}

/* ------------------------------------------------------------------------ */
function outBtn(pAnswer) {
	var	i, j, k, o, x, y, z ;
	var	bcolor = 'White' ;
	var	fcolor = 'Black' ;
	y = new String(pAnswer) ;
	y = y.toLowerCase() ;
	with (parent) {
		with (RBottom) {
			z = new String('btn' + y)
			with (document) {
				if ((x = getElementById(z)) != null) {
					with (x) {
						src='http://www.meniscus.com/cexpress06/images/btn-' + y + '.gif';
		}	}	}	}
		with (RMiddle) {
			z = new String('ans' + y) ;
			with (document) {
				if ((x = getElementById(z)) != null) { ;
					with (x.style) {
						backgroundColor = bcolor ;
						color           = fcolor ;
						textDecoration  = 'none' ;
}	}	}	}	}	}

/* ------------------------------------------------------------------------ */
function outChart() {
	with (parent.Bottom.btnChart) {
		src='http://www.meniscus.com/cexpress06/images/btn-patient-chart.gif';
}	}

/* ------------------------------------------------------------------------ */
function outReferences() {
	with (parent.Bottom.btnReference) {
		src='http://www.meniscus.com/cexpress06/images/btn-references.gif';
}	}

/* ------------------------------------------------------------------------ */
function outResources() {
	with (parent.Bottom.btnResource) {
		src='http://www.meniscus.com/cexpress06/images/btn-resources.gif';
}	}

/* ------------------------------------------------------------------------ */
function overAbbreviations() {
	with (parent.Bottom.btnAbbreviation) {
		src='http://www.meniscus.com/cexpress06/images/btn-abbreviations-select.gif';
}	}

/* ------------------------------------------------------------------------ */
function overAns(pAnswer) {
	var	i, j, k, o, w, x, y, z ;
	var	bcolor = 'White' ;
	var	fcolor = 'Blue' ;

	with (parent) {
		with (RMiddle) {
			with (document) {
				y = new Array('ansa','ansb','ansc','ansd') ;
				if ((x = getElementById(y[pAnswer])) != null) {
					with (x.style) {
						backgroundColor = bcolor ;
						color           = fcolor ;
						textDecoration  = 'underline' ;
		}	}	}	}
		with (RBottom) {
			with (document) {
				y = new Array('btna','btnb','btnc','btnd') ;
				z = new Array('a','b','c','d') ;
				if ((x = getElementById(y[pAnswer])) == null) { alert('no button') ; alert(pAnswer) ; }
				if ((x = getElementById(y[pAnswer])) != null) {
					x.src='http://www.meniscus.com/cexpress06/images/btn-' + z[pAnswer] + '-select.gif';
}	}	}	}	}

/* ------------------------------------------------------------------------ */
function overBack() {
	var	i, j, k, o, x, y, z ;
	with (document) {
		x = getElementById('btnBack') ;
		if (x != null) {
			x.src='http://www.meniscus.com/cexpress06/images/btn-back-select.gif';
}	}	}

/* ------------------------------------------------------------------------ */
function overBtn(pAnswer) {
	var	i, j, k, o, x, y, z ;
	var	bcolor = 'White' ;
	var	fcolor = 'Blue' ;
	y = new String(pAnswer) ;
	y = y.toLowerCase() ;
	with (parent) {
		with (RBottom) {
			z = new String('btn' + y)
			with (document) {
				if ((x = getElementById(z)) != null) {
					with (x) {
						src='http://www.meniscus.com/cexpress06/images/btn-' + y + '-select.gif';
		}	}	}	}
		with (RMiddle) {
			z = new String('ans' + y) ;
			with (document) {
				if ((x = getElementById(z)) != null) { ;
					with (x.style) {
						backgroundColor = bcolor ;
						color           = fcolor ;
						textDecoration  = 'underline' ;
}	}	}	}	}	}

/* ------------------------------------------------------------------------ */
function overChart() {
	with (parent.Bottom.btnChart) {
		src='http://www.meniscus.com/cexpress06/images/btn-patient-chart-select.gif';
}	}

/* ------------------------------------------------------------------------ */
function overReferences() {
	with (top.Bottom.btnReference) {
		src='http://www.meniscus.com/cexpress06/images/btn-references-select.gif';
}	}

/* ------------------------------------------------------------------------ */
function overResources() {
	with (parent.Bottom.btnResource) {
		src='http://www.meniscus.com/cexpress06/images/btn-resources-select.gif';
}	}

/* ------------------------------------------------------------------------ */
function rollIn(imgName, picName) { document[imgName].src=eval(picName + "on.src"); }
/* ------------------------------------------------------------------------ */
function rollOut(imgName, picName) { document[imgName].src=eval(picName + "off.src"); }
/* ------------------------------------------------------------------------ */
function	SaveAnswer(pProject, pState) {
	var	i, j, k, o, x, y, z ;
	y =  'http://www.meniscus.com/cexpress06/asp/SaveAnswer.asp' ;
	y += '?project=' ;
	y += pProject ;
	y += '&state=' ;
	y += pState ;
	top.frames['Control'].document.location.href= y ;
}
/* ------------------------------------------------------------------------ */
function SaveDiscipline(pProject, pState) {
	var strURL = 'Control.asp?project=' + pProject + '&state=' + pState + '&function=state' ;
	top.Control.location.replace(strURL) ;
}
/* ------------------------------------------------------------------------ */
function showDiscipline() {
	var	i, j, k, o, x, y, z ;
	z = new Array('mnp','med','nurse','pharm') ;
	i = z[0].indexOf(Discipline)
	if (i >= 0) {
		y = z[i+1] ;
		with(document) {
			x = getElementsByTagName('div') ;
			j = x.length ;
			for (i = 0; i < j; i++) {
				with (x[i]) {
					if (id == y) {
						style.display = 'block' ;
}	}	}	}	}	}

/* ------------------------------------------------------------------------ */

function	showImage(pImage) {
	alert('showImage(' + pImage + ')') ;
	window.open('http://www.meniscus.com/cexpress06/images/'+pImage,'image', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=auto');
}

/* ------------------------------------------------------------------------ */
function StartModule( pProject, pState ) {
	var	i, j, k, o, x, y, z ;
	x = top.frames['RMiddle'].document.getElementsByName('discipline') ;
	y = 'http://www.meniscus.com/cexpress06/asp/StartModule.asp?project='+pProject+'&state='+pState+'&discipline='
	j = x.length ;
	for (i=0; i < j; i++) {
		with(x[i]) {
			if (checked) {
				top.frames['Control'].document.location = (y += id) ;
				break ;
	}	}	}
	if (i == j) {
		alert('Please select a discipline') ;
}	}
/* ------------------------------------------------------------------------ */
function StateChange( pProject, pState ) {

	if (George) {
//		alert(pProject) ;
//		alert(pState) ;
	}
	var strURL = 'Control.asp?project=' + pProject + '&state=' + pState + '&function=state' ;
	top.Control.location.replace(strURL) ;
}
/* ------------------------------------------------------------------------ */
function winOpen(url, name) {
  var l = winOpen.arguments.length;
  var w = "";
  var h = "";
  var features = "";

  for (i=2; i<l; i++) {
    var param = winOpen.arguments[i];
    if ( (parseInt(param) == 0) ||
      (isNaN(parseInt(param))) ) {
      features += param + ',';
    } else {
      (w == "") ? w = "width=" + param + "," :
        h = "height=" + param;
  }	}
  features += w + h;
  var code = "popupWin = window.open(url, name";
  if (l > 2) code += ", '" + features;
  code += "')";
  eval(code);
}
