search_text = "vyhledat";
function Tip(Text) { window.status = Text;}
function ShowFoto(IMI){
	var URL;
	URL='bigimg.php?IMI='+IMI
	window.open(URL,'','scrollbars=1,width=800,height=600,status=0')
}

var testresults
function CheckEmail(field){
	var str=field
	var filter=/^.+@.+\..{2,3}$/
	if (filter.test(str))	testresults=true;
	else{	testresults=false;	}
}

function sendTest_contact(){
	var error_text
	error_text = "";
	CheckEmail(document.edit_contact.mail.value);
	if (document.edit_contact.notes.value.length == 0)	{ error_text = error_text + "\n" + "- Text" }  
	if (error_text != "") {error_text = "Zkontrolujte: " + error_text; window.alert(error_text);	return false; }  
}

function sendTest_friend(){
	error_text = "";
	CheckEmail(document.edit1.mailto.value);
	if (document.edit1.name.value.length == 0)	{		error_text = error_text + "\n" + "- Jméno" ;	}	
	if (! testresults) {		error_text = error_text + "\n" + "- E-mail"	}
	if (error_text != ""){
		error_text = "Zkontrolujte: " + error_text;
		window.alert(error_text);
		return false;
	}  
}

function sendTest_quicksearch(){
	var error_text
	var p
	p = 4;
	error_text = "Napište text pro vyhledávání.";
	if (document.quicksearch.text.value.length == 0)	{	window.alert(error_text);	return false;	}  
}
function sendTest_quicksearch_null(){	if (document.quicksearch.text.value == search_text)  document.quicksearch.text.value = ""}
function sendTest_quicksearch_notnull(){	if (document.quicksearch.text.value == "")	document.quicksearch.text.value = search_text;  }


//_____________________________________________________________________________________
//MENU SCRIPTS

function Browser() {
  var ua, s, i;
  this.isIE    = false;
  this.isNS    = false;
  this.version = null;
  ua = navigator.userAgent;
  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }
  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }
  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}

var browser = new Browser();
var activeButton = null;

if (browser.isIE)  document.onmousedown = pageMousedown;
if (browser.isNS)  document.addEventListener("mousedown", pageMousedown, true);

function pageMousedown(event) {
  var el;
  if (!activeButton)
    return;
  if (browser.isIE)
    el = window.event.srcElement;
  if (browser.isNS)
    el = (event.target.className ? event.target : event.target.parentNode);
  if (el == activeButton)
    return;

  if (el.className != "menuButton"  && el.className != "menuItem" &&
      el.className != "menuItemSep" && el.className != "menu")
    resetButton(activeButton);
}

function buttonMouseout(button, menuName) {    resetButton(button);}
function buttonMouseover(button, menuName) {
  if (activeButton) 
    resetButton(activeButton);
    depressButton(button);
}
function buttonClick(button, menuName) {
  if (!button.menu)
    button.menu = document.getElementById(menuName);
  if (activeButton && activeButton != button)
    resetButton(activeButton);
    depressButton(button);
  return false;
}

function depressButton(button) {
  var x, y;
  button.className = "menuButtonActive";
  x = getPageOffsetLeft(button);
  y = getPageOffsetTop(button);
  if (browser.isNS && browser.version < 6.1)
    y +=button.offsetWidth;
    x--;
    
  if (button.menu) {
	  button.menu.style.left = x +1 + "px";
	  button.menu.style.top  = y +14 + "px";
	  button.menu.style.visibility = "visible";
  }
  activeButton = button;
}

function resetButton(button) {
  button.className = "menuButton";
  if (button.menu)
    button.menu.style.visibility = "hidden";
  activeButton = null;
}
function getPageOffsetLeft(el) {  return el.offsetLeft + (el.offsetParent ? getPageOffsetLeft(el.offsetParent) : 0);}
function getPageOffsetTop(el) {  return el.offsetTop + (el.offsetParent ? getPageOffsetTop(el.offsetParent) : 0);}


