
var timerID = null;
var timerRunning = false;
function stopclock (){
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;
}
function showtime () {
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds()
var timeValue = "" + hours;
if (timeValue == "0") timeValue = 24;
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
timeValue += ((seconds < 10) ? ":0" : ":") + seconds
$('time').innerHTML = timeValue;
timerID = setTimeout("showtime()",1000);
timerRunning = true;
}
function startclock() {
stopclock();
showtime();
}

/**
 * Ask and Redirect function
 * on question confirmation redirect to specified location
 */
function aar(question, location) {	
	if(confirm(question))
		window.location = location;
}

function $(id) {
	return document.getElementById(id);
}


function stepBack(step){
	$('registerForm').onsubmit=function (){};
	$('registerForm').step.value = step;
	$('registerForm').tmp.value = 1;
	$('registerForm').submit();
}

function stepSave(){
	if(confirm('Czy na pewno wszystkie dane są poprawne?')){
		$('registerForm').submit();
		return true;
	}else return false;
	$('registerForm').step.value = step;
	$('registerForm').tmp.value = 1;
	$('registerForm').submit();
}

function setfvalue(that, text) {
	if (that.value == text)
		that.value = '';
}

function setbvalue(that, text) {
	if (that.value == '')
		that.value = text;
}
