_uacct = "UA-2336657-1";
urchinTracker();

document.observe('dom:loaded', function() {
	// navigation
	$$('.navlink[rel]').invoke('observe', 'click', function(event) {
		event.element().blur();
		event.stop();
		if ($(this.rel)) {
		if (Tips.fixIE) $(this.rel).scrollTo();
		else new Effect.ScrollTo(this.rel, { duration: 0.6 });
		}
	});
	
	// license confirm
	if ($('confirmFirst')) {
	$('confirmFirst').observe('click', function(event) {
	  event.stop();
	  event.element().blur();
	  $('confirm').show();
	});
	
	$('no').observe('click', Element.hide.curry('confirm'));
	}
	// supported browsers
	new Tip('supportedBrowsersTooltip', $$('.supportedBrowsers')[0].cloneNode(true), {
		hook: { target: 'topRight', tip: 'bottomLeft' },
		stem: 'bottomLeft',
		width: 'auto'
	});

    // projects
	Projects.createIdeas('Prototip 2');

	// changelog
	new Ajax.Request('../prototip2/changelog/?format=json', {
		method: 'get',
		onComplete: function(transport) {
			var firstEntry = transport.responseJSON.first(),
			txt = firstEntry.title + '<br\/>\n' + firstEntry.description;
			txt = txt.gsub('\r\n', '<br/>');
			txt = txt.gsub(/\s\s/, '&nbsp;&nbsp;');
			$('download').down('div.code').update(txt);
		}
	});
});
