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;
	}
}

// ------------------------------------------ vzskakovaci okno
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 = "";
}

// ------------------------------------------ vynuluje obsah form prvku
function Vynuluj(id)  {
  document.getElementById(id).value = "";
}

// ------------------------------------------ kontrola formulare pred odeslanim
function checkForm()  {
	if(document.getElementById('jmeno').value == "") {
		document.getElementById('formError').innerHTML = '<div class="box-error">CHYBA: nebyla vyplněna položka <strong>Jméno</strong>.</div>';
		document.getElementById('jmeno').focus();
		return false;
	} else if(document.getElementById('prijmeni').value == "") {
		document.getElementById('formError').innerHTML = '<div class="box-error">CHYBA: nebyla vyplněna položka <strong>Příjmení</strong>.</div>';
		document.getElementById('prijmeni').focus();
		return false;
	} else if(document.getElementById('adresa').value == "") {
		document.getElementById('formError').innerHTML = '<div class="box-error">CHYBA: nebyla vyplněna položka <strong>Adresa</strong>.</div>';
		document.getElementById('adresa').focus();
		return false;
	} else if(document.getElementById('telefon').value == "") {
		document.getElementById('formError').innerHTML = '<div class="box-error">CHYBA: nebyla vyplněna položka <strong>Telefon</strong>.</div>';
		document.getElementById('telefon').focus();
		return false;
	} else if(document.getElementById('email').value == "") {
		document.getElementById('formError').innerHTML = '<div class="box-error">CHYBA: nebyla vyplněna položka <strong>E-mail</strong>.</div>';
		document.getElementById('email').focus();
		return false;
	} else if(document.getElementById('souhlas').checked == false) {
		document.getElementById('formError').innerHTML = '<div class="box-error">CHYBA: potvrďte prosím souhlas s podmínkami soutěže.</div>';
		document.getElementById('souhlas').focus();
		return false;
	}
}

// ------------------------------------------ kontrola formulare pred odeslanim - odeslani souboru
function checkFile() {
  var ext = document.getElementById('soubor').value;
  ext = ext.substring(ext.length-3,ext.length);
  ext = ext.toLowerCase();
  if(ext != 'jpg') {
		document.getElementById('formError').innerHTML = '<div class="box-error">CHYBA: nebyl zadán soubor ve formátu JPG.</div>';
    return false;
	} else {
    return true;
	}
}

// ------------------------------------------ nove okno
function popupOdkazy() {
  if (!document.getElementsByTagName) return false;
  var links = document.getElementsByTagName("a");
  for (var i=0; i < links.length; i++) {
    if (links[i].className.match("popup")) {
      links[i].onclick = function() { return !window.open(this.href); }
    }
  }
  return true;
}
window.onload = popupOdkazy;

// ----------------------------------------- zmena URL vybranim v 'select'
function skoc(id) {
	location = document.getElementById(id).options[document.getElementById(id).selectedIndex].value 
}


function lightbox() {
  if (!document.getElementsByTagName) return false;
  var links = document.getElementsByTagName("a");
  for (var i=0; i < links.length; i++) {
    if (links[i].className.match("lightbox")) {
	  //links[i].href = (document.location.substring(0,10));
	  //links[i].href = document.location+"#"+links[i].id;
	  links[i].caption = "http://www.obrazazvuk.cz/files/images/sm/"+links[i].id;
	  //links[i].type = "http://www.zoozlin.eu/foto.php?url="+links[i].id+"&title="+links[i].title;
	  links[i].name = links[i].id;
	  links[i].title = '';
	  //links[i].onclick = function() { return !okno(this.type,500,500); }
	  links[i].onmouseover = function() { return !showtrail(0,0,this.caption); }
	  links[i].onmouseout = function() { return !hidetrail(); }
    }
    if (links[i].className.match("popup")) {
      links[i].onclick = function() { return !window.open(this.href); }
    }
  }
  return true;
}

window.onload = lightbox;
