var gwinopen =0 
function ExitWindow()
{
	top.close();
}
var fQuery =""
function fStartPlayer() {
	fCreateQueryString("gStudentName",BVScorm_getstudentname());
	var lLessonLocation = BVScorm_getlocation();
	
	if(lLessonLocation != "" && lLessonLocation!="0")
	{
		var answer = confirm("Do you want to go to the last visited page?")
		if (answer !=0)
		{
				
			fCreateQueryString("lesson_location1",lLessonLocation);
					
		}
		else
		{
			fCreateQueryString("lesson_location1", "0");
				}
	}
	else
	{
		fCreateQueryString("lesson_location1", "0");	
		
	}
	fCreateQueryString("GJS","true")
	
	fCreateQueryString("gCoreData", BVScorm_getcoredata());
	//Main.setVariable("_root.gStudentName","abc");
	
	fsetFVariable("Main",fQuery);
	//document.Main.Play();
	//document.getElementById("Main").Play();
}
//var1=foo&var2=bar 
function fCreateQueryString(var1,var2){
	if(fQuery==""){
		fQuery = var1+'='+var2

	}else{
		fQuery = fQuery+'&'+var1+'='+var2
	}
	
}

function fsetFVariable(){
	fWriteObjectToDiv()
}


function fWriteObjectToDiv(){
	str=''
	str+='<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ID="Main"  name="Main"  WIDTH=790 HEIGHT=540>'
	str+=' <PARAM NAME=movie VALUE="main.swf?'+fQuery+'">'
	str+=' <PARAM NAME=MENU VALUE=false>'
	str+=' <PARAM NAME=scale VALUE=exactfit>'
	str+=' <PARAM NAME=quality VALUE=high>'
	str+=' <PARAM NAME=bgcolor VALUE=#FFFFFF>'
	str+=' <EMBED src="main.swf?'+fQuery+'" menu=false quality=high scale=noscale bgcolor=#FFFFFF  WIDTH="790" swLiveConnect=true  HEIGHT="540" NAME="Main" FlashVars="movieid=Main" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>'
	str+=' </OBJECT>'
	
	if(document.layers){
		
		document.layers.flashObj.document.open()
		document.layers.flashObj.document.write(str)
		document.layers.flashObj.document.close()
	}else if (document.all){
		
		document.all.flashObj.innerHTML=str
		
	}else if(!document.all && document.getElementById){
		
		var Element = document.getElementById("flashObj");
		Element.innerHTML = str;
	}

	
	
}		

function fOnUnload()
{
	if(gwinopen == 0){	
//	alert("lesson"+document.Main.getVariable("_root.lesson_location"))
	
	var lLessonLocation = document.Main.getVariable("_root.lesson_location");
	BVScorm_setlocation(lLessonLocation);
	var lCoreData = document.Main.getVariable("_root.gCoreData");
	BVScorm_setcoredata(lCoreData);
	BVScorm_adlOnunload();
	}
			setTimeout('self.close()',2000);
			
//window.opener.close();
}

function fOpenerOnUnload()
{
	gwinopen = 1;
	var lLessonLocation = document.Main.getVariable("_root.lesson_location");
	BVScorm_setlocation(lLessonLocation);
	var lCoreData = document.Main.getVariable("_root.gCoreData");
	BVScorm_setcoredata(lCoreData);
	BVScorm_adlOnunload();
		setTimeout('self.close()',2000);

}	



function fWinOnLoad()
{
	BVScorm_adlOnload();
	fStartPlayer();
}

var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
// Handle all the the FSCommand messages in a Flash movie
var gArrPercentLoaded= new Array()
var gLessonArray = 0;
function Main_DoFSCommand(command, args) {
  var MainObj = InternetExplorer ? Main : document.Main;
	if(command=="alert"){
		alert(args)
	}
	if(command=="complete"){
		BVScorm_complete()
	}
	if(command=="getStudentName")
	{

	}
         
      if (command=="coreLessonData"){
       		if (args != ''){
       			TransmissionLessonData(args)
       		}
       }
	if (command=="LessonScore"){
		gLessonArray=args.split("$")
		if (gLessonArray[0]!=""){
			gObjectivesArr[gLessonArray[0]].score=gLessonArray[1]
			gObjectivesArr[gLessonArray[0]].status=gLessonArray[2]
		}
	     }    
	if (command == "transmisionlocation"){
		BVScorm_setlocation(args)
	}	     
}
// Hook for Internet Explorer
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 &&
	  navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<SCRIPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('Sub Main_FSCommand(ByVal command, ByVal args)\n');
	document.write('  call Main_DoFSCommand(command, args)\n');
	document.write('end sub\n');
	document.write('</SCRIPT\> \n');
}

