function Validate(theForm) {
  var muzes=true;
  for(var i=0; i<theForm.length; i++ ) {
    with(theForm.elements[i]) {
      if( (type=="text") && (name!="kupon") ) {
        if( value.length==0) {
          focus();
          muzes=false;
        }
      }
      if (name=="kupon" && value.length>0) return true;
    }
  }
  return muzes;
}

function zkontroluj_dopravu(theForm)
{
  if (!Validate(theForm)) {
    alert('Zvolte, prosím, způsob dopravy a úhrady zboží!');
    return false;
  }
  return true;
}

function zkontroluj_pocet(theForm)
{
  var chyba=0;
  for(var i=0; i<theForm.length; i++ ) {
    with(theForm.elements[i]) {
        if( value=="" ) {
          focus();
          chyba=1;
        }
    }
  }
  if (!chyba) {
    alert('Zboží bylo přidáno do košíku. Ten naleznete v pravém sloupci nahoře.');
    return true;
  }
  else {
    alert('Musite vyplnit všechny potřebné údaje!');
    return false;
  }
}


function Validate_delivery(theForm){
  if (((theForm.elements[0].value=="") &&
      (theForm.elements[1].value=="") &&
      (theForm.elements[3].value=="") &&
      (theForm.elements[4].value=="") &&
      (theForm.elements[5].value=="") &&
      (theForm.elements[6].value=="") &&
      (theForm.elements[7].value=="")) ||
     ((theForm.elements[0].value!="") &&
      (theForm.elements[1].value!="") &&
      (theForm.elements[3].value!="") &&
      (theForm.elements[4].value!="") &&
      (theForm.elements[5].value!="") &&
      (theForm.elements[6].value!="") &&
      (theForm.elements[7].value!=""))) return true;
      else { alert('V dodací adrese chybí některý povinný údaj!');
             return false;
      }
}

function ShowEuro(toogleId){
  var eurodivy=document.getElementsByTagName('span');
  for(var i=0; i<eurodivy.length; i++ ){
    if (eurodivy[i].id=='euro' || eurodivy[i].id=='kc'){
      if (eurodivy[i].style.display == "none") eurodivy[i].style.display = "";
      else eurodivy[i].style.display = "none";
    }
  }
}
