function checkOznameni1(formular)
{
if (document.formular.txtRow2.value == "")
{
   document.formular.txtRow2.focus();
   alert ("Vyplňte prosím pole Jméno nevěsty.");
   return false;
}
else if (document.formular.txtRow3.value == "")
{
   document.formular.txtRow3.focus();
   alert ("Vyplňte prosím pole Jméno ženicha.");
   return false;
}
else if (document.formular.txtRow4.value == "")
{
   document.formular.txtRow4.focus();
   alert ("Zadejte prosím čas, datum a místo konání svatby.");
   return false;
}
else if (document.formular.txtQty1.value == "")
{
   document.formular.txtQty1.focus();
   alert ("Zadejte prosím počet kusů.");
   return false;
}

var x = document.formular.txtQty1.value
var RegExp = /^(-)?(\d*)(\.?)(\d*)$/;
var result = x.match(RegExp);
if ((result==null) || (x < 15)) {
result=false;
alert ("Minimální počet kusů je: 15");
document.formular.txtQty1.focus();
}
return result;
}

function checkOznameni2(formular)
{
  if (document.formular.txtRow5.value == "")
  {
     document.formular.txtRow5.focus();
     alert ("Vyplňte prosím Text pozvánky.");
     return false;
  }
  else if (document.formular.txtQty2.value == "")
  {
     document.formular.txtQty2.focus();
     alert ("Zadejte prosím počet kusů.");
     return false;
  }
  
  var x = document.formular.txtQty2.value
  var RegExp = /^(-)?(\d*)(\.?)(\d*)$/;
  var result = x.match(RegExp);
  if ((result==null) || (x < 15)){
    result=false;
    alert ("Minimální počet kusů je: 15");
    document.formular.txtQty2.focus();
  }
  
  if(document.getElementById("txtHidden").value == "1")
  {
    if(document.getElementById("txtMail").value == "")
    {
      document.getElementById("txtMail").focus();
      alert("Zadejte e-mail.");
      return false;
    }
    if(document.getElementById("txtPass").value == "")
    {
      document.getElementById("txtPass").focus();
      alert("Zvolte si heslo, které budete používat při pozdější editaci Vašeho uloženého oznámení a pozvánky.");
      return false;
    }
  }
  return result;
}

function loadImageOznameni(par) {
var load = window.open(par,'','scrollbars=no,menubar=no,height=300,width=600,resizable=no,toolbar=no,location=no,status=no');
}
function changeImg(s, indexSelect)
{
var t=s.options[s.selectedIndex].value;
linkImg = "http://www.svatebniatelier.cz/images/svatebni-oznameni/"+t+""
document.getElementById('imgSrc'+indexSelect).src = linkImg;
}

function tryText(tryInput, tryImg, tryStep)
{
document.getElementById('imgEdit').src = "http://www.svatebniatelier.cz/images/svatebni-oznameni/"+tryImg+"";
  if(tryStep == '1') {
     if(document.getElementById("txtRow1").value != "")
     {
       var text1 = document.getElementById("txtRow1").value;
       var color1 = document.getElementById('row1color').value;
       if(color1 == 'vlastni') {
         color1 = "#"+document.getElementById('txtColor1').value;
       }
       document.getElementById(tryInput+'1').firstChild.data=text1;
       document.getElementById(tryInput+'1').style.color=color1;   
     }
     if(document.getElementById("txtRow2").value != "")
     {
       var text2 = document.getElementById("txtRow2").value;
       var color2 = document.getElementById('row2color').value;
       if(color2 == 'vlastni') {
         color2 = "#"+document.getElementById('txtColor2').value;
       }
       document.getElementById(tryInput+'2').firstChild.data=text2;
       document.getElementById(tryInput+'2').style.backgroundColor=color2;
     }
     if(document.getElementById("txtRow3").value != "")
     {
       var text3 = document.getElementById("txtRow3").value;
       var color3 = document.getElementById('row3color').value;
       if(color3 == 'vlastni') {
         color3 = "#"+document.getElementById('txtColor3').value;
       }
       document.getElementById(tryInput+'3').firstChild.data=text3;
       document.getElementById(tryInput+'3').style.backgroundColor=color3;
     }
     if(document.getElementById("txtRow4").value != "")
     {
       var text4 = document.getElementById("txtRow4").value;
       var color4 = document.getElementById('row4color').value;
       if(color4 == 'vlastni') {
         color4 = "#"+document.getElementById('txtColor4').value;
       }
       document.getElementById(tryInput+'4').firstChild.data=text4;
       document.getElementById(tryInput+'4').style.backgroundColor=color4;
     }
   }else if(tryStep == '2'){
       if(document.getElementById("txtRow4").value != "")
     {
       var text5 = document.formular.txtRow5.value;
       var color5 = document.getElementById('row5color').value;
       if(color5 == 'vlastni') {
         color5 = "#"+document.getElementById('txtColor5').value;
       }
       document.getElementById(tryInput+'4').firstChild.data=text5;
       document.getElementById(tryInput+'4').style.backgroundColor=color5;
     }
   }
}

function ownColor(parInt, parReq)
{ 
  var parSel = document.getElementById("row"+parInt+"color").value;
  if(parSel == parReq) {
    document.getElementById("ownColor"+parInt).innerHTML = "<input type=\"text\" id=\"txtColor"+parInt+"\" name=\"txtColor"+parInt+"\" size=\"3\" maxlength=\"6\" />";
  }else {
    document.getElementById("ownColor"+parInt).innerHTML = "";
  }
}

function tryMail(parSave)
{
  if(parSave == "2") {
    document.getElementById("tryMailDiv").innerHTML = "<p>e-mail: <input type=\"text\" name=\"txtMail\" id=\"txtMail\" size=\"18\" /> heslo pro editaci: <input type=\"text\" name=\"txtPass\" id=\"txtPass\" size=\"8\" /><input type=\"hidden\" id=\"txtHidden\" value=\"1\" /></p>";
  }else {
    document.getElementById("tryMailDiv").innerHTML = "";
  }
}

