// JavaScript Document
	
	var new_Div = document.createElement('div');
var d ;
	







	var checkiftrue = false;
	
	
	
	
	function show_ins(){
	alert("Instructions for Data Entry for DVBE's Shift Schedule\n\nTo make Shift Schedule more accessible to business English learners, DVBE has made this online activity with interactive work tables. You can fill in the data as you listen to the audio or read the text. \n\nEnter data by using the first initial for each cashier; for example, \u0022P\u0022 or \u0022p\u0022 for Pierre and \u0022E\u0022 or \u0022e\u0022 for Elaine. \n\n The \u0022H\u0022 column is for the head cashiers only. The others columns are for the full-timers, part-timers, and trainees. \n\nEnter the data. Check your answer by clicking <Check Answers> at the bottom of the work table. Correct answers are marked yellow. Wrong answers are marked red. Cells that should be unfilled cells and you have left them unfilled will remain white. \n\nTry to fix your mistakes by listening or reading again. But you can check for the correct answer by double-clicking any cell. But don\u0027t cheat! \n\n If you think you have entered the correct answers and the SS program is marking them wrong, shift your answers to a different column and then see how the program marks your work (the program is not perfect). \n\nSaving and loading data will save you time as you move from section to section. You should save your work for each day, for each work table, for each section. Saving will put a cookie on your computer with your answers. Loading data will bring back this cookie. \n\nThe Shift Schedule cookies have only your Shift Schedule information. They collect no other information. \n\nTo clear data from a particular section, but keep data from a previous section, follow these steps: (1) Load Data, (2) Start Over, (3) Load Data again. You will get only the data you entered from the previous section.\n\n Remember, save your data for each day, each worktable, each section.");	}
		
		
	
	
	




	


			

			  function loadXMLDoc(dname)
									{
									try //Internet Explorer
									  {
									  xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
									  }
									catch(e)
									  {
									  try //Firefox, Mozilla, Opera, etc.
										{
										xmlDoc=document.implementation.createDocument("","",null);
										}
									  catch(e) {alert(e.message)}
									  }
									try
									  {
									  xmlDoc.async=false;
									  xmlDoc.load(dname);
									  return(xmlDoc);
									  }
									catch(e) {alert(e.message)}
									return(null);
									} 	
					
				

	function check_ans(whatbox){
		try{
			
				var sname = document.getElementById('scripts').innerHTML;
					var xmlDoc=loadXMLDoc("calc/" + sname + ".xml");
					var s = xmlDoc.getElementsByTagName(whatbox)[0].childNodes[0].nodeValue;
					return s;
					
		}catch (err){
			
			alert(err);
			
			
			}
				
					
				}
				
				
			function qc(xmldata,txtbox){
			
	

				try{
			
			var xmldata = check_ans(xmldata);
			if (document.getElementById(txtbox).value != ""){
			var str = document.getElementById(txtbox).value.toLowerCase();
			} else {
				str = document.getElementById(txtbox).value;}
			
			if (document.getElementById(txtbox).disabled == false){
				
			 if(str == xmldata   ){
				document.getElementById(txtbox).style.backgroundColor = "yellow";
				
				

				
					
			} else if(str == "" && xmldata == "blank") {
				document.getElementById(txtbox).style.backgroundColor = "";
		
				
			} else{
				document.getElementById(txtbox).style.backgroundColor = "red";
				
				
				}
		
			}
				}catch(err){
					alert(err)}
		
				
				
			}
								
					
		
		
			
		
			
	
			
			
			
			
			function checkday(whichday){
				
				checkiftrue = true;
				
				var i;
					var x;
					try{
					for (i=0,x=1;i<=14,x<=14;i++,x++){
					
					
					if (document.getElementById(i + "p" + x + "_"+whichday+"_h") != null){
					if (document.getElementById(i + "p" + x + "_"+whichday+"_h").disabled == false){
		         	qc(whichday + 'h' + i + 'p' + x, i + 'p' + x + '_'+whichday+'_h');}}
 				    
					
					if (document.getElementById(i + "to" + x + "_"+whichday+"_h") != null){
					if (document.getElementById(i + "to" + x + "_"+whichday+"_h").disabled == false){
					qc(whichday + 'h' + i + 'to' + x, i + 'to' + x + '_'+whichday+'_h');}}
					
					if (document.getElementById(i + "p" + x + "_"+whichday+"_1") != null){
					if (document.getElementById(i + "p" + x + "_"+whichday+"_1").disabled == false){
					qc(whichday + '1' + i + 'p' + x, i + 'p' + x + '_'+whichday+'_1');	}}
					
					if (document.getElementById(i + "to" + x + "_"+whichday+"_1") != null){
					if (document.getElementById(i + "to" + x + "_"+whichday+"_1").disabled == false){
					qc(whichday + '1' + i + 'to' + x, i + 'to' + x + '_'+whichday+'_1');	}}
					
					if (document.getElementById(i + "p" + x + "_"+whichday+"_2") != null){
				if (document.getElementById(i + "p" + x + "_"+whichday+"_2").disabled == false ){
					qc(whichday + '2' + i + 'p' + x, i + 'p' + x + '_'+whichday+'_2');}}
					
						if (document.getElementById(i + "to" + x + "_"+whichday+"_2") != null){
					if (document.getElementById(i + "to" + x + "_"+whichday+"_2").disabled == false){
				qc(whichday + '2' + i + 'to' + x, i + 'to' + x + '_'+whichday+'_2');}}
					
					if (document.getElementById(i + "to" + x + "_"+whichday+"_3") != null){
					if (document.getElementById(i + "to" + x + "_"+whichday+"_3").disabled == false){
				qc(whichday + '3' + i + 'to' + x, i + 'to' + x + '_'+whichday+'_3');}}
				
				if (document.getElementById(i + "p" + x + "_"+whichday+"_3") != null){
					if (document.getElementById(i + "p" + x + "_"+whichday+"_3").disabled == false){
				qc(whichday + '3' + i + 'p' + x, i + 'p' + x + '_'+whichday+'_3');}}
				
				if (document.getElementById(i + "to" + x + "_"+whichday+"_4") != null){
					if (document.getElementById(i + "to" + x + "_"+whichday+"_4").disabled == false){
				qc(whichday + '4' + i + 'to' + x, i + 'to' + x + '_'+whichday+'_4');}}
				
				if (document.getElementById(i + "p" + x + "_"+whichday+"_4") != null){
					if (document.getElementById(i + "p" + x + "_"+whichday+"_4").disabled == false){
				qc(whichday + '4' + i + 'p' + x, i + 'p' + x + '_'+whichday+'_4');}}
				
					
					}
					}catch(err){
						alert(err);
					
						}
						
				
				
				
			
				
				
			}
			
			
				
		function show_ans(from){
		
		if (checkiftrue == true)
		{
				
					var from = check_ans(from);
					alert(from);
					
					}
					else
					{
						
						alert("No Cheating!");
					
						
						}
		
	}
	
				
		
				
			
					
		
	
					
					
				
		
	
	

		
				
				function setFocus(event, txt)
								{
								if (event.keyCode==13) {
								document.getElementById(txt).focus();
								}
								}
								
								
								
								function mouseX(evt) {
			if (evt.pageX) return evt.pageX;
			else if (evt.clientX)
			   return evt.clientX + (document.documentElement.scrollLeft ?
			   document.documentElement.scrollLeft :
			   document.body.scrollLeft);
			else return null;
			}
			function mouseY(evt) {
			if (evt.pageY) return evt.pageY;
			else if (evt.clientY)
			   return evt.clientY + (document.documentElement.scrollTop ?
			   document.documentElement.scrollTop :
			   document.body.scrollTop);
			else return null;
			}	
			
			
			
			
		

