var et, tr, root;
var cba = "#C0C0C0";

function ShowFoto(img,par){	if (!root) root='';	ad(root+'/img.php?img='+img+'&root='+root+'&par='+par)}
function setc(obj){document.cookie=encodeURIComponent(obj.name)+"="+encodeURIComponent(obj.value)+";expires=Sun, 20 Dec 2020 20:20:20 GMT"}
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+'",1)\'><img src="'+f.src+'" alt="'+f.alt+'" title="'+f.alt+'" width="470"></a>';
}
function check_fill(obj,mail,descr,conf){
	var msg='';
	if (!descr) descr='';
	et=0;
	for (i=0;i<obj.length;i++){
		o=obj[i];
		if (o.value.length==0){
			 et=1;
			 o.style.backgroundColor=cba;
			 if (descr[i]) msg=msg+'- '+descr[i]+"\n";
		}
		else o.style.backgroundColor="";
	}
	if (mail!='' && mail!=undefined && mail.value.length>0){
		var filter=/^.+@.+\..{2,4}$/;
		if (!filter.test(mail.value)){
			mail.style.backgroundColor=cba; 
			msg=msg+"- Mail\n";et=1;
		}
	}
	if (msg) alert("Zkontrolujte vyplnění políčka:\n"+msg);
	if (et) return false;
	if (conf && !confirm(conf)) return 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;
}
function sendlink() {location.href='?sendlink=1' }

function popupwin(fileurl,w,h) { // Make popup win
	if (w<=1) var iWidth = screen.width * w;
	else var iWidth	= w;
	if (h<=1) var iHeight = screen.height * h;
	else var iHeight= h;

	var iLeft = (screen.width  - iWidth)/2 ;
	var iTop  = (screen.height - iHeight)/6;

	var sOptions = "toolbar=no,status=1,resizable=1,scrollbars=1" ;
	sOptions += ",width=" + iWidth ;
	sOptions += ",height=" + iHeight ;
	sOptions += ",left=" + iLeft ;
	sOptions += ",top=" + iTop ;

	var mytxt = fileurl;

	var oWindow = window.open(mytxt, "OperacniOkno", sOptions) ;
}
function sp(){
	document.cookie='scroll='+document.body.scrollTop+";expires=Sun, 20 Dec 2020 20:20:20 GMT";
}