function fOpenPreviewWindow(FinalStringOutput){
	lFlashObj = document.all.Main;
	//lId = lFlashObj.getVariable("_root.preview");
	//lHeading= lFlashObj.getVariable("_root.preViewHeading");
	var lArr=FinalStringOutput.split(",")
	
	if (lArr[0] == "Yes"){
		lArr[0] = "Identified the Safety Officer for your workplace."
	}else {
		lArr[0] = "Not identified the Safety Officer for your workplace. Please ask you supervisor or manager right away."
	}
	if (lArr[1] == "Yes"){
		lArr[1] = "Been instructed on your workplace's Evacuation Plan."
	}else {
		lArr[1] = "Not been instructed on your workplace's Evacuation Plan. Please get in touch with your Safety Officer or manager right away to learn about the evacuation plan."
	}
	if (lArr[2] == "Yes"){
		lArr[2] = "Identified the First Aid Stations or Kits and the First Aiders who work in your workplace."
	}else {
		lArr[2] = "Not identified the First Aid Stations or Kits and the First Aiders who work in your workplace. Please see your manager or supervisor for this information."
	}

	lHeading=""
	lBeforeChoicesText = "<h3>Feedback</h3>Thanks for completing the module, 'Identification and Management of Common Workplace Hazards.' <br><br>According to the feedback that you gave us earlier, you have:<br><br>";
	lAfterChoicesText = "The Identification and Management of Common Workplace Hazards<h3>Review</h3>This module is part of your introduction to the company, and the first of a series of safety programs that are designed to help you build important health and safety skills. <p>Over the course of your employment, you'll participate in many of these safety programs. The degree of your participation depends on where you work, and the kinds of work that you do. Tyco Fire & Security has the goal of providing every member of the team with a safe work environment. But just saying this doesn't make it so.</p><p>Managers have responsibility for providing a safe and health work environment, and Supervisors have responsibility for supporting the health and safety program.</p><p>Tyco Fire & Security needs your help to achieve the goal of a safe workplace.  Your responsibility is to learn safety procedures, follow safe practices, and be alert to workplace hazards and risks. When hazards are encountered, you will take actions to reduce or eliminate them.</p><ul>The main objectives of this module are to be able to:<li>Describe your responsibilities and those of Tyco Fire & Security.</li><li>Describe Tyco Fire & Security's safety strategy and policy.</li><li>Identify training resources and contact personnel for health safety issues.</li><li>Identify hazards in common workplace settings and take action to reduce or eliminate them.</li></ul><h3>Emergency Evacuations</h3></p><p>Each Tyco Fire & Security facility has an Emergency Evacuation Plan. The plan is based on risk factors that exist in each building, so your plan can differ from the plan for other facilities.</p><ul>At a minimum each plan includes these basic features:<li>A written Evacuation Plan or diagram that is posted in the workplace.</li><li>Emergency Exits, Evacuation Routes, and Employee Assembly Areas that are defined and marked on the plan.</li><li>Emergency Alarm Signals should be explained, as there may be different signals for different emergencies.</li></ul><p>All employees are required to participate in Emergency Evacuation Drills.</p><p><h3>First Aid</h3></p><p>Each facility will have some number of First Aid Kits. Large facilities may have First Aid Stations. Even our vehicles that are used to service customers are equipped with First Aid Kits. Depending on the facility in which you work, there may be qualified First-Aiders on site. These are employees who have received specialized training in basic First Aid Skills.</p><p><h3>Hazard and Risk Management</h3></p><p>One of the ways that Tyco Fire & Security promotes a safe workplace is through Hazard and Risk Assessment. This is an examination of the workplace, and the kinds of work activities that occur there. The goal is to identify potential hazards and risks, and take proactive steps to prevent accidents and injuries.</p><p>Even with a Hazard and Risk Management policy, and with safety training programs in place, accidents and injuries can still happen. When they do, Tyco Fire & Security will conduct an investigation. The investigation is meant to find the root cause of the incident, and to make recommendations to prevent additional accidents.</p><h3>Incident and Hazard Reporting</h3><p>No matter which business unit you’re in, or in which country you’re located, there will be a procedure for reporting injuries and hazards.  In addition, it’s likely that there is a statutory or regulatory requirement for having these procedures in place. It doesn’t matter how slight an injury might seem to you. Your job will be to report it, not to decide whether it should be reported. Failing to report an injury can have an adverse impact on an employee’s medical benefits later on, if the injury becomes more serious.</p><h3>Reporting Hazards</h3><p>Here’s an important point.In large part, your health and safety depends on the decisions you make, and the actions you take. <u>Always </u>consider your own safety first and your ability to deal with a hazardoussituation. <u>Never</u> take actions to remove or reduce a hazard if you’re not qualified to do so. Finally, stay within the limits of your training, and know when to call for help!</p><p>The remaining topics that we explored in this module are:</p><p><i>Access and Egress</i> – making sure that exits aren’t blocked so that employees can escape in the event of an emergency.</p><p><i>Electrical Hazards</i> – spotting common electrical hazards and taking action before someone is injured.</p><p><i>Manual Tasks</i> – Actions to avoid injuries while performing manual tasks.</p><p><i>Slips, Trips, and Falls</i> -- Recognizing the potential for slips, trips, and falls is very much common-sense. Taking action should be both automatic and immediate.</p><p><i>Common Workplace Chemicals</i> – A discussion about the many common chemicals that are found in the workplace – cleaners, lubricants,insecticides, and the like.</p><p><i>Ergonomics</i> -- Common examples of ergonomic hazards include using a chair that is not set to the right height, working with inadequate light, or failing to take frequent breaks from repetitive tasks like typing.</p><p><i>Good Housekeeping</i> – A host of potential problems can be avoided by developing good housekeeping habits, like cleaning up spills promptly, or keeping boxes and materials safely and neatly stacked.</p><p>All of Tyco Fire &amp; Security is covered by a Hazardous Materials Communication Program, commonly known as HAZCOM. Common elements of a HAZCOM program include:</p>";
	var newwin
	newwin = window.open("HTML\\StepPreview.html","PreviewWin","width=700,height=400,status=true,resizable=no,scrollbars =yes");
	newwin.document.write('<html><head><title>Feedback</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><script language="javascript" src="JsFiles/forPreview.js"></script></head><body bgcolor="#FFFFFF" text="#000000" ><div style="position:absolute; z-index:1; left: 30; top: 20; visibility: visible;"><div  id="contentholder" style="position:relative; z-index:1; left: 30; top: 20; visibility: visible;"><p><font size="4" face="Arial, Verdana, Helvetica, sans-serif">'+lHeading+'</font></p>'+lBeforeChoicesText+'1.  '+lArr[0]+'<br>'+'2. '+lArr[1]+'<br>'+'3. '+lArr[2]+'<br><br>'+lAfterChoicesText+'</div><br><br><br><br><a href="#" onClick="fPrintSteplist()" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'Image10\',\'\',\'images/printover.jpg\',1)"><img src="images/printdefau.jpg" alt="Print" name="Image10" width="80" height="25" border="0"></a><br><br></body></html>');
	newwin.document.close();
	newwin.focus();
	
}

