
  function checkSearchPhraseLength()
  {
    var phrase = document.getElementById('search-phrase');

    if (phrase.value.length < 3) {
      alert('Hledaná fráze musí být delší než 2 znaky!')
      return false;
    }
  }
  
  function stripAutoCompletedPhrase()
  {
    var phrase = document.getElementById('search-phrase');
    var index = phrase.value.indexOf('[');
    var result = phrase.value.substring(0, index);
    
    document.getElementById('search-phrase').value = result;
  }
  
  function hideNewAddressTable()
  {
    document.getElementById("new-address").style.display="none";
  }
  
  function showNewAddressTable()
  {
    document.getElementById("new-address").style.display="table";
  }
  
  String.prototype.trim = function() {
  	return this.replace(/^\s+|\s+$/g,"");
  }
  String.prototype.ltrim = function() {
  	return this.replace(/^\s+/,"");
  }
  String.prototype.rtrim = function() {
  	return this.replace(/\s+$/,"");
  }


  
  function validateWishForm()
  {
    var contact = document.getElementById('item_contact');
    var text = document.getElementById('item_text');
    
    if (contact.value.trim().length < 1) {
      alert('Vyplňte prosím e-mail!')
      return false;
    }
    
    if (text.value.trim().length < 1) {
      alert('Vyplňte prosím Váš dotaz!')
      return false;
    }
    
    return true;
  }
  

