coursename = "epmcc"
var backuphistory = 0;
//-------opening popups from glossary page
	var args = new Array ();
	var keys = new Array ();

	var itemcount = 0;
	var CheckForKeyName = "autoinvoke";

	function GetCommandArgs ()
	{
		var url = unescape(window.location.href);
		url = url.replace ("+", " ");

		var pos = url.indexOf ("?");

		var buf1 = "";
		if ( pos >= 0 )
			buf1 = url.substring (pos+1, url.length);

		var buf2 = "";
		var nextpos = 0;

		while ( true )
		{
			buf2 = buf1;
			nextpos = buf1.indexOf ("&");

			if ( nextpos >= 0 )
				buf2 = buf1.substring (0, nextpos);

			// split up the key/value pair
			pos = buf2.indexOf ("=");
			if ( pos >= 0 )
			{
				keys[itemcount] = buf2.substring (0, pos);
				args[itemcount++] = buf2.substring (pos+1, buf2.length);
			}
			else
			{
				keys[itemcount] = buf2;
				args[itemcount++] = "";
			}

			if ( nextpos < 0 )
				break;

			buf1 = buf1.substring (nextpos+1, buf1.length); 
		}

		return;
	}

	function GetArg (argname)
	{
		for ( var i = 0; i < itemcount; i++ )
		{
			if ( keys[i].toUpperCase () == argname.toUpperCase () )
				return (args[i]);
		}

		return ("");
	}


//------end


function storehistory(value)
{
	SetCookie_lab1('history',value,300);
//	window.parent.history = value;
}

// send score
function setScore_lab(value) {
//	alert(value+" Commlab function is called");
	LMSSetValue( "cmi.core.score.raw", value );

}

