function obj( id ) {
	return document.getElementById( id );
}
function format_time( time ) {
	var h = 0;
	var m = 0;
	var s = 0;
	var hh = '';
	var mm = '';
	var ss = '';
	h = Math.floor( time / 3600 );
	time = time - h * 3600;
	m = Math.floor( time / 60 );
	s = time - m * 60;
	if ( s < 0 ) s = 0;
	if ( h < 10 ) hh = '0' + h; else hh = '' + h;
	if ( m < 10 ) mm = '0' + m; else mm = '' + m;
	if ( s < 10 ) ss = '0' + s; else ss = '' + s;
	return  hh + ':' + mm + ':' + ss;
}

function Timer() {
	x = document.getElementById("iddle_time").value;
	x = x - 1;
	if ( x < 0  ){
		document.location= 'cms.iddle.php';
	}
	document.getElementById("iddle_time").value = x;
	document.getElementById("iddle_time_format").innerHTML = format_time( x );
	setTimeout( 'Timer()', '1000' );
};

function Sesja() {
	x = document.getElementById("sess_time").value;
	x = x - 1;
	document.getElementById("sess_time").value = x;
	document.getElementById("sess_time_format").innerHTML = format_time( x );
	setTimeout( 'Sesja()', '1000' );
};

function resizeEditor( EditorID, iCurrentX, iCurrentY, Active, Minus ) {
  var handle = document.getElementById( EditorID );
  if ( handle ) {
      handle.style.width 	= iCurrentX;
		if ( Active ) {
			var newHeight = iCurrentY - Minus;
       handle.style.height = newHeight + "px";
		} else {
			handle.style.height = iCurrentY + "px" ;
		};
  };
};

function setPointer(theRow, thePointerColor) {
	if (thePointerColor == '' || typeof(theRow.style) == 'undefined') { return false; }
	if (typeof(document.getElementsByTagName) != 'undefined') {
		var theCells = theRow.getElementsByTagName('td'); }
  else if (typeof(theRow.cells) != 'undefined') { var theCells = theRow.cells; }
  else { return false; }
  var rowCellsCnt  = theCells.length;
  for (var c = 0; c < rowCellsCnt; c++) {
		theCells[c].style.color = thePointerColor;
	};
  return true;
};