var mins

var secs;

 

function timer() {

	mins = 30 * mMin('00'); // change minutes here

	secs = 0 + sSec(':00'); // change seconds here (always add an additional second to your total)

	redo();

}

 

function mMin(obj) {

	for(var i = 0; i < obj.length; i++) {

		if(obj.substring(i, i + 3) == ":")

		break;

	}

	return(obj.substring(0, i));

}

 

function sSec(obj) {

	for(var i = 0; i < obj.length; i++) {

		if(obj.substring(i, i + 1) == ":")

		break;

	}

	return(obj.substring(i + 1, obj.length));

}

 

function dis(mins,secs) {

	var disp;

	if(mins <= 9) {

		disp = " 0";

	} else {

		disp = " ";

	}

	disp += mins + ":";

	if(secs <= 9) {

		disp += "0" + secs;

	} else {

		disp += secs;

	}

	return(disp);

}

 

function redo() {

	secs++;

	if(secs == 59) {

		secs = 0;

		mins++;

	}	

	document.getElementById('disp').value = dis(mins,secs); // setup additional displays here.

	if((mins == 30) && (secs == 0)) {

		window.alert("For security purposes, your computer has been logged out after a period of inactivity.\nTo resume using AdsValue, please log in again.  Thank you."); // change timeout message as required

		window.location = "logout.php" // redirects to specified page once timer ends and ok button is pressed

	} else {

		timer = setTimeout("redo()",1000);

	}

}

 

function init(){

	timer();

}
