/*****************************************************
 * JavaScript functions for:                         *
 *                                                   *
 *      --==+Asynchronous E-learning System+==--     *   
 *                                                   *
 *                                From version: 1.34 *
 *                          (c) 2005-2006 Jan Zboril *
 *****************************************************/


function setCheckbox( ID ) 
/* set checkbox by ID to true/false */
{
    var checkbox = document.getElementById(ID);

        if ( checkbox.type == 'checkbox' ) 
        {
            if ( checkbox.checked )
            {
              checkbox.checked = false;
            }
            else
            {
              checkbox.checked = true;
            }
        }

    return true;
}

function setCheckboxes( container_id, state ) 
/* set checboxes array to true/false*/
{
    var checkboxes = document.getElementById(container_id).getElementsByTagName('input');

    for ( var i = 0; i < checkboxes.length; i++ ) {
        if ( checkboxes[i].type == 'checkbox' ) {
            checkboxes[i].checked = state;
        }
    }

    return true;     
}     

function select_all(f_id) 
// set all checkboxes in form with id >f_id< like checked
{
  for(var i = 0; i < document.getElementById(f_id).elements.length; i++) 
  {
    if(document.getElementById(f_id).elements[i].type == "checkbox" &&
      document.getElementById(f_id).elements[i].id != "")
      document.getElementById(f_id).elements[i].checked = true;
  }
}

function unselect_all(f_id) 
// set all checkboxes in form with id >f_id< like unchecked
{
  for(var i = 0; i < document.getElementById(f_id).elements.length; i++) 
  {
    if(document.getElementById(f_id).elements[i].type == "checkbox" &&
       document.getElementById(f_id).elements[i].id != "")
      document.getElementById(f_id).elements[i].checked = false;
  }
}

// globalni promena
var old_background_color

// JS Highlight 
function Highlight(el_id, hl) 
// funkce pro obarvovani policek kalendatre
{
	if (hl)
		old_background_color = document.getElementById(el_id).style.backgroundColor

	document.getElementById(el_id).style.backgroundColor = hl ? "#ffffff" : old_background_color;
}   

 
function go(link) 
// funkce pro presunuti po klinuti napr na radku tabulky na adresu >link<
{
  self.location.href = link;
}   

var myTWin = window.myTWin;

/*<a href="http://www.zoner.cz/" onclick="return !OpenMyWin(this,'_okno', 250, 250);">Zoner.cz</a> */


function OpenMyWin(link,winName, x, y, scroll, res)
// ohleduplne otevreni noveho js scriptem o rozmerech x, y
{
  var retValue=true;
  if (myTWin!=null && !myTWin.closed)
  {
    myTWin.focus();
    myTWin.location.href=link.href;
  }
  else
  {
    myTWin=window.open(link.href,winName, "width="+(x)+",height="+(y)+",resizable="+(res)+",scrollbars="+(scroll)+",menu=0,navigate=0,statusbar=0");
    if (myTWin==null || typeof(myTWin)=="undefined")
      retValue=false;
    else
    {
      link.target=winName;
      myTWin.focus();
    }
  }
  return retValue;
}

// pokiud jsou na strance potreba dve ruzna okna!
var myTWin2 = window.myTWin2;

/*<a href="http://www.zoner.cz/" onclick="return !OpenMyWin(this,'_okno', 250, 250);">Zoner.cz</a> */


function OpenMyWin2(link,winName, x, y, scroll, res)
// ohleduplne otevreni noveho js scriptem o rozmerech x, y
{
  var retValue=true;
  if (myTWin2!=null && !myTWin2.closed)
  {
    myTWin2.focus();
    myTWin2.location.href=link.href;
  }
  else
  {
    myTWin2=window.open(link.href,winName, "width="+(x)+",height="+(y)+",resizable="+(res)+",scrollbars="+(scroll)+",menu=0,navigate=0,statusbar=0");
    if (myTWin2==null || typeof(myTWin2)=="undefined")
      retValue=false;
    else
    {
      link.target=winName;
      myTWin2.focus();
    }
  }
  return retValue;
}
 