//get cookie 
function getCookie(NameOfCookie){  
	if (document.cookie.length > 0){
		begin = document.cookie.indexOf(NameOfCookie+"="); 
    		if (begin != -1){
			begin += NameOfCookie.length+1; 
			end = document.cookie.indexOf(";", begin);
			if (end == -1){
				end = document.cookie.length;		
			}return unescape(document.cookie.substring(begin, end)); 
		}
	}return null; 
}
//set cookie  
function setCookie(NameOfCookie,value,expiredays,path) {  
	var ExpireDate = new Date ();
 	ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
  	document.cookie = NameOfCookie + "=" + escape(value) + 
  	((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString()) +
      ((path) ? "; path=" + path : "");
} 
//delete cookie 
function delCookie(NameOfCookie, path){ 
	if (getCookie(NameOfCookie)) {
  		document.cookie = NameOfCookie + "=" + 
    ((path) ? "; path=" + path : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}
//Make an array from cookie
function makeMYarray(myOwnCookie){
	THEnewArray = new Array();

	//JRS 02/26/2004 - in case main.js is loaded into content frame
	if (this.content && content.TestNum) {TestNum = content.TestNum;}

	ArrayNumber = TestNum - 1;
  	//if (ArrayNumber < 0){ArrayNumber = 0;}
  	//else{ArrayNumber = ArrayNumber;}		
	checkCookie = getCookie(coursename + myOwnCookie);
	if (checkCookie == null){return;}
	var broken_info = checkCookie.split(",");
	for (var loop = 0; loop < broken_info.length; loop++){THEnewArray[loop] = broken_info[loop];}
	if (myOwnCookie == "results"){
		myPoints = parseInt(THEnewArray[ArrayNumber]);
		if (isNaN(myPoints)) {myPoints = 0;}
	}

<!-- commlab -->
if(moduleNo!=11 && section!="Contents")
{
	val = getCookie_lab(window.parent.whichquiz);
	if(val.length > 0)
	{
//	alert(val+" how many times");
	window.parent.jumpTopage=0;
	window.parent.jumpTopage = parseInt(val.slice(0, val.indexOf('-')));
	myPoints = parseInt(val.slice(val.indexOf('-')+1,val.length));
	}
}
<!-- commlab -->
	
	return;
}
//open browser window
function MM_openBrWindow(theURL,winName,features) { 
  //v2.0
  wp = window.open(theURL,winName,features);
  wp.focus(); 
  if (wp != null) {
  	if(wp.opener == null) {
		wp.opener = self;}
  }
  wp.document.location.href = theURL;
}
// make link to quizresults
function writeQuizresults(modulenumbers) {
	//JRS 02/26/2004 - in case main.js is loaded into content frame
	if ((this.content && content.specialpage == "html/contents.htm") || this.specialpage == "html/contents.htm"){myDOnow = '<li class="wrapresults"><A HREF = "';}
	if (modulenumbers == 1){pagenumbers = "1047.htm"; TestNum=1;}
	if (modulenumbers == 2){pagenumbers = "2025.htm"; TestNum=2;}
	if (modulenumbers == 3){pagenumbers = "3034.htm"; TestNum=3;}
	if (modulenumbers == 4){pagenumbers = "4031.htm"; TestNum=4;}
	if (modulenumbers == 5){pagenumbers = "5030.htm"; TestNum=5;}
	if (modulenumbers == 6){pagenumbers = "6023.htm"; TestNum=6;}
	if (modulenumbers == 7){pagenumbers = "7022.htm"; TestNum=7;}
	if (modulenumbers == 8){pagenumbers = "8027.htm"; TestNum=8;}
	if (modulenumbers == 9){pagenumbers = "9037.htm"; TestNum=9;}
	if (modulenumbers == 10){pagenumbers = "10037.htm"; TestNum=10;}
	
	makeMYarray("wrapQuizComplete")
	if (THEnewArray[ArrayNumber] == 'true'){
		donow(myDOnow)
		return;
	}		
}
function donow(myhtmlTEXT){
	document.write(myhtmlTEXT + pagenumbers + '">Final Test Results</A>');
	return;
}
//preload images
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];}}
}
//restore images
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;
}
//is images on layers
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;
}
//swap images
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];}
}
//Picks a random pop up quiz
function randompopqz(qz) {
ranNum = 0;
ranNum = Math.floor(Math.random() * 3);
if (ranNum ==0){urlpage="popquiz/qz_" + qz + "_a.htm"};
if (ranNum ==1){urlpage="popquiz/qz_" + qz + "_b.htm"};
if (ranNum ==2){urlpage="popquiz/qz_" + qz + "_c.htm"};
MM_openBrWindow(urlpage,"popquiz","scrollbars=yes,resizable=yes,width=600,height=351");
}
//Make glossary term window
function showGeneralWindow(title,term,defn,glossary,features) {	
  var w = self.open ("", "glossary", ""+features+""); 
  w.focus();
  var d = w.document;   
  d.write('<HTML>');
  d.write('<HEAD>');
  d.write('<title>'+title+'</title>');
  d.write('<link href="../css/contentpages.css" rel="stylesheet" type="text/css">');
//  d.write('<link href="../css/innerpages.css" rel="stylesheet" type="text/css">');
  d.write('</HEAD>');
  d.write('<body id="GeneralWinPages">');
  d.write('<div class="wrapper">');
  d.write('<div id="top"><div class="winsmallright"><a href="javascript: close();" title="Close Window Button. Access Key W" accesskey="W" class="closebtn"></a></div><div class="winsmallleft"><h1 class="winsmalltitle">'+title+'</h1></div></div>');
  d.write('<div id="pagecontent">');
  d.write('<dl>');
  d.write('<dt>' + term);
  d.write('<dd>' + defn);
  d.write('</dl>'); 
  d.write('</div>');
  d.write('</div>');
  d.write('</div>');
  d.write('</BODY>');
  d.write('</HTML>');
  d.close();
}
//Make more info (larger) window
function showInfoWindow(title,info,winname,features) {
  var w = self.open ("", ""+winname+"", ""+features+""); 
  w.focus();
  var d = w.document;   
  d.write('<HTML>');
  d.write('<HEAD>');
  d.write('<title>'+title+'</title>');
  d.write('<link href="../css/contentpages.css" rel="stylesheet" type="text/css">');
//  d.write('<link href="../css/innerpages.css" rel="stylesheet" type="text/css">');
  d.write('</HEAD>');
  d.write('<body id="GeneralWinPages">');
  d.write('<div class="wrapper">');
  d.write('<div id="top"><div class="winsmallright"><a href="javascript: close();" title="Close Window Button. Access Key W" accesskey="W" class="closebtn"></a></div><div class="winsmallleft"><div class="winsmalltitle">&nbsp;&nbsp;'+title+'</div></div></div>');
  d.write('<div id="pagecontent">'+info+'');
  d.write('</div>');
  d.write('</div>');
  d.write('</div>');
  d.write('</BODY>');
  d.write('</HTML>');
  d.close();
}

//------------------------------------------------------
function getCookie_lab1(name) 
{
	var cookieFound = 0;
    var start = 0;
    var end = 0;
    var CookieString = document.cookie;
    var i =0;
    while (i <= CookieString.length) 
	{
    	start = i;
    	end = start + name.length;
        if (CookieString.substring(start,end) == name) 
		{
        	cookieFound = true;
            break;
        }
        i++;
	}
    if (cookieFound) 
	{
    	start = end + 1;
        end = document.cookie.indexOf(";",start);
        if (end < start)
        	end = document.cookie.length;
		return document.cookie.substring(start,end);
	}
    return "";
}
function SetCookie_lab1(cookieName,cookieValue,nDays) 
{
 var today = new Date();
 var expire = new Date();
 if (nDays==null || nDays==0) nDays=1;
 expire.setTime(today.getTime() + 3600000*24*nDays);
// document.cookie = cookieName+"="+escape(cookieValue)+ ";expires="+expire.toGMTString();
document.cookie=cookieName+"="+cookieValue+"; expires=Monday, 04-Apr-2010 05:00:00 GMT;path=/";
}

function clearallhistory()
{
	var h = getCookie_lab1('history');
//	alert(h+" getCookie");
	if(h > 0)
	{
		backuphistory = h;
		SetCookie_lab1('history',0,300);
	}
}
clearallhistory();