/**
 *
 * @access public
 * @return void
 **/
function focusLogin(){
    //fokusování
 if(document.forms.length>0){
    document.forms[0][0].focus();
 }


}


function clearMe(field,val)
{
	if (val == 'heslo' && field.value==val) {
	    field.type = 'password';
	    field.value = '';
	}else if(field.value==val)
	{
		field.value = '';
	}
}

function showMe(field,val)
{
    if (val == 'heslo') {
        if (field.value.replace(/(^ +| +$)/, "")=='') {
             field.type = 'text';
            field.value = val;
        }
    }else if(field.value.replace(/(^ +| +$)/, "")=='')
	{
		field.value = val;
	}
}

function changeImages(obr,scr) {
        if (document.images && (preloadFlag == true)) {
                obr.src = "img/" + scr;
        }
}


function newImage(arg) {
        if (document.images) {
                rslt = new Image();
                rslt.src = arg;
                return rslt;
        }
}

function findElement(n,ly) {
        if (browserVers < 4)                return document[n];
        var curDoc = ly ? ly.document : document;
        var elem = curDoc[n];
        if (!elem) {
                for (var i=0;i<curDoc.layers.length;i++) {
                        elem = findElement(n,curDoc.layers[i]);
                        if (elem) return elem;
                }
        }
        return elem;
}

// JavaScript Document

function showhide(idecko,text,show,hide){
    el=document.getElementById(idecko).style;
    el.display=(el.display == 'block')?'none':'block';
    text.innerHTML=(el.display != 'block')?show:hide;
}

function confirmSubmit(text){
    var agree=confirm(text);
    if (agree)
	    return true ;
    else
	    return false ;
    }

/**
 *
 * @access public
 * @return void
 **/
function changePic(button,id,src){
    img = document.getElementById(id);
    img.src = src;
    //button.style.background = "gray";

}

/**
 *
 * @access public
 * @return void
 **/
function hideDiv(area,id){
    div = document.getElementById(id);
   if(area.value.length > 0){
    div.style.display='none';
    //div.style.opacity='70%';
   }else{
    div.style.display='block';
    //div.style.opacity='100%';
   }
}

function limiter(area,text,max){


if(area.value.length > max){
// In some Browsers this would work fine:
// return false;
// As it don't work in all, take this:
    area.value = area.value.substr(0, max);
}
document.getElementById(text).innerHTML = area.value.length+"/"+max;
}

//volani <a onclick="return picsWindow(\'help_texy.php\',\'_texy\');" >Formatovani</a>
var myTWin = window.myTWin;
function picsWindow(link,winName)
{
  var retValue=true;
  if (myTWin!=null && !myTWin.closed)
  {
    myTWin.focus();
    myTWin.location.href=link;
  }
  else
  {
    myTWin=window.open(link,winName,"height=600,width=400,top=30,left=30,status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes");
    if (myTWin==null || typeof(myTWin)=="undefined")
      retValue=false;
    else
    {
      link.target=winName;
      myTWin.focus();
    }
  }
  return retValue;
}
function Disab(val) {
kat=document.getElementById('kat');
if(val=="akce" || val=="novinka"){
    kat.disabled=false;
}else{
    kat.disabled=true;
}
}

// Obrazky mimo stranku v jinym okne
function bigimg(SRC)
{
        var URL;
        URL="bigimg.php?url="+SRC
        window.open(URL,'','width=650,height=560,resizable=1,left=0,top=0')
}

