var popup = {
  '.popup:click': function(element,event) {
    if (element.readAttribute('href')) {
      href = element.readAttribute('href');
    } else {
      element = element.parentNode;
      href = element.parentNode.readAttribute('href');
    }

    if (element.hasClassName('max')) {
      window.open(href, '', 'resizable=1,width=' + screen.width + ',height=' + screen.height + ',scrollbars=1');
    } else {
      window.open(href, '', 'resizable=1,width=780,height=431,scrollbars=1');
    }

    Event.stop(event);
  }
}

var confirm_dialog = {
  '.confirm:click': function(element,event) {
    if(! confirm('Please confirm this action.'))
      Event.stop(event);
  }
}

var flash_fade = {

  '.flash': function(element) {
    new Effect.Highlight(element, {delay: 0.5});
    new Effect.Fade(element, {delay: 5, duration: 0.4});
  }
}

var flash_warning = {
  '.warning': function(element) {
  new Effect.Highlight(element, {delay: 0.3, duration: 1.7, startcolor: '#ffcccc', endcolor: '#ffffff'});
}
}

var flash_error = {
  '.error': function(element) {
  new Effect.Highlight(element, {delay: 0.3, duration: 1.7, startcolor: '#ffcccc', endcolor: '#ffffff'});
}
}

var flash_notice = {
  '.notice': function(element) {
  new Effect.Highlight(element, {delay: 0.3, duration: 1.7});
}
}

var flash_errorExplanation = {
  '.errorExplanation': function(element) {
  new Effect.Highlight(element, {delay: 0.3, duration: 1.7, startcolor: '#ffcccc', endcolor: '#ffffff'});
}
}

var mouseovers = {
  'td:mouseover': function(element,event) {
    nl = element.parentNode.childNodes;
    for(i=0,n=nl.length;i<n;i++){
      nl[i].style.background = '#ff9';
    }
  },
  'td:mouseout': function(element,event) {
    nl = element.parentNode.childNodes;
    for(i=0,n=nl.length;i<n;i++){
      if (element.parentNode.hasClassName('highlight'))
        nl[i].style.background = '#eff';
      else
        nl[i].style.background = '#fff';
    }
  }
}

var auto_focus = {
  '.auto_focus': function(element,event) {
    element.focus();    
  }
}

