
function load_script(url) {

	var head=document.getElementsByTagName('head').item(0);
	var old=document.getElementById('last_id');
	if (old)head.removeChild(old);
	script=document.createElement('script');
	script.src=url;
	script.type='text/javascript';
	script.defer=true;
	script.id='last_id';
	void(head.appendChild(script));
	}

function resizeokno(sx,sy) {

	var sw=screen.width-40;
	var sh=screen.height-40;

	if (sx>sw) sx=sw;
	if (sy>sh) sy=sh;

	window.resizeTo(sx,sy);
	}

function zbfiltr() {

	var tmpCat=0;
	var tmpProducer=0;
	var tmpParam2=0;
	var tmpParam3=0;
	var tmpParam4=0;
	var tmpParam5=0;
	var tmpParam6=0;
	var tmpPrice=0;
	var tmpSklad=0;

	try { tmpCat=document.getElementById('item-idcat').value; } catch(e) { }
	try { tmpProducer=document.getElementById('item-idproducer').value; } catch(e) { }
	try { tmpParam2=document.getElementById('param-2').value; } catch(e) { }
	try { tmpParam3=document.getElementById('param-3').value; } catch(e) { }
	try { tmpParam4=document.getElementById('param-4').value; } catch(e) { }
	try { tmpParam5=document.getElementById('param-5').value; } catch(e) { }
	try { tmpParam6=document.getElementById('param-6').value; } catch(e) { }
	try { tmpPrice=document.getElementById('item-price').value; } catch(e) { }
	try { tmpSklad=((document.getElementById('item-sklad').checked)?(1):(0)); } catch(e) { }

	load_script('/_data/clscripts/zbfiltr.php?cat='+tmpCat+'&p='+tmpProducer+'&s='+tmpSklad+'&c='+tmpPrice+'&p-2='+tmpParam2+'&p-3='+tmpParam3+'&p-4='+tmpParam4+'&p-5='+tmpParam5+'&p-6='+tmpParam6);
	}

var zborder_url='';

function zborder(set) {

	location.href=zborder_url+'sr='+set;
	}

function tclearselect(id) {

	try {
		var sel=document.getElementById(id);
		while (sel.options.length) sel.remove(0);
		}
	catch(e) {

		}
	}

function titemadd(id,klic,hodnota,vybrano,styl) {

	var sel=document.getElementById(id);
	var it=document.createElement("OPTION");

	sel.options.add(it);
	it.value=klic;
	it.innerHTML=hodnota;

	if (styl!='') 
		it.className=styl;

	if (vybrano)
		it.selected=true;
	}

function tselectsum(id) {

	var sel=document.getElementById(id);
	var pocet=sel.options.length;

	if (pocet>8) pocet=8;
	else if (pocet<1) pocet=1;
	sel.size=pocet;
	}

function tselectsumset(id,maxpoc) {

	var sel=document.getElementById(id);
	var pocet=sel.options.length;

	if (pocet>maxpoc) pocet=maxpoc;
	else if (pocet<2) pocet=2;
	sel.size=pocet;
	}



function z_doprava_change(hodnota,platba,vsechny) {

	if (platba!='') {

		var tmph=new Array();
		var tmpa=vsechny.split(',');



		var tmp=platba.split(',');

		if (tmp.length>0) {

			for (var i=0;i<tmp.length;i++) {

				tmph[tmp[i]]=1;
				try {

					document.getElementById('item-platba-'+tmp[i]).disabled=false;
					}
				catch(e) {}
					
				}
			}



		if (tmpa.length>0) {

			for (var i=0;i<tmpa.length;i++) {

				if (tmph[tmpa[i]]!=1) {

					try {
	
						document.getElementById('item-platba-'+tmpa[i]).disabled=true;
						document.getElementById('item-platba-'+tmpa[i]).checked=false;
						}
					catch(e) {}
						
					}
				}
			}


		}
	}

function z_platba_change(hodnota) {

	}

function xopenfoto(idpic,idsize) {

	try {

		window.open('/_data/pic/'+idpic+'-'+idsize+'.jpg','','scrollbars=yes,resizeable=yes,width=325,height=400');
		}
	catch (e) {

		}

	}

