﻿// JScript File

function SetHiddenValue(HiddenTextID, ThisValue) {

    if(document.all) 
	    obj = document.all[HiddenTextID];
	else {
        //var id = HiddenTextID.replace(/\$/g,'_');	
	    obj = eval('document.forms[0].' +  HiddenTextID);
	}
	if(obj) {
		obj.value = ThisValue;
		return true;
	}else
		return false;
}

function ClientButton_Click(PopUpFormName) {
	var strParameters = "height=500,width=750,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes";
	var strName="popup";
	var objPopupWindow = window.open(PopUpFormName, strName, strParameters);
	objPopupWindow.focus();
}

function DoThis(ThisAction) {
	switch(ThisAction.toUpperCase()) {
		case "CLOSE":
			window.close();
			break
		case "PRINT":
			window.print();
			break
	}
	return
}

function openLms(url,w, h, redirectUrl)
{
	w=w==0?800:w;
	h=h==0?600:h;
	win = window.open(url,"OnlineCourse","toolbar=no,resizable=1,width=" + w + ",height=" + h,true)
	if (typeof redirectUrl  != "undefined" && redirectUrl!="")
	{
		document.location.href=redirectUrl;
	}
	win.focus();
}

function onCourseRefresh(eventID) {
	location.reload(true);
}
function onCourseExit(eventID) {
	location.reload(true);
}



function OpenExam(url) {
    var exam
    var left  = screen.width/2 - 360
    var top   = 1;//screen.height/2 - 150
    
    
    if (exam == null || exam.closed)
        {
        exam = window.open(url,"Exam","scrollbars,toolbar=no,width=700,height=700px,dependant,left=" + left + ",top=" + top)
        //ie bug, if the window is open, it won't refresh...
        if(BrowserDetect.browser == "Explorer")
            {exam.document.location.href=url;}
        }
    if(exam) 
        {exam.focus();}
    else 
        {alert('Please disable your Pop-Up blocker');}
}
