var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
	if(pos=="random"){
		LeftPosition = (screen.width) ? Math.floor(Math.random()*(screen.width-w)) : 100;
		TopPosition = (screen.height) ? Math.floor(Math.random()*((screen.height-h)-75)) : 100;
	}
	else if(pos=="center"){
		LeftPosition = (screen.width) ? (screen.width-w)/2 : 100;
		TopPosition = (screen.height) ? (screen.height-h)/2 : 100;
	}
	else{
		LeftPosition = 0;
		TopPosition = 20;
	}

	settings = "toolbar=no,location=no,status=no,scrollbars=yes,menubar=no,directories=no,resizable=no,width="+w+",height="+h+",top="+TopPosition+",left="+LeftPosition;
	//alert(myname);
	win = window.open(mypage,myname,settings);
}

var mozliwosc = "0123456789.";
function spr(wartosc, pole) {
	//alert(pole);
	//alert(wartosc);
	i = wartosc.length - 1;
	var err = true;
	for (var j = 0; j < mozliwosc.length; j++) {
		if (wartosc.charAt(i) == mozliwosc.charAt(j)) err = false;
	}
	//alert (err);
	if (err==true) pole.value = wartosc.substring(0,i);
	if ((wartosc.length == 1) && (wartosc == 0)) pole.value = wartosc.substring(0,i);
}

var formblock;
var forminputs;
function prepare() {
	formblock = document.getElementById('chooser');
	forminputs = formblock.getElementsByTagName('input');
}

function select_all(name, value) {
	for (i = 0; i < forminputs.length; i++) {
		// regex here to check name attribute
		var regex = new RegExp(name, "i");
		if (regex.test(forminputs[i].getAttribute('name'))) {
			if (value == '1') {
				forminputs[i].checked = true;
			} else {
				forminputs[i].checked = false;
			}
		}
	}
}

function now() {
	var currentTime = new Date();
	var day = currentTime.getDate();
	var month = currentTime.getMonth() + 1;
	if (month<10) {
		month = "0" + month;
	}
	if (day<10) {
		day = "0" + day;
	}
	var year = currentTime.getFullYear();
	return  year + "-" + month + "-" +day;
	return date;
}


function WinOpen(co,szer,wys)
{
  tytul="DOBIS - Doradztwo, Oprogramowanie, Bezpieczeństwo Informacji, Systemy";
  tlo="/s/i/tlo.gif";
  obraz = "src=/s/i/" + co + ".gif";
  NewWindow=open("",co,"menubar=no,top=0,left=0,scrollbars=yes,fullscreen=no,resizable=yes,status=no,width=580,high=400");
  NewWindow.document.write("<HTML><HEAD><TITLE>" + tytul + "</TITLE></HEAD><BODY><CENTER>");
  NewWindow.document.write("<img " + obraz + " width=" + szer + " height=" + wys + " border=0>");
  NewWindow.document.write("</CENTER></BODY></HTML>");
}