
function SelectAll(theSelect,value){
  for( var i=0; i<theSelect.length; i++ )
    theSelect.options[i].selected = value
} 

function addOption( sel0 , sel1 )
{
   var len = sel1.length;
   for( var i = 0; i < sel0.length; i++) {
      if ((sel0.options[i] != null) && (sel0.options[i].selected)) {
         var found = false;
         for(var count = 0; count < len; count++) {
            if (sel1.options[count] != null) {
               if (sel0.options[i].value == sel1.options[count].value) {
                  found = true;
                  break;
               }
            }
         }
         if (found != true) {
            sel1.options[len] = new Option(sel0.options[i].text,sel0.options[i].value);
            len++;
         }
      }
   }
}

function delOption( sel1 )
{
  for(var i = (sel1.length-1); i >= 0; i--) {
    if ((sel1.options[i] != null) && (sel1.options[i].selected == true)) {
      sel1.options[i] = null;
    }
  }
}

function closeWindow(){
  window.opener.location.reload();
  window.close(); 
}

function calendarOpen(obj_id){
   url = '/calendar.php?obj_id=' + obj_id ;
   popup = window.open( url , "popup_calendar" , "height=159,width=175,status=no,toolbar=no,menubar=no,location=no,scrollbars=no" ) ;
   popup.focus();
}
function timerOpen(obj_id){
   url = '/timer.php?obj_id=' + obj_id ;
   popup = window.open( url , "popup_timer" , "height=127,width=127,status=no,toolbar=no,menubar=no,location=no,scrollbars=no" ) ;
   popup.focus();
}

function changeRowsOnPage(rows){
	document.getElementById('paging_rowsOnPage').value=rows;
	document.form_filter.submit();
}

function changePageNumSet(pageNum){
	document.getElementById('paging_pageNum').value=pageNum;
	document.form_filter.submit();
}

function checkPageNum(){
	var oPageNum = document.getElementById('pageNum');
	var iPageNumSelect = oPageNum.options[oPageNum.selectedIndex].value;
	var iPageNumMax = oPageNum.options[oPageNum.length -1].value;
	
	if(iPageNumSelect > 1){
		obj_tl = document.getElementById('paging_first');
		obj_tl.disabled = false;
		obj_tl = document.getElementById('paging_back');
		obj_tl.disabled = false;	
	}

	if(iPageNumSelect < iPageNumMax){
		obj_tl = document.getElementById('paging_last');
		obj_tl.disabled = false;
		obj_tl = document.getElementById('paging_next');
		obj_tl.disabled = false;	
	}
}

function wizardOpen(url, width, height){
	
	if(width){
		var iWinWidth = width;
	}else{
		var iWinWidth = 400;
	}
	
	if(width){
		var iWinHeight = height;
	}else{
		var iWinHeight = 300;
	}
	
	iMyWidth  = window.screenX + (window.outerWidth/2) - (iWinWidth/2);
	iMyHeight = window.screenY + (window.outerHeight/2) - (iWinHeight/2);
	
	okno = window.open( url , 'wizard', 'width='+iWinWidth+',height='+iWinHeight+',left=' + iMyWidth + ',screenX=' + iMyWidth + ',top=' + iMyHeight + ',screenY=' + iMyHeight ) ;
	okno.focus();
} 

function registraceOpen(){ wizardOpen('registrace_new.php', 400, 335); }
function sendPass(email){ wizardOpen('sendPass.php?email='+email, 400, 160); }

function msgNew(){ wizardOpen('msg_new.php', 550, 450); }
function msgEdit(id){ wizardOpen('msg_edit.php?id='+id, 550, 450); }
function msgDel(id){ wizardOpen('msg_del.php?id='+id); }

function schoolEdit(id){ wizardOpen('school_edit.php?id='+id, 400, 330); }
function schoolDel(id){ wizardOpen('school_del.php?id='+id, 500, 200); }

function personEdit(id){ wizardOpen('person_edit.php?id='+id, 400, 330); }
function personDel(id){ wizardOpen('person_del.php?id='+id, 500, 200); }

function userEdit(id){ wizardOpen('user_edit.php?id='+id, 400, 330); }
function userDel(id){ wizardOpen('user_del.php?id='+id, 500, 200); }

function galerieNew(){ wizardOpen('galerie_new.php', 550, 420); }
function galerieEdit(id){ wizardOpen('galerie_edit.php?id='+id, 550, 420); }
function galerieDel(id){ wizardOpen('galerie_del.php?id='+id, 600, 200); }

function galerieFileNew(){ wizardOpen('galerieFile_new.php', 550, 450); }
function galerieFileDel(key){ wizardOpen('file_del.php?key='+key, 550, 200); }

function otazkaNew(){ wizardOpen('otazka_new.php', 450, 360); }
function otazkaEdit(id){ wizardOpen('otazka_edit.php?id='+id, 450, 360); }
function otazkaDel(id){ wizardOpen('otazka_del.php?id='+id, 500, 200); }

function soutezNew(){ wizardOpen('soutez_new.php', 650, 470); }
function soutezEdit(id){ wizardOpen('soutez_edit.php?id='+id, 650, 470); }
function soutezDel(id){ wizardOpen('soutez_del.php?id='+id, 500, 200); }

function koloNew(){ wizardOpen('soutezKolo_new.php', 500, 300); }
function koloDel(id){ wizardOpen('soutez_kolo_del.php?id='+id); }

function soutezPopisNew(){ wizardOpen('soutezPopis_new.php', 500, 500); }

function testNew(id){ wizardOpen('/soutez_test_new.php?id='+id, 650, 470); }
function testShow(id){ wizardOpen('/soutez_test_show.php?id='+id, 650, 470); }
function testDel(id){ wizardOpen('/soutez_test_del.php?id='+id, 500, 200); }

function exkurzeNew(){ wizardOpen('exkurze_new.php', 550, 310); }
function exkurzeEdit(id){ wizardOpen('exkurze_edit.php?id='+id, 550, 310); }
function exkurzeDel(id){ wizardOpen('exkurze_del.php?id='+id, 550, 200); }

function bodyAdd(id){ wizardOpen('/school_body_add.php?id='+id, 550, 200); }
function bodyDel(id){ wizardOpen('/school_body_del.php?id='+id, 550, 200); }

function ukolNew(){ wizardOpen('new.php', 550, 450); }
function ukolEdit(id){ wizardOpen('edit.php?id='+id, 550, 450); }
function ukolDel(id){ wizardOpen('del.php?id='+id); }

function kinoNew(){ wizardOpen('new.php', 550, 450); }
function kinoEdit(id){ wizardOpen('edit.php?id='+id, 550, 450); }
function kinoDel(id){ wizardOpen('del.php?id='+id); }
