
/*var bgmusicwindow=null;
var openTOC=null;*/

function openwindowBG(spath,gLessonFlag)
{
if (spath=="")
{
	if(gLessonFlag)
	{
		bgmusicwindow=window.open('../Design/Background.htm',"BG","height=10,width=10,top=500,left=10,resizable=1");
		bgmusicwindow.close();
		bgmusicwindow=window.open('../Background.htm',"BG","height=10,width=10,top=500,left=10,resizable=1");	
	}
	else
	{
		bgmusicwindow=window.open('Design/Background.htm',"BG","height=10,width=10,top=500,left=10,resizable=1");
		bgmusicwindow.close();
		bgmusicwindow=window.open('Background.htm',"BG","height=10,width=10,top=500,left=10,resizable=1");	
	
	}
}
else if (spath==0) // From index

{
	bgmusicwindow=window.open('../Design/Background.htm',"BG","height=10,width=10,top=500,left=10,resizable=1");
}
else if (spath==2) // From LessLaunch Page for AICC & SCORM compliance
{
	bgmusicwindow=window.open('../Background.htm',"BG","height=10,width=10,top=500,left=10,resizable=1");
}
else
{
	bgmusicwindow=window.open('Background.htm',"BG","height=10,width=10,top=500,left=10,resizable=1");
}
}

//pcookieval is the value which will be assigned to the cookie
function setcookie(pcookieval)
{
	if(navigator.appName=='Netscape')
	document.cookie = "cookieBGMusic"+"="+ pcookieval; 
	else
	document.cookie = "cookieBGMusic"+"="+escape(pcookieval); 

}
	var expires;
function setanycookie(name,value)
{	
	var expirationnever=new Date();
	expirationnever.setYear(expirationnever.getYear()+5000);
	
	if(navigator.appName=='Netscape')
		document.cookie = name+"="+ value + ";expires=" + expirationnever.toGMTString() +  ";path=/"; 
	else
		document.cookie = name+"="+escape(value) + ";expires=" + expirationnever.toGMTString() +  ";path=/"; 
}

//pname is  the name of the cookie whcich has to be deleted
function deletecookie(pname)
{
 var today = new Date()- 1;
 //var name="course1cookie"; 
                
 document.cookie=pname + "=" + ((today)? ";expires=" + today :"") ;

}

//name - will be the name of the cookie whose value is to be obtained
function getCookie(name) {
		
  var dc = document.cookie;

  var prefix = name + "=";

  var begin = dc.indexOf("; " + prefix);

  if (begin == -1) {
    begin = dc.indexOf(prefix);

    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);

  if (end == -1)
    end = dc.length;
  
	if(navigator.appName=='Netscape')
		 return dc.substring(begin + prefix.length, end);
	else
		 return unescape(dc.substring(begin + prefix.length, end));
}



function CloseBGMusic(gLessonFlag)
{
	
	var cookVal=getCookie('cookieBGMusic');

	if (cookVal != "")
	{
		//which means the background music is playing or window background music is opened
	
		if (cookVal == "1")
		{
			openwindowBG(gLessonFlag);
			bgmusicwindow.close();	
		}
	}
}

function PlayBGMusic(spath)
{
	
	var cookVal=getCookie('cookieBGMusic');

	if (cookVal != "")
	{
		//which means the background music is playing or window background music is opened
	
		if (cookVal == "0")
		{
			openwindowBG(spath);
		}
	}
}
function GetExtension(FileName)
{
		var iPos=FileName.lastIndexOf(".");
		var FileExt=FileName.substring(iPos+1,FileName.length);
		return FileExt.toLowerCase();
}
