// JavaScript Document
var mydiv,mhlpid;
var oScript
var BoolNasept
var myInterval
var Pocitadlo=1
var AllTop=0
function checkImageInA(imgn,nr,el)
{
myImg=el.getElementsByTagName('img')[0];
myName='/ico/'+imgn+nr+'.gif';
myImg.src=myName;
return true;
}

function getA(el,tn)
{
if(el.tagName!=tn)return false
  {
	myL=el.getElementsByTagName('A')[0].href;
	document.location.href=myL;
	return false;
	}
}
function setUNAME()
{
document.getElementById('U_UNAME').value=document.getElementById('U_MAIL').value;
}
function getParentNode(el,tname)
{
myEl=el.parentNode;
if(myEl.tagName=='BODY')return false;
if(myEl.tagName!=tname)el=getParentNode(myEl);
return myEl;
}
function setCookie(name, value, expire) {
   document.cookie = name + "=" + escape(value)
   + ((expire == null) ? ";expires=01 Jan 2050 00:00:00 GMT" : ("; expires=" + expire.toGMTString()))
   + ";site="+ location.hostname+";path=/;";
  /*  var ckname= name + "=" +value 
   + ((expire == null) ? ";expires=01 Jan 2050 00:00:00 GMT;" : ("; expires=" + expire.toGMTString()))
   + "path=/;";
   document.cookie = escape(ckname);*/
}
function getCookie(Name) {
   mystring=unescape(document.cookie)
   var search = Name + "="
   //if (document.cookie.length > 0) 
   if (mystring.length > 0)
   { // if there are any cookies
      //alert(document.cookie.length)
      //offset = document.cookie.indexOf(search) 
      offset = mystring.indexOf(search) 
      if (offset != -1) 
      { // if cookie exists 
         offset += search.length 
         // set index of beginning of value
         //end = document.cookie.indexOf(";", offset) 
         end = mystring.indexOf(";", offset) 
         // set index of end of cookie value
         //if (end == -1)end = document.cookie.length
         if (end == -1)end = mystring.length
         //return unescape(document.cookie.substring(offset, end))
         return unescape(mystring.substring(offset, end))
      } 
   }
  return false; 
}
function GoOBR2(myid)
{
myPATH='/image.php?ID='+myid;
//alert(myPATH)
//return false
self.name="togot";
feath="resizable=1,width=200,height=200,location=0,directories=0,toolbar=0,menubar=0,status=1,dependent=1,scrollbars=1"
myM=window.open(myPATH,"OBRGAL",feath)
if(myM)myM.focus();
myM=!myM
return myM
}
function confirmSendOrd(el)
{
  //PR,KS
  ks=parseInt(document.getElementById('KS').value);
  //alert(ks);
  cn=parseFloat(document.getElementById('PR').value);
  rp=parseFloat(document.getElementById('RP').value);
  vysl=ks*(cn+rp);
  document.getElementById('toid').value=vysl;
  
		dodatek='';
  myF=confirm('Chci objednat - '+ ks +' ks zboží o celkové ceně ' +  vysl + '!'+dodatek)
  if(!myF)return false;
  el.form.submit();
  return true;
}
function ReCountFl(pol,el,toid)
{
 pocet=parseInt(el.value)
 rp=parseInt(document.getElementById("RP").value);
 pr=parseFloat(document.getElementById("PR").value);
 ks=parseInt(document.getElementById("KS").value);
 //alert(cena);
 document.getElementById('toid').value=(rp+pr)*ks;

   
}
function MakeWin2(pth,w,h,mname)
{
if(mname=='')mname='nahledy'
 myM=window.open(pth,mname,"left=50,top=50,location=0,directories=0,toolbar=0,menubar=0,status=1,scrollbars=1,height=" + h + ",width=" + w +",resizable=1,dependent=0");
 if(myM)myM.focus();
 myM=!myM
return myM
}
 function myConfirm(zprava)
{
var myStr="Vybral jste příkaz \n"+zprava+"!";
    myStr+="\n Mám pohračovat?"
    myVal= window.confirm(myStr)
    return myVal;
}
function stOP(ev)
{
if(!document.all)
 {
 ev.stopPropagation();
 obr=ev.target
 el=obr.parentNode.parentNode.getElementsByTagName('TD')[1];

 }
 else
 {
 event.cancelBubble=true;
 obr=event.srcElement;
 el=obr.parentElement.parentElement.getElementsByTagName('TD')[1];

 }
if(el.className=="open")
   {
   el.className="closed";
   el.getElementsByTagName("TABLE")[0].style.display="none";
   obr.src='/ico/tree2/plus1.gif';
   return false;
   }
if(el.className=="closed")
   {
   el.className="open";
   el.getElementsByTagName("TABLE")[0].style.display="";
   obr.src='/ico/tree2/minus1.gif'
   return false;
   }
return false;
}
function PstOP(ev)
{
if(!document.all)
 {
 ev.stopPropagation();
 obr=ev.target
 el=obr.parentNode.parentNode.getElementsByTagName('TD')[1];

 }
 else
 {
 event.cancelBubble=true;
 obr=event.srcElement;
 el=obr.parentElement.parentElement.getElementsByTagName('TD')[1];

 }
if(el.className=="proopen")
   {
   el.className="proclosed";
   el.getElementsByTagName("TABLE")[0].style.display="none";
   obr.src='/ico/tree2/plus2.gif';
   return false;
   }
if(el.className=="proclosed")
   {
   el.className="proopen";
   el.getElementsByTagName("TABLE")[0].style.display="";
   obr.src='/ico/tree2/minus2.gif'
   return false;
   }
return true;
}
function setSbal()
{
myLis=document.getElementById("lmenu").getElementsByTagName('img');
for(i=0;i<myLis.length;i++)
 {
   
   obr=myLis[i];
   
   if(obr.className=='active')
   {
	 if (window.addEventListener)
	    {
	     obr.addEventListener("click", stOP, false); 
			     
	    }
	else
	    {
	    obr.attachEvent("onclick",stOP); 	    
	    }
	 }
	 if(obr.className=='bactive')
   {
	 if (window.addEventListener)
	    {
	     obr.addEventListener("click", PstOP, false); 
			     
	    }
	else
	    {
	    obr.attachEvent("onclick",PstOP); 	    
	    }
	 }
 }
ho=document.getElementById('obsah').offsetHeight;
hl=document.getElementById('lmenu').offsetHeight;
h=hl>ho?hl:ho;

document.getElementById('lmenu').style.height=h+'px';
//setOkr()
}
function setOkr()
   {
   
   
    if(!document.all)
    {
    bW=document.width;
    bH=document.body.offsetHeight;
    }
    else
    {
    bW=document.body.offsetWidth;
    bH=document.body.offsetHeight;
    }
    if(bW<600)bW=600;
  
    //document.getElementById('pravy').style.left=(bW-205)+'px';
   // document.getElementById('obsah').style.width=(bW-210)+'px';
    
  /* grps= document.getElementById('obsah').getElementsByTagName('COLGROUP');
   for(i=0;i<grps.length;i++)
       {
			 grps[i].style.width=((bW-210))/2+'px';
			 }*/
    window.onresize=setOkr;
}
function getHelpDiv(e,hlpid)
{
mydiv=document.getElementById("hlpdiv");
if(document.all)
  {
	e=window.event;
	el=event.srcElement;
	bW=document.body.offsetWidth;
	if (document.documentElement && document.documentElement.scrollTop) 
				{
				
				oldW=event.clientX + document.documentElement.scrollLeft;
				if(oldW+100>bW)
				  {
					nleft=bW-110
					}
					else
					{
					nleft=oldW
					}
				mydiv.style.left  = nleft
				mydiv.style.top = event.clientY + document.documentElement.scrollTop;
				
				}
				else if (document.body) // all other Explorers
				{
				oldW=event.clientX + document.body.scrollLeft;
				if(oldW+100>bW)
				  {
					nleft=bW-200
					}
					else
					{
					nleft=oldW
					}
				mydiv.style.left  = nleft
				mydiv.style.top= event.clientY + document.body.scrollTop;
				
				} 
 
 	e.cancelBubble=true;
 	event.cancelBubble=true
	}
	else
	{
	el=e.target;
	bW=document.width;
	e.stopPropagation();
	//oldLeft=(e.clientX+document.body.scrollLeft);
	//oldTop= (e.clientY+document.body.scrollTop );
	oldLeft=e.pageX	;
	oldTop=e.pageY;
	if((oldLeft+100)>bW)
	  {
		oldLeft=bW-200;
		}
	mydiv.style.left =oldLeft +'px';
  mydiv.style.top  =oldTop+'px';
  
	}
	mhlpid=hlpid
  oScript = document.createElement('script');
  oScript.setAttribute('type','text/javascript');
  var d = new Date()
  var t = d.getTime()
  oScript.setAttribute('src','/lbr/js_hlp.php?hlpid='+hlpid+'&stamp='+t);
  mydiv.appendChild(oScript);
  mydiv.style.zIndex='999';
  mydiv.style.display ='block';

  return false;
}
function hideHLP()
{
mydiv=document.getElementById("hlpdiv");
mydiv.style.display ='none';
mydiv.removeChild(oScript)
oScript='NULL';
}
function getHLP()
{
hideHLP()
pth="/hlp.php?hlpid="+mhlpid
MakeWin2(pth,600,500,'hlp');
}
function activMe(nr,el)
{
//el=event.srcElement
if (el.tagName!="TD")
	{
	if (el.tagName=="A")
		{
		el=el.parentElement
		}
	else
		{
		if (el.tagName=="IMG")
			{
			el=el.parentElement.parentElement
			}
		else
			{
			return false;
			}
		}
	}
	if (nr)
		{
		el.style.backgroundColor="rgb(255,255,255)"
		if(el.getElementsByTagName('A').lenght>0)
		{
		el.title=el.getElementsByTagName('A')[0].getAttribute("title") 
     
        }

		}
	else
		{
		el.style.backgroundColor="";
		}
	return true;
}
function goMe(el)
{

if (el.tagName!="TD" && el.tagName!="P")return;
mycol=el.getElementsByTagName('A');
if(mycol.length==0)return;
myUrl=mycol[0].getAttribute("href");
if(myUrl!='')window.location.href=myUrl;
}
function setAkci(e,n)
{
myElement=e;
myid=e.value
path='/rs/tools/js_akce.php?ID='+myid+'&nname='+n;
var oScript = document.createElement('script');
  oScript.setAttribute('type','text/javascript');
  oScript.setAttribute('src',path);
  document.getElementsByTagName("BODY")[0].appendChild(oScript);
}
function goDict(ev,myid)
{
myNasept=document.getElementById('nasept');
if(!myNasept)
   {
	 myNasept=document.createElement('div');
	 myNasept.setAttribute('id','nasept');
	 document.getElementsByTagName('body')[0].appendChild(myNasept);
	 }
var oScript = document.createElement('script');
oScript.setAttribute('type','text/javascript');
oScript.setAttribute('src','/lbr/dict.php?DID='+myid);
document.getElementById('nasept').appendChild(oScript);
ShowY(ev);
}
 function ShowY(ev)
  {
  BoolNasept=true  
  ZrusNasept();
  mydiv=document.getElementById('nasept')
    if(!window.addEventListener)
       {
       el=event.srcElement
       if(el.tagName!='SPAN')return false
               
       myy=event.clientY+document.documentElement.scrollTop
       myx=event.clientX
       mydiv.attachEvent("onmouseover", ukazNasept);
       mydiv.attachEvent("onmouseout", hideNasept);
       }
       else
       {
       mydiv.addEventListener("mouseover", ukazNasept, false);
       mydiv.addEventListener("mouseout", hideNasept, false);
       el=ev.target
       if(el.tagName!='SPAN')return false
       myy=ev.pageY
       myx=ev.pageX
       }
       
       
       myx=myx+30;
       myy=myy-100;
       if(myx<0)myx=10
      
       mydiv.style.left=myx+'px';
       mydiv.style.top=myy+'px';
       mydiv.style.display='block';
       mydiv.style.zIndex='1000';
       return true;
  }
function hideNasept()
{
BoolNasept=false
}  
function ukazNasept()
  {
	BoolNasept=true
	}
function ZrusNasept()
{
 if(myInterval)
   {
	 window.clearTimeout(myInterval)
	 }
 if(!BoolNasept)
 {
 mydiv=document.getElementById('nasept')
 mydiv.style.display='none';
 return 
 }
 myInterval= window.setTimeout("ZrusNasept()",1000); // načasuje akci
 
}
function setNasept(result)
{
document.getElementById('nasept').innerHTML=result;
}