  var kristekeffect = new Class({
   initialize: function(sitename) {
    this.sitename = sitename;
    this.queue = new Array();
    this.ismoving = 0;
    $A($('all').getElements('a.eff')).each(function(anc) { $(anc).addEvent('click', this.querycontent.bind(this)); }.bind(this));
    this.reff1 = new Fx.Style($('headercolor'), 'left', { duration: 200, transition: Fx.Transitions.linear, onComplete: this.movenext.bind(this) });
    this.reff2 = new Fx.Style($('contentcolor'), 'left', { duration: 200, transition: Fx.Transitions.linear, onComplete: this.movenext.bind(this) });
    this.reff3 = new Fx.Style($('footercolor'), 'left', { duration: 200, transition: Fx.Transitions.linear, onComplete: this.movenext.bind(this) });
    this.reff4 = new Fx.Style($('contenttitle'), 'left', { duration: 200, transition: Fx.Transitions.linear, onComplete: this.movenext.bind(this) });
    this.reff5 = new Fx.Style($('contentbody'), 'left', { duration: 200, transition: Fx.Transitions.linear, onComplete: this.movenext.bind(this) });
    this.leff1 = new Fx.Style($('headercolor'), 'left', { duration: 500, transition: Fx.Transitions.Quart.easeOut, onComplete: this.movenext.bind(this) });
    this.leff2 = new Fx.Style($('contentcolor'), 'left', { duration: 500, transition: Fx.Transitions.Quart.easeOut, onComplete: this.movenext.bind(this) });
    this.leff3 = new Fx.Style($('footercolor'), 'left', { duration: 500, transition: Fx.Transitions.Quart.easeOut, onComplete: this.movenext.bind(this) });
    this.leff4 = new Fx.Style($('contenttitle'), 'opacity', { duration: 300, transition: Fx.Transitions.linear, onComplete: this.movenext.bind(this) });
    this.leff5 = new Fx.Style($('contentbody'), 'opacity', { duration: 300, transition: Fx.Transitions.linear, onComplete: this.movenext.bind(this) });
   },
   querycontent: function(e) {
    var event = new Event(e);
    var href = event.target.href;
    var testhref = href;
    var testimonials = $('testimonials');
    var lastper = testhref.lastIndexOf('/');
    if (lastper > -1) testhref = testhref.substr(lastper + 1);
    switch (testhref) {
     case 'clients':
     case 'testimonials': if (!testimonials) $('header').adopt(new Element('a').setProperties({'id': 'testimonials', 'href': 'testimonials', 'tabindex': 0}).appendText('Client Testimonials').addEvent('click', this.querycontent.bind(this))); break;
     default: if (testimonials) testimonials.remove();
    };   
    if (href.indexOf('?') > -1) href += '&'; else href += '?';
    this.content_to_load = null;
    this.movenext('right');
    new Ajax(href + 'ajax=true', { method: 'get', onComplete: this.loadcontent.bind(this) }).request();
    event.stop();
    return false;
   },
   loadcontent: function(text) {
    this.content_to_load = text;
    this.movenext('left');
   },
   setcontent: function() {
    if (this.content_to_load == null) return;
    var splitted = this.content_to_load.split("\n");
    if (splitted[0] == '') document.title = this.sitename; else document.title = this.sitename + ' - ' + splitted[0];
    $('headercolor').setStyle('border-color', splitted[1]);
    $('contentcolor').setStyle('border-color', splitted[1]);
    $('footercolor').setStyle('border-color', splitted[1]);
    $('contenttitle').setStyle('color', splitted[1]);
    $('contenttitle').setHTML(splitted[0]);
    var firstn = this.content_to_load.indexOf("\n");
    var secondn = this.content_to_load.substring(firstn + 1).indexOf("\n");
    $('contentbody').setHTML(this.content_to_load.substring(firstn + secondn + 1));
    $A($('contentbody').getElements('a.eff')).each(function(anc) { $(anc).addEvent('click', this.querycontent.bind(this)); }.bind(this));
    this.content_to_load = null;
   },
   movenext: function(next) {
    switch (next) {
     case 'left': this.queue.push('left'); break;
     case 'right': this.queue.push('right'); break;
     default: this.ismoving--;
      if ((this.ismoving == 2) && (this.movedir == 'left')) {
       this.leff4.start(0, 1);
       this.leff5.start(0, 1);
      };
    };
    if (this.ismoving < 1) {
     next = this.queue.shift();
     switch (next) {
      case 'left':
       this.setcontent();
       this.moveleft();
       break;
      case 'right': this.moveright(); break;
     };
    };
   },
   moveright: function() {
    this.ismoving = 5;
    this.movedir = 'right';
    var windowwidth = parseInt(window.getWidth());
    this.reff1.start(0, windowwidth);
    this.reff2.start(0, windowwidth);
    this.reff3.start(0, windowwidth);
    this.reff4.start(0, windowwidth);
    this.reff5.start(0, windowwidth);
   },
   moveleft: function() {
    this.ismoving = 5;
    this.movedir = 'left';
    var width = parseInt($('headercolor').getStyle('width'));
    var allpos = $('all').getLeft();
    var outpos = 0 - allpos - width;
    $('contenttitle').setOpacity(0).setStyle('left', 0);
    $('contentbody').setOpacity(0).setStyle('left', 0);
    this.leff1.start(outpos, 0);
    this.leff2.start(outpos, 0);
    this.leff3.start(outpos, 0);
   }
  });

