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 = "";
}

// ------------------------------------------ zvalidovat maly kontaktni formular
function validate_01(formular)  {
	if (formular.jmeno.value=="")   {
		alert ("ERROR: please fill in item 'Name'");
		formular.jmeno.focus();
		return false;
  }

	if (formular.mail.value=="") {
		alert ("ERROR: please fill in item 'E-mail'");
		formular.mail.focus();
		return false;
  }

	if (formular.telefon.value=="") {
		alert ("ERROR: please fill in item 'Tel'");
		formular.telefon.focus();
		return false;
  }
}

// ------------------------------------------ zvalidovat objednavkovy formular
function validate_02(formular)  {
	if(document.getElementById('souhlas').checked == false) {
		alert ("ERROR: please confirm 'Disclaimer'");
		document.getElementById('souhlas').focus();
		return false;
	}

	if (formular.dodaci_jmeno.value=="")   {
		alert ("ERROR: please fill in item 'First name'");
		formular.dodaci_jmeno.focus();
		return false;
  }

	if (formular.dodaci_prijmeni.value=="") {
		alert ("ERROR: please fill in item 'Last name'");
		formular.dodaci_prijmeni.focus();
		return false;
  }

	if (formular.dodaci_adresa_1.value=="") {
		alert ("ERROR: please fill in item 'Address 1'");
		formular.dodaci_adresa_1.focus();
		return false;
  }

	if (formular.dodaci_mesto.value=="") {
		alert ("ERROR: please fill in item 'City'");
		formular.dodaci_mesto.focus();
		return false;
  }

	if (formular.dodaci_stat.value=="") {
		alert ("ERROR: please fill in item 'State'");
		formular.dodaci_stat.focus();
		return false;
  }

	if (formular.dodaci_zip.value=="") {
		alert ("ERROR: please fill in item 'Zip Code'");
		formular.dodaci_zip.focus();
		return false;
  }

	if (formular.dodaci_email.value=="") {
		alert ("ERROR: please fill in item 'E-mail'");
		formular.dodaci_email.focus();
		return false;
  }

	if (formular.dodaci_telefon.value=="") {
		alert ("ERROR: please fill in item 'Phone'");
		formular.dodaci_telefon.focus();
		return false;
  }

	if (formular.id_platba.value=="0") {
		alert ("ERROR: please select your 'Payment method'");
		formular.id_platba.focus();
		return false;
  }

	if ((formular.id_platba.value=="2") && (formular.id_karta.value=="0")) {
		alert ("ERROR: please select your 'Card type'");
		formular.id_karta.focus();
		return false;
  }

}

// ------------------------------------------ zobrazeni informace o uskutecneni platby
function Platba() {
	if (document.getElementById('id_platba').value=="2") {
		//document.getElementById('box-karty').className = "box-karty";
		document.getElementById('typ-karty').className = "typ-karty";
	} else {
		//document.getElementById('box-karty').className = "box-karty hidden";
		document.getElementById('typ-karty').className = "typ-karty hidden";
	}
}

// ------------------------------------------ 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;
	}
}

// ------------------------------------------ povolit vložení pouze čísel
function OnlyNumber(e) {
  var keynum=0;
  if (window.event) keynum=e.keyCode;
  else if (e) keynum=e.which;
  if (keynum==8 || (keynum>=48 && keynum<=57)) return true;
  else return false;
}


// ------------------------------------------ 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;