function loadSubFG(id)
  {
       var   prepnuto = false;
    $('.fotoGhide').each(function(obj){
     var rel = $(this).attr('rel');
     var thisID = $(this).attr('id');
      thisID = thisID.replace(/fotoA_/g,'') ;
      if(rel=='lightbox['+id+']' || id=='all')
        {
          $('.td_img_'+$(this).attr('id')).css('display','inline');
          if(prepnuto==false)
            {
              prepni(document.getElementById($('#aThumb_'+thisID).attr('id')),thisID);
              prepnuto = true;
            }
        }
      else
        {
          $('.td_img_'+$(this).attr('id')).css('display','none');
       }

    });

  }


function prepni(prvek,id) {
	/*var i = prvek.parentNode.getAttribute('id');
	var popisek = document.getElementById('div-popisek').firstChild;
	var podlaha = document.getElementById('div-podlaha').firstChild;
	popisek.setAttribute('id', 'div-popisek-ramecek'+i);
	podlaha.setAttribute('id', 'div-podlaha-ramecek'+i);*/
	var imgHref = prvek.href;
	var imgTitle = prvek.title;
	//var imgHrefReplace = imgHref.replace('large', 'medium');
	document.getElementById('fotoPopis').innerHTML=imgTitle;
	var a = [];
	a = getElementsByClassName('fotoGhide');
	for(var i=0,j=a.length; i<j; i++) {
		a[i].style.display='none';
	}
	document.getElementById('fotoI_'+id).style.display='inline';
	document.getElementById('fotoI_'+id).src=imgHref;
	//document.getElementById('fotoI_'+id).src=imgHrefReplace;
	document.getElementById('fotoA_'+id).style.display='inline';
	//window.alert(imgHrefReplace+'-'+imgHref);
	
	/*var nevybrany = document.getElementsByClassName('td-vybrany');
	for(var i=0, j=nevybrany.length; i<j; i++) {
		nevybrany[i].className = 'td-nevybrany';
	}
	var vybrany = document.getElementById(td_id);
	vybrany.className = 'td-vybrany';*/
}

function getElementsByClassName(classname, node) {
	if(!node) node = document.getElementsByTagName("body")[0];
	var a = [];
	var re = new RegExp('\\b' + classname + '\\b');
    var els = node.getElementsByTagName("*");
    for(var i=0,j=els.length; i<j; i++)
    	if(re.test(els[i].className))a.push(els[i]);
    return a;
}

function xxx(i) {
	novy_div = document.createElement('div');
	novy_div.setAttribute('id', 'div_input_fotka'+i);
	novy_input = document.createElement('input');
	novy_input.setAttribute('type', 'file');
	novy_input.setAttribute('value', i);
	novy_input.setAttribute('name', "fotka"+i);
	document.getElementById('td_input_fotky').appendChild(novy_div);
	document.getElementById('div_input_fotka'+i).appendChild(novy_input);
}

