var et, tr, root;
var cba = "#DCDCDC";

function fl(hr){location.href=hr}
function ShowFoto(img,par){	if (!root) root='';ad(root+'/img.php?img='+img+'&root='+root+'&par='+par);}
function ad(url) {
	if (document.getElementById('ax111')) document.body.removeChild(document.getElementById('ax111'));
	var jsel = document.createElement('SCRIPT');
	jsel.type = 'text/javascript';
	jsel.id = 'ax111';
	jsel.src = url;
	document.body.appendChild(jsel);
}
function null_item(obj) {
	document.getElementById(obj).value=0;
	document.order.submit()
}
function SizeMe() {
	var f = document.getElementById('i7');
	var fd = document.getElementById('d7');
	if (f.width>470) fd.innerHTML='<a href=\'javascript:ShowFoto("'+f.src+'")\'><img src="'+f.src+'" alt="'+f.alt+'" title="'+f.alt+'" width="470"></a>';
}
function check_fill(obj,mail,conf) {
	if (conf && !confirm(conf)) return false;
	et=0;
	for (i=0;i<obj.length;i++) {
		o = obj[i];
		if (o.value.length==0) {
			 et=1;
			 o.style.backgroundColor=cba;
		}
		else 
			 o.style.backgroundColor="";
	}
	if (mail!='' && mail!=undefined && mail.value.length > 0) {
		CheckEmail(mail.value)
		if (!tr) {
			mail.style.backgroundColor=cba; 
			return false;
		}
	}
	if (et) {
		if (document.getElementById('orderform')) document.getElementById('orderform').innerHTML='!!! Označené položky (*) musí být vyplněny !!!<hr>';
		return false;
	}
}
function CheckEmail(field){
	var str=field
	var filter=/^.+@.+\..{2,4}$/
	if (filter.test(str)) tr=true;
	else tr=false;
}
function chv(obj,nova,old) {if (obj.value==old) obj.value = nova; }
function cart_arr(ids,val) {
	i = val.indexOf('... ');
	if (i>0) {
		val = val.substring(i+4);
		document.getElementById('pcs'+ids).value = val;	
	}
	else document.getElementById('pcs'+ids).value = 0;
}
var cas;
function roll(obj,how,hei,ms) {
	window.clearInterval(cas);
	cas = window.setTimeout("roll2('"+obj+"',"+how+","+hei+")",ms);
}
function roll2(obj,how,hei) {
	o=document.getElementById(obj);
	if (how==1) {
		o.style.height="auto";
		o.style.opacity=0.95;
		o.style.filter="alpha(opacity=95)";
		o.style.zIndex=1;
	}
	else {
		o.style.height=hei;
	}
}