function init() {
	$$('.navlink[rel]').invoke('observe', 'click', function(event) {
		event.element().blur();
		event.stop();
		if (this.rel && $(this.rel)) {
		if (Prototype.Browser.IE6) $(this.rel).scrollTo();
		else new Effect.ScrollTo(this.rel, { duration: 0.6 });
		}
	});
	
	// feature tips
	$('intro').select('.tipped[title]').each(function(element) {
	  var title = element.getAttribute('title');
	  var wrap = new Element('div').update(title);
	  wrap.insert({ top: new Element('p').update(element.down('span').innerHTML.replace(':', '')) });
								   
	  new Tip(element, wrap, { className: 'featureTip', target: 'featuresImage', hook: { target: 'topRight', tip: 'topRight' }, effect: 'appear', delay: 0.2, hideAfter: 0.8, hideOn: false, duration: 0.3, viewport: false });
	  element.title = '';
    });
	
	
	Projects.createIdeas('lightview');
}
document.observe('dom:loaded', init);

if (!window.Nick) var Nick = {};

Nick.Changelog = {
  versions: [],
  
  start: function(element, url) {
	this.element = $(element);
	this.url = url;
	this.update();
  },
  
  update: function() {
	new Ajax.Request(this.url, { method: 'get',
    onComplete: function(response) {
	  if (!Prototype.Browser.IE) {
	    this.versions = response.responseText.gsub('>', '&gt;').gsub('<', '&lt;').split(/\r\n\r\n\r/);
	  
	    this.allVersions = this.versions.join('\r\n\r\n\r');
		
		if (this.versions.length ) {
          this.element.down('.code').setStyle({ height: 'auto', overflow: 'auto', width: '730px' });
          this.element.down('pre').update(this.versions[0]);
        }
	  
	    this.element.down('.txt').observe('click', this.toggleFull.bind(this));
	  }
	  else {
		this.element.down('pre').update('The changelog is available a text file. Click changelog.txt to open the changelog.');
        
	    this.element.down('.txt').observe('click', function() { window.location.href = this.url; }.bind(this));
	  }
	  
    }.bind(this)});
  },
  
  toggleFull: function() {
	var full = this.element.down('.txt').innerHTML == 'changelog.txt';
	
	this.element.down('pre').update(full ? this.allVersions : this.versions[0]);
	this.element.down('.txt').update(full ? 'lastest version only' : 'changelog.txt');
  }
};

document.observe('dom:loaded', Nick.Changelog.start.bind(Nick.Changelog, 'changelog', '/projects/lightview/changelog.txt'));