
    url           = document.location.href; // url base
    xend          = url.lastIndexOf("/") + 1;
    var base_url  = url.substring( 0, xend );

//  ----------------------------------------------------------- ::: - ::: - ::: ------------
//  ----------------------------------------------------------- ::: - ::: - ::: ------------
    function action( url ) {

      if ( url.substring(0, 4) != 'http' ) {
        url       = base_url + url;
      }

      var jsElem  = document.createElement('SCRIPT');
      jsElem.type = 'text/javascript';
      jsElem.src  = url;

      document.body.appendChild( jsElem );

    }

//  ----------------------------------------------------------- ::: - ::: - ::: ------------
//  ----------------------------------------------------------- ::: - ::: - ::: ------------
    function validate( form ) {
      var email = document.getElementById('email');
      if ( email.value != '' ) {
        if ( validEmail(email) ) {
          action( 'inc/action.php?email=' + email.value );
        }
        else {
          alert( 'invalid email' );
          email.focus();
        }
      }
      else {
        alert( 'empty e-mail' );
        email.focus();
      }
    }

//  ----------------------------------------------------------- ::: - ::: - ::: ------------
//  ----------------------------------------------------------- ::: - ::: - ::: ------------
    function validEmail( email ) {
      return email.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.info)|(\.edu)|(\.gov)|(\.org)|(\.info)|(\.biz)|(\.tv)|(\.tk)|(\.es)|(\.cl)|(\.ch)|(\..{2,2}))$)\b/gi);
    }
