

function js_core_ConfirmDeleteEnable(aId)
{
   if (aId)
   {
      document.getElementById(aId).value=1;
   }
   else
   {
      document.getElementById("aid_confirmdelete").value=1;
   }
   
}
function js_core_ConfirmDelete(aId)
{
   if (aId)
   {
      rId=aId;
   }
   else
   {
      rId="aid_confirmdelete";
   }
      
    if (document.getElementById(rId).value==1)
    {
      if (document.getElementById(rId + "_text").value)
      {
         rText=document.getElementById(rId + "_text").value;
      }
      else
      {
         rText="Chcete tuto položku opravdu smazat ?";
      }
      
      if (confirm(rText))
      {
         return true;
      }
      else
      {
         document.getElementById(rId).value=0;
         return false;
      }
    }
}

function ajs_ShowPannel (aId, aN, aCount)
{
   for (rI=1;rI<=aCount;rI++)
   {
      rId=aId + rI;
      rId2=aId + "Switch" + rI;
      rC=document.getElementById(rId2).className;
      if (rC=="Core_PannelSwitch Core_PannelSwitch_Normal" || rC=="Core_PannelSwitch Core_PannelSwitch_Active")
      { 
         if (rI==aN)
         {
            document.getElementById(rId).className="Core_Pannel Core_Pannel_Active";
            document.getElementById(rId2).className="Core_PannelSwitch Core_PannelSwitch_Active";
         }
         else
         {
            document.getElementById(rId).className="Core_Pannel Core_Pannel_Normal";
            document.getElementById(rId2).className="Core_PannelSwitch Core_PannelSwitch_Normal";
         }
      }
   }
}

function ajs_eshop_pricebez(aId1,aId2,aId3)
{
   if (document.getElementById(aId1) && document.getElementById(aId2) && document.getElementById(aId3))
   {
      document.getElementById(aId1).value=Math.floor(document.getElementById(aId2).value/(1+document.getElementById(aId3).value/100)*1000)/1000;
   }
}
function ajs_eshop_pricedph(aId1,aId2,aId3)
{
   if (document.getElementById(aId1) && document.getElementById(aId2) && document.getElementById(aId3))
   {
      document.getElementById(aId2).value=Math.floor(document.getElementById(aId1).value*(1+document.getElementById(aId3).value/100)*1000)/1000;
   }
}

function ajs_eshop_pricebez2(aId)
{
   aId1="pricebez_" + aId;
   aId2="pricedph_" + aId;
   aId3="dphk_" + aId;
   if (document.getElementById(aId1) && document.getElementById(aId2) && document.getElementById(aId3))
   {
      document.getElementById(aId1).value=Math.round(document.getElementById(aId2).value/(1+document.getElementById(aId3).value/100)*1000)/1000;
   }
}
function ajs_eshop_pricedph2(aId)
{
   aId1="pricebez_" + aId;
   aId2="pricedph_" + aId;
   aId3="dphk_" + aId;
   if (document.getElementById(aId1) && document.getElementById(aId2) && document.getElementById(aId3))
   {
      document.getElementById(aId2).value=Math.round(document.getElementById(aId1).value*(1+document.getElementById(aId3).value/100)*1000)/1000;
   }
}

function ajs_core_value(aId,aDt)
{
   document.getElementById(aId).value=aDt;
}



/***********************************************
* Freejavascriptkit.com
* Visit http://www.freejavascriptkit.com for more free Javascripts source code
***********************************************/

var offsetxpoint=-60 //Customize x offset of tooltip
var offsetypoint=20 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thecolor, thewidth){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}

function positiontip(e){
if (enabletip){
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20

var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
else if (curX<leftedge)
tipobj.style.left="5px"
else
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetxpoint+"px"

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight)
tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
else
tipobj.style.top=curY+offsetypoint+"px"
tipobj.style.visibility="visible"
}
}

function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}

document.onmousemove=positiontip


function ajs_CheckAll(a_Prefix,a_Count,a_Value)
{
   rCheck=document.getElementById(a_Prefix).checked;
   for (i=1; i <= a_Count; i++)
   {
      rId=a_Prefix + i;
      //alert(rId);
      if (rCheck)
      {
         $rValue=document.getElementById(rId).value;
         if ($rValue==1)
         {
            document.getElementById(rId).checked=rCheck;
         }
         if ($rValue==2)
         {
            document.getElementById(rId).checked=0;
         }
      }
      else
      {
         document.getElementById(rId).checked=rCheck;
      }

   }   
}

function ajs_Popup_Open(a_Href, a_Width, a_Height)
{
   a_Title="Vybrat";
   window.open(a_Href,a_Title, "width=400,height=500,toolbar=no,location=no,status=no,menubar=yes,scrollbars=yes");
   return false; 
}



