function popup() {
	window.open('/popup.htm','','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=525,height=480,left=44,top=44');
}

function openwin(theURL,winName,features) {
	xaken=window.open(theURL,winName,features);
}

function ToggleAll(e) {
	if (e.checked) {
		CheckAll();
	}
	else {
		ClearAll();
	}
}

function CheckAll() {
	var cl = document.listing;
	var len = cl.elements.length;
	for (var i = 0; i < len; i++) {
		var e = cl.elements[i];
		if (e.name == 'MailID[]') {
			e.checked = true;
		}
	}
	cl.toggleAllt.checked = true;
	cl.toggleAllb.checked = true;
}

function ClearAll() {
	var cl = document.listing;
	var len = cl.elements.length;
	for (var i = 0; i < len; i++) {
		var e = cl.elements[i];
		if (e.name == 'MailID[]') {
			e.checked = false;
		}
	}
	cl.toggleAllt.checked = false;
	cl.toggleAllb.checked = false;
}

function ShowPicture(Image,Width,Height) {
	openwin('/photo.php?i='+Image,'Pilt','toolbar=0,status=0,menubars=0,scrollbars=0,resizable=0,location=0,directories=0,width='+Width+',height='+Height+',top=50,left=50');
}

function PageNumbers(a) {
	document.fo.start.value=a;
	document.fo.submit();
}

function sort(a) {
	document.fo.sort.value=a;
	document.fo.submit();
}

function Kaart(a,l) {
	openwin('/map.php?i='+a+'&l='+l,'','toolbar=0,status=0,menubars=0,scrollbars=0,resizable=0,location=0,directories=0,width=468,height=340,top=50,left=50');
}

function zoom(a) {
	document.map.noz.value=1;
	document.map.zoom_s.value=a;
	document.map.submit();
}

function move(a) {
	document.map.noz.value=1;
	document.map.nihe.value=a;
	document.map.submit();
}

function LgMap(SObj) {
	if(SObj.options[SObj.selectedIndex].value=="lg"){
		var a=document.map.fullscreen.value;
		openwin(a,'Fullscreen','width=800,height=600,menubar=1')
		document.map.mapsize.value="sm";
	}
}

function show_kaart(x,y,zoom,label) {
	document.map.bbox.value='';
	document.map.adr_x.value=x;
	document.map.adr_y.value=y;
	document.map.zoom_s.value=zoom;
	document.map.adlabel.value=label;
	document.map.submit();
}

function SendMail() {
	var theForm=document.listing;
	var ch=0;
	for(i=0; i < theForm.elements['MailID[]'].length; i++){
		if(theForm.elements['MailID[]'][i].checked) ch++;
	}
	if(theForm.sok.value==1) ch++;
	if(!ch) alert('Midagi pole valitud');
	else document.listing.submit();
}

function SendMail2(a) {
	var theForm=document.listing;
	for(i=0; i < theForm.elements['MailID[]'].length; i++){
		if(theForm.elements['MailID[]'][i].value==a) theForm.elements['MailID[]'][i].checked = true;
	}
	theForm.submit();
}


