function openWin(src,width,height,left,top,scroll) {
	if (left==null || left=="") left=(screen.width-width) / 2;
	if (top==null || top=="") top=(screen.height-height) / 2;
	if (scroll=="") scroll="auto";
	var win = window.open(src,"", "toolbar=no,scrollbars="+scroll+",location=no,status=no,width="+width+",height="+height+",left=" + left + ", top=" + top + ",resizable=no");
	win.focus();
}

function openPic(src,title,width,height,left,top) {
	if (window.pic!=null) window.pic.close();
	if (left==null) left=(screen.width-width) / 2;
	if (top==null) top=(screen.height-height) / 2;
	pic = window.open('','pic','width=' + width + ',height=' + height + ',left=' + left + ', top=' + top + ',statusbar=0,menu=0');
	pic.focus();
	pic.document.open();
	pic.document.write("<html><head><title>" + title + "</title></head>");
	pic.document.write("<body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>");
	pic.document.write("<a href='javascript:this.close()'><img src='" + src + "' border='0' width='" + width + "' height='" + height + "'></a>");
	pic.document.write("</body></html>");
	pic.document.close();
}

function winStatus(opt) {
	if (opt==0) {
		self.status='Klikněte pro zvětšený obrázek...';
	}
	else {
		window.status="";
	}
}

function populate(ref)
{
	if (ref.name == "id[1]") {
		second = "Velikost";
		box = document.getElementsByName("id[1]")[0];
		box2 = document.getElementsByName("id[2]")[0];
	} else {
		second = "Barva";
		box = document.getElementsByName("id[2]")[0];
		box2 = document.getElementsByName("id[1]")[0];
	}
	var key = box.options[ref.selectedIndex].text;
	var list = eval(second+'[key]');
	var key2 = box2.options[box2.selectedIndex].text;
	box2.options.length = 0;
	for(i=0;i<list.length;i+=2)
	{
		if (key2 == list[i]) box2.options[i/2] = new Option(list[i],list[i+1],false,true);
		else box2.options[i/2] = new Option(list[i],list[i+1]);
	}
}
function autoPopulateBarva(key) {
	var list = eval('Velikost'+'[key]');
	var box2 = document.getElementsByName("id[2]")[0];
	for(i=0;i<list.length;i+=2)
	{
		box2.options[i/2] = new Option(list[i],list[i+1]);
	}
}
function autoPopulateVelikost(key) {
	var list = eval('Barva'+'[key]');
	var box2 = document.getElementsByName("id[1]")[0];
	for(i=0;i<list.length;i+=2)
	{
		box2.options[i/2] = new Option(list[i],list[i+1]);
	}
}
function autoSelectVelikost(key) {
	var box = document.getElementsByName("id[2]")[0];
	for(var i = 0; box.options[i]; i++ ) {
		if (box.options[i].text==key) box.selectedIndex = i;
	}
}
function selectBarva(value) {
	var box = document.getElementsByName("id[1]")[0];
	for(var i = 0; box.options[i]; i++ ) {
		if (box.options[i].value==value) box.selectedIndex = i;
	}
}
function selectVelikost(value) {
	var box = document.getElementsByName("id[2]")[0];
	for(var i = 0; box.options[i]; i++ ) {
		if (box.options[i].value==value) box.selectedIndex = i;
	}
}

