// JavaScript Document


function openImg(URL) {
		day = new Date();
		id = day.getTime();
		eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=600,left = 212,top = 30');");
}
function openImgUudis(URL) {
		day = new Date();
		id = day.getTime();
		eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=500,height=600,left = 312,top = 30');");
}
function chVal(n,act){
	var tmp; 
	var hind;
	eval("tmp = document.getElementById('quan"+n+"')");
	var a = tmp.value;
	eval("hind = document.getElementById('hind"+n+"')");
	var h = hind.value;
	var th = h/a;
	if (act=="+")
		a++;
	else
		if(a>1)
			a--;
	h=th*a;
	tmp.value=a.toString();
	hind.value=h.toString();
	arvKokku();
}
function arvKokku(){
	if (items_count>0){
  	var hindall = document.getElementById("hindall");
  	var tmp1, h1, kokku=0;
  	for (i=1;i<=items_count;i++){
  		eval("h1 = document.getElementById('hind"+i+"')");
  		tmp1 = h1.value;
  		kokku+=eval(tmp1);
  		
  	}
  	hindall.setAttribute("value",kokku.toString());
	}
}
function subm(frm,act){
var f;
f = document.getElementById(frm);
f.action=act;
f.submit();
}

function change_in(obj){
	obj.style.cursor="pointer";
}

function wocont(ss) {
if(ss.length > 0) {
return false; }

return true;
}

function subm_vormista(f){
if(wocont(f.maksja.value)||wocont(f.aadress.value)||wocont(f.linn.value)||wocont(f.indeks.value)||wocont(f.kontaktisik.value)||wocont(f.kontakttel.value)||wocont(f.email.value))
   alert ("Palun täitke kõik tärniga tähistatus väljad!");
else
   f.submit();
}