function popup(winlocation) {
  newwin = window.open(winlocation, "_blank", "toolbar=yes, location=yes, menubar=yes, resizable=yes");
}

function externalAnchors() {
  var setOfAllAnchors = $ES('a'); // get all anchors
  setOfAllAnchors.each(function(anchor, i) { // iterate through all anchors
    var title = anchor.getProperty('title');
    if(title.substr(0, title.indexOf('-')) == 'externer Verweis ') { // check current anchor
      anchor.addEvent('click', function() { // create onclick event-handler
        var win = window.open(anchor.href, "_blank", "toolbar=yes, location=yes, menubar=yes, resizable=yes"); 
        return false;
      });
    } 
  });
}

function setFormElementsHover() {
  var setOfFormElements = $ES('input,textarea');
  setOfFormElements.each(function(formElement, i) {
    formElement.addEvent('focus', function() {
      formElement.setProperty('class', 'focused');
    });
    formElement.addEvent('blur', function() {
      formElement.setProperty('class', '');
    });      
  });
}

function buildEmailAddress(username, host, TLD) {
  var email = username + '@' + host + '.' + TLD;
  location.href = 'mailto:' + email;
}
