// JavaScript Document

///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

function runSubTimer(){
	if(!theSubTimer){
		theSubTimer = new Timer({theTimer: 'simu_subtimer', curSec: 3600});
		theSubTimer.start();
		new PeriodicalExecuter(function(pe) {
			theSubTimer.UpdateTimer();
  			if(theSubTimer.options.curSec == 0){
  				pe.stop();  
				Modalbox.hide();
				//after this exit and save the exam/force quit
 			}
		}, 1 );
	}else{
		theSubTimer.start();
	}
}

///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

function askConfirm(){
	if( !simulation.end )
		return "Are sure you want to Cancel this Exam? Anyway you can Resume this exam later";
}

function askConfirmResume(){
	if( !resume.end )
		return "Are sure you want to Cancel this Exam? Anyway you can Resume this exam later";
}

///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

function disableSelection(target){
	if(typeof target.onselectstart != 'undefined' )
		target.onselectstart = function(){return false;}
	else if( typeof target.style.MozUserSelect != 'undefined' )
		target.style.MozUserSelect = 'none';
	else
		target.onmousedown = function(){return false;}
	
	target.style.cursor = 'default';
	target.onkeyup = function(e){ if(e.keyCode == 13){ examengine.getKeys(e); } };

}

///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
function enlarge(MyBase,MyImg,MyWidth,MyHeight){
	NewHeight = MyHeight + 25;
    window.open(MyBase+'overview/showpicture/'+MyImg+'/','dashboard','left=0,top=0,width='+MyWidth+',height='+NewHeight+',directories=no,location=no,menubar=no,status=yes,scrollbars=no,resizable=no,copyhistory=no');
}
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
function popup(MyBase,Myhtml,MyWidth,MyHeight){
	NewHeight = MyHeight + 25;
    window.open(MyBase+Myhtml,'dashboard','left=0,top=0,width='+MyWidth+',height='+NewHeight+',directories=no,location=no,menubar=no,status=yes,scrollbars=yes,resizable=no,copyhistory=no');
}