function create_Alert(event,id,msg){
	try{
	d = id;
		var evt = event;
	var msg = new String(msg);
	
	if (mouseY(evt) <= "190" && document.getElementById(id).clientHeight >= "20"   ) 
	
	{
		alert(msg);
		
	} else {
	
	
	if(document.getElementById(id) == null ){
	new_Div.innerHTML = "<div class=\"div_Top\" ><span class=\"spn_close\" onclick=\"cl()\"></span></div><div class=\"div_Mid\" id=\"dm\" >"+msg+"</div><div class=\"div_Bot\" id=\"db\" >&nbsp;</div>";
	new_Div.id = id;	
	new_Div.className = "div_style";
	
	document.body.appendChild(new_Div);
	new_Div.style.left = mouseX(evt)   -  25   + 'px';	
	new_Div.style.top = mouseY(evt)      - document.getElementById(id).clientHeight - document.getElementById('db').clientHeight    + 5 + 'px'; 
	
	
	
	}else if (document.getElementById(id) != null ) {
		document.body.removeChild(document.getElementById(id));
	}
	
	}
	
	} catch(e) {
		
	alert(msg);
	
	
	}
	
	}				


function cl(){
	
	if (d != "" ){
	document.body.removeChild(document.getElementById(d));
	
	} else{
		alert("empty");
		}
	
}
			
