// JavaScript Document
function popup(mylink, windowname, width, height)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
var width1;
var height1;
var size;   
  width1 = 'width='+width;
   height1 ='height='+height;
   size = width1+','+height1+','+'scrollbars=yes';
   
//window.open(href,'new win', size);
window.open(href, windowname, size);
return false;
}

function reload()
{
  opener.location.href=opener.location.href;
    self.close();
}

function presmeruj()
{
  window.location = "?pg=upload&filtercat="+document.getElementById("sel_cat_filter").value;
}



function active(id)
{
  if (document.getElementById("inp_kontrolni").checked == 1)
  {
    alert("zaškrtnut");
  }
  else 
  {
    //document.getElementById(id).disabled=true;
  }
  
}

function myclear(id)
{
  if (document.getElementById(id).value == "hledat" || document.getElementById(id).value == "hledat v adresáři" )
  {
    document.getElementById(id).value = "";
  }

}

function itemCheck(id)
{
var prom;
var prom2;

prom = "hid_"+id;
prom2 = "inp_cat_"+id;

  if (document.getElementById(prom2).checked)
  {
    document.getElementById(prom).value = "1";
    //alert("1");
  }
  
  else
  {
    document.getElementById(prom).value = "-1";
    //alert("-1");
  }

}

function toggleLayer(whichLayer)

{

if (document.getElementById)

{

// this is the way the standards work

var style2 = document.getElementById(whichLayer).style;

style2.display = style2.display? "":"block";

}

else if (document.all)

{

// this is the way old msie versions work

var style2 = document.all[whichLayer].style;

style2.display = style2.display? "":"block";

}

else if (document.layers)

{

// this is the way nn4 works

var style2 = document.layers[whichLayer].style;

style2.display = style2.display? "":"block";

}

}





function hideLayer(whichLayer)

{

if (document.getElementById)

{

// this is the way the standards work

var style2 = document.getElementById(whichLayer).style;

style2.display = style2.display? "":"none";

}

else if (document.all)

{

// this is the way old msie versions work

var style2 = document.all[whichLayer].style;

style2.display = style2.display? "":"none";

}

else if (document.layers)

{

// this is the way nn4 works

var style2 = document.layers[whichLayer].style;

style2.display = style2.display? "":"none";

}

}

function toggleLayer(whichLayer) 
{
  var elem, vis;
 
  elem = document.getElementById(whichLayer);
  mystyle = elem.style;
  if ( document.getElementById('aditionalbar').value == "")
  {
     document.getElementById('aditionalbar').value="vis";
  } 
  if (document.getElementById('aditionalbar').value == "hid") 
  {
    mystyle.height = "100%"; 
    mystyle.overflow = "none";
    mystyle.display = "block";
    document.getElementById('toolbar').innerHTML = "↑ skryj ↑";
    document.getElementById('aditionalbar').value="vis";
    
  }
  else 
  {
    mystyle.height = "0px"; 
    mystyle.overflow = "hidden";
    document.getElementById('toolbar').innerHTML = "↓ zobraz ↓";
     document.getElementById('aditionalbar').value="hid";
  }
  
}

function addTag(tag, tagname)
{
  //alert("přidávám "+tag+" / "+tagname);
  if (document.getElementById('hid_tags').innerHTML.indexOf(tag) ==-1)
  {
    
    if (document.getElementById('a_alltags_'+tag) != null)
    {
      tagname = document.getElementById('a_alltags_'+tag).innerHTML;
    }
 
    document.getElementById('ul_currenttags').innerHTML += "<li id=\"li_currenttags_"+tag+"\"><a onclick=\"removeTag('"+tag+"')\" id=\"a_currenttags_"+tag+"\">" + tagname+" <img src=\"img/smaz.gif\" /></a>, </li>";
    document.getElementById('hid_tags').value += tag+",";
    if (document.getElementById('li_alltags_'+tag) != undefined)
    {
      document.getElementById('li_alltags_'+tag).style.display = "none";
    }
  } 
  
  return;

}
function removeTag(tag)
{
  if (document.getElementById('li_alltags_'+tag) != undefined)
  {
    document.getElementById('li_alltags_'+tag).style.display = "inline";
  }
  else
  {
    document.getElementById('ul_alltags').innerHTML += "<li id=\"li_alltags_"+tag+"\"><a onclick=\"addTag('"+tag+"')\" id=\"a_alltags_"+tag+"\">" + tag+", </li>";
  } 
  
  document.getElementById('hid_tags').value = document.getElementById('hid_tags').value.replace(tag+",","");
  document.getElementById('ul_currenttags').removeChild(document.getElementById('li_currenttags_'+tag));
    
    return;
    
}

function showtag()
{

alert(document.getElementById('hid_tags').value);

}

function clearTags()
{
  document.getElementById('hid_tags').value = "";
  //alert(document.getElementById('alltags').getElementsByTagName("a")[0].innerHTML);



for (var i = 0; i<  document.getElementById('alltags').getElementsByTagName("li").length; i++)
{
 removeTag(document.getElementById('alltags').getElementsByTagName("a")[i].innerHTML);
 //currentNode.style.display="inline";
  
}

  

  
  
}

sdiak = "áäčďéěíĺľňóô öŕšťúů üýřžÁÄČĎÉĚÍĹĽŇÓÔ ÖŔŠŤÚŮ ÜÝŘŽ";
bdiak = "aacdeeillnoo orstuu uyrzAACDEEILLNOO ORSTUU UYRZ";
function bezdiak(str)
{
  tx = "";
  txt = str;
  for(p = 0; p < txt.length; p++)
  {
    if (sdiak.indexOf(txt.charAt(p)) != -1)
	{
	  tx += bdiak.charAt(sdiak.indexOf(txt.charAt(p)));
	}
	else tx += txt.charAt(p);
  }
  
 reg = /\s+/g;
  tx = tx.replace(reg,'-');
  tx = tx.toLowerCase();
  return tx;
}


function showimg()
{

var dropdownIndex = document.getElementById('sel_title_image').selectedIndex;
var dropdownId = document.getElementById('sel_title_image')[dropdownIndex].id;
//document.write(dropdownValue);
  document.getElementById("img_show").src = "upload/"+dropdownId;
  if(document.getElementById("inp_border").checked == 1)
  {
    //alert("1");
    document.getElementById("img_show").setAttribute("class", "border");  
  }
  else
  {
    document.getElementById("img_show").setAttribute("class", ""); 
  }
  
 // alert(dropdownId);

}













