var timerCheckCourseWindow
var timerRefreshParentLoginTimeoutReset
var oCoursewareWindow
var oOpenerWindow

function launchSCOWindow(sURL,oWinSelf){
	oCoursewareWindow = window.open(sURL, 'course', 'status,menubar=0,toolbar=0,scrollbars=0,location=0,resizable=0,height=569,width=788')
	oOpenerWindow = oWinSelf
	startCheckingForWindowState()
	// refeshes the parent window every 60 minutes
	timerRefreshParentLoginTimeoutReset = setInterval('oOpenerWindow.location.replace(oOpenerWindow.location.href);',3600000);
	bSCOWindowReloaded = false;
}

function startCheckingForWindowState(){
	timerCheckCourseWindow = setInterval('checkCourseWindowIsClosed()',1000)
}
var bSCOWindowReloaded = false;
function checkCourseWindowIsClosed(){
	if (oCoursewareWindow){
		try{
			if (oCoursewareWindow.closed){
				if(!bSCOWindowReloaded){
					clearInterval(timerCheckCourseWindow);
					clearInterval(timerRefreshParentLoginTimeoutReset);
					//oOpenerWindow.location.replace(oOpenerWindow.location.href);
					bSCOWindowReloaded = true;
				}
			}
		}catch(ex){
			oCoursewareWindow = null; 
		}
	}
}