function logoff(){
	var url = './delete_session.mvc';
	var params = 'sess_id=' + sess_id;
	ajaxpack.asynchronous=false;
	ajaxpack.getAjaxRequest(url, params, '', 'txt');
	if(ajaxpack.ajaxobj.responseText=='SCORM'){
		var msg = "Please Logoff using the browser top right-hand X button.";
		messageBox(msg, 'SCORM Logoff', 'information', 'ok');
		return;
	}
	if(ajaxpack.ajaxobj.responseText=='close'){
		parent.window.close();
		return;
	}
	document.location = './index.mvc';
}

function passwordUpd(pwd){
	var send_email = document.password.emailme.checked;
	send_email = '&send_email=' + send_email;
	corp_id = '&corp_id=' + escape(corp_id);
	corp_dir = '&corp_dir=' + escape(corp_dir);
	learner_id = '&learner_id=' + escape(learner_id);
	var mail_to = '&mail_to=' + escape(currEmail);
	var uName = '&uName=' + escape(currUsername);
	var url = './passwordUpd.mvc';
	var params = 'pwd=' + pwd + send_email + corp_id + corp_dir + learner_id + mail_to + uName;
	ajaxpack.asynchronous=false;
	ajaxpack.getAjaxRequest(url, params, '', 'txt');
	return ASYM_Trim(ajaxpack.ajaxobj.responseText);
}

function send_my_details(){
setTimeout('send_my_details_idle()',20);
}

function send_my_details_idle(){
var params = sess;
var url = './send_my_details.mvc';
ajaxpack.asynchronous=false;
ajaxpack.getAjaxRequest(url, params, '', 'txt');
var msg = ASYM_Trim(ajaxpack.ajaxobj.responseText);
messageBox(msg, "E-Mail Notification", "information", "ok");
}

var winLeft;
var winTop;
var winWidth;
var winHeight;
var bver=navigator.appVersion.split(";");
function totdstart(){
	var d = new Date();
	var unique = d.getTime() + '' + Math.floor(1000 * Math.random());
	var totd_URL = "../totd/totd_dialog.mvc?u=" + unique;
	var winBounds = getWinBounds('', '', 430, 320)
//	if (ieOn){
//		var opts = 'center:yes; dialogheight:280px; dialogwidth:430px;resizable:off;scroll:off';
//	}else{
		var opts = 'center:yes; dialogheight:' + winBnds.height + 'px; dialogwidth:' + winBnds.width + 'px; dialogtop:' + winBnds.top + 'px; dialogleft:' + winBnds.left + 'px; resizable:off; scroll:off';
//	}
	var rv = window.showModalDialog(totd_URL,null,opts);
}
function setPopupWindowDefaults(){
	winLeft = 50;
	winTop = 50;
	winWidth = (screen.width-10)-(winLeft*2);
	winHeight = (screen.height-10)-(winTop*2);
}

function popupWindow(winURL,winName){
	var winPosn = 'left=' + winLeft + ',top=' + winTop;
	var winFeatures = ',menubar=yes,toolbar=yes,location=yes,scrollbars=yes,status=yes,resizable=yes,';
	var winSize = 'width=' + winWidth + ',height=' + winHeight;
	winFeatures = winPosn + winFeatures + winSize;
	var winObj = window.open(winURL,winName,winFeatures);
// sets focus to popup window if already open this will bring it to the front
	winObj.focus();
// sets the default popup window position and size
	setPopupWindowDefaults();
}

setPopupWindowDefaults()

if(typeof(page_name)!='undefined' && page_name == 'index.mvc' && showTOTD) setTimeout('totdstart()',100);

function changePW(){
	showProcessing();
	setTimeout('changePW_delay()',750);
}

function changePW_delay(){
	var param_corp_dir = '&corp_dir=' + escape(corp_dir);
	var param_corp_id = '&corp_id=' + escape(corp_id);
	var learner_id = user_id;
	learner_id = '&learner_id=' + escape(learner_id);
	var d = new Date();
	var unique = d.getTime() + '' + Math.floor(1000 * Math.random());
	var changepw_URL = "./changepw.mvc?u=" + unique + param_corp_id + param_corp_dir + learner_id;
	var winBounds = getWinBounds('', '', 380, 260)
	if (ieOn){
		var opts = 'center:yes; dialogHeight:' + winBnds.height + 'px;dialogWidth:' + winBnds.width + 'px;resizable:off;scroll:off';
	}else{
		winBnds.height -= 35;
		winBnds.width += 5;
		var opts = 'dialogHeight:' + winBnds.height + 'px; dialogWidth:' + winBnds.width + 'px; dialogTop:' + winBnds.top + 'px; dialogLeft:' + winBnds.left + 'px;';
	}
	var args = '';
	rv=window.showModalDialog(changepw_URL, args, opts);
	hideProcessing();
}
var aicc_url;
if(typeof(lms_path)!='undefined'){
	aicc_url = "?aicc_url=" + escape(lms_path + 'lms_update.mvc');
//	if (browserName=='Firefox' && (fullVersion=='3.0.6' || fullVersion=='3.0.7' || fullVersion=='3.0.8' || fullVersion=='3.0.9')){
//	if (browserName=='Firefox'){
		aicc_url = "?aicc_url=" + lms_path + 'lms_update.php';
//	}
}
function runCourse(sess_id, unit_id, bookmark, au, launchURL){
	var thisLaunchURL = launchURL;
	var URL=lms_path;
	if (thisLaunchURL!='' && thisLaunchURL.length <= 10){
		URL = base_dir + thisLaunchURL + "/";
		thisLaunchURL = '';
	}
	var sID = '&SessionID=' + escape(sess_id);
	var cID = '&CourseID=' + escape(unit_id);
	var auID = '&au=' + escape(au);
	if (bookmark!='') bookmark = '#' + escape(bookmark);
	if (thisLaunchURL==""){
		winHRef = URL + unit_id + '/index.html' + bookmark + aicc_url + sID + cID + auID;
	}else{
		winHRef = thisLaunchURL + bookmark + aicc_url + sID + cID + auID;
	}
	bootstrap(winHRef,bootstrap_fullscreen,'inplace',document);
}

function runCourseNotFullScreen(sess_id, unit_id, bookmark, au, launchURL){
	var thisLaunchURL = launchURL;
	var URL=lms_path;
	if (thisLaunchURL!='' && thisLaunchURL.length <= 10){
		URL = base_dir + thisLaunchURL + "/";
		thisLaunchURL = '';
	}
	var sID = '&SessionID=' + escape(sess_id);
	var cID = '&CourseID=' + escape(unit_id);
	var auID = '&au=' + escape(au);
	if (bookmark!='') bookmark = '#' + escape(bookmark);
	if (thisLaunchURL==""){
		winHRef = URL + unit_id + '/index.html' + bookmark + aicc_url + sID + cID + auID;
		bootstrap(winHRef,'window','inplace',document);
	}else{
		winHRef = thisLaunchURL + bookmark + aicc_url + sID + cID + auID;
		window.open(winHRef,unit_id);
	}
}

function runCourseCommunicate(sess_id, unit_id, bookmark, au, launchURL){
	var sID = '&SessionID=' + escape(sess_id);
	var cID = '&CourseID=' + escape(unit_id);
	var auID = '&au=' + escape(au);
	if (bookmark!='') bookmark = '#' + escape(bookmark);
	var winHRef = launchURL + bookmark + aicc_url + sID + cID + auID;
	window.open(winHRef,unit_id);
}

function runCourseNotCommunicate(sess_id, unit_id, bookmark, au, launchURL){
	window.open(launchURL,unit_id);
}

