
function addBookmark(title,url) {
	if (window.sidebar) {
		window.sidebar.addPanel(title, url,"");
	} else if( document.all ) {
		window.external.AddFavorite( url, title);
	} else if( window.opera && window.print ) {
		return true;
	}
}

function okno(soubor,sirka,vyska)  {
	window.open(soubor,'','toolbar=no,scrollbars=yes,location=no,status=no,width='+sirka+',height='+vyska+',resizable=1')
}

// ------------------------------------------ zmena tridy
function Aktivni(id)  {
  document.getElementById(id).className = "aktivni";
}

function Deaktivni(id)  {
  document.getElementById(id).className = "";
}

// ------------------------------------------ funkce pro rozbalovaci menu

var PocetMenu = 3;

function show(menu_item)
{
  document.getElementById("podmenu" + menu_item).style.visibility = "visible";
 // document.getElementById("a-menu"+menu_item).className = "selected";
}

function hide(menu_item)
{
  document.getElementById("podmenu" + menu_item).style.visibility = "hidden";
 // document.getElementById("a-menu"+menu_item).className="";
}

function FormularValidation() {
	var nevyplneno = "";
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	
	if (!document.getElementById("vzkaz_text").value || document.getElementById("vzkaz_text").value == "Text") nevyplneno += "\n- text vzkazu";
	
	if (!document.getElementById("vzkaz_email").value || document.getElementById("vzkaz_email").value == "Váš e-mail") nevyplneno += "\n- e-mail";
		else if (reg.test(document.getElementById("vzkaz_email").value) == false) nevyplneno += "\n- zadaný e-mail není platný";
	
	if (nevyplneno) {
		nevyplneno = "Nevyplnili jste následující položky!"+nevyplneno+"\nFormulář nebude odeslán...";
		alert(nevyplneno);
		return false;
	} else {
		return true;
	}
}


function validateNumsOnly(evt) {
  var theEvent = evt || window.event;
  var key = theEvent.keyCode || theEvent.which;
  key = String.fromCharCode( key );
  var regex = /[0-9]/;
  if( !regex.test(key) ) {
    theEvent.returnValue = false;
    theEvent.preventDefault();
  }
}
function TipnamistraValidation() {
	var nevyplneno = "";
	var reg = /[0-9]/;
	
	if (!document.getElementById("odpovedTym").value) nevyplneno += "\n- tým";

	if (!document.getElementById("odpovedMice").value) nevyplneno += "\n- počet míčů";
		else if (reg.test(document.getElementById("odpovedMice").value) == false) nevyplneno += "\n- počet míčů";
	
	
	if (nevyplneno) {
		nevyplneno = "Nevyplnili jste následující položky!"+nevyplneno+"\nFormulář nebude odeslán...";
		alert(nevyplneno);
		return false;
	} else {
		return true;
	}

}

// here we define global variable
var ajaxdestination="";

function getdata(what,where) { // get data from source (what)
 try {
   xmlhttp = window.XMLHttpRequest?new XMLHttpRequest():
  		new ActiveXObject("Microsoft.XMLHTTP");
 }
 catch (e) { /* do nothing */ }
 document.getElementById(where).innerHTML ="<center><img src='../img/loading.gif'></center>";
// we are defining the destination DIV id, must be stored in global variable (ajaxdestination)
 ajaxdestination=where;
 xmlhttp.onreadystatechange = triggered; // when request finished, call the function to put result to destination DIV
 xmlhttp.open("GET", what);
 xmlhttp.send(null);
  return false;
}

function triggered() { // put data returned by requested URL to selected DIV
  if (xmlhttp.readyState == 4) if (xmlhttp.status == 200) 
    document.getElementById(ajaxdestination).innerHTML =xmlhttp.responseText;
}



//vypnout/zapnout DIVy **************************************
function toggle(cilovyObjekt) {
	Effect.toggle(cilovyObjekt, 'blind', { duration: 0.2 });
	
}