var gResultString;
var newwin;
var IsDocLoaded = false;
function fOpenDocument(lResultString)
{
	//alert("Called");
	newwin = window.open("html/documentmain.html","DocumentWin","fullscreen=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,scroll=no,height=540,width=800");
	gResultString = lResultString;
	
	fLoadDocument();
	//alert(gResultString+"--"+newwin.frmDoc+"--"+(newwin.frmDoc!=undefined));

	//newwin.document.write('<html><head><title>Feedback</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><script language="javascript" src="JsFiles/forPreview.js"></script></head><body bgcolor="#FFFFFF" text="#000000" ><div style="position:absolute; z-index:1; left: 30; top: 20; visibility: visible;"><div  id="contentholder" style="position:relative; z-index:1; left: 30; top: 20; visibility: visible;"><p><font size="4" face="Arial, Verdana, Helvetica, sans-serif">'+lHeading+'</font></p>'+lBeforeChoicesText+'1.  '+lArr[0]+'<br>'+'2. '+lArr[1]+'<br>'+'3. '+lArr[2]+'<br><br>'+lAfterChoicesText+'</div><br><br><br><br><a href="#" onClick="fPrintSteplist()" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'Image10\',\'\',\'images/printover.jpg\',1)"><img src="images/printdefau.jpg" alt="Print" name="Image10" width="80" height="25" border="0"></a><br><br></body></html>');
	//width=700,height=400,status=true,resizable=yes,scrollbars =yes
}

function fLoadDocument()
{
	//if(newwin.frmDoc!=undefined)
	if(IsDocLoaded)
	{
		IsDocLoaded = false;
		/*if(gResultString=="")
		{
			newwin.frmDoc.document.location = "html/SAMPLE_MSDS.html";
		}
		else
		{
			newwin.frmDoc.document.location = "html/document.html";
			fShowResult();
		}*/
		newwin.frmDoc.document.location = gResultString;
		newwin.focus();
	}
	else
	{
		setTimeout("fLoadDocument()",500);
	}
}

function fShowResult()
{
	if(newwin.frmDoc.document.getElementById("divResult")!="undefined" && newwin.frmDoc.document.getElementById("divResult")!="null")
	{
		newwin.frmDoc.document.getElementById("divResult").innerHTML = gResultString;
	}
	else
	{
		setTimeout("fShowResult()",500);
	}

}

function fOpenPDF(lPDFPath)
{
	pdfWin = window.open(lPDFPath,'pdfwin');
}