/*
window.onresize=adjustHeight;
adjustHeight();
*/

/*
 * this method is called each and every time a page is loaded (even ajax). Thus splash stuff does not need to be a part of this.
 */
function initialize() {
	
	CleanCSS.byClass('ajax-link', 'onclick', function() {
		fetchPage(this.href);
		return false;
	});
	
	CleanCSS.email('email-link');
	Nsfw.initialize();
		
	if($('note')) {
		Effect.Fade('note', { delay: 5.0, duration: 1.0 });
		Rico.Corner.round('note');
	}
	
	ajaxEngine.registerRequest( 'fetchPageAJAX', 'content_fetcher.php');
	ajaxEngine.registerAjaxElement('content');
}

initialize();
setCurrentPage(document.location.href);
	
/*
 * trigger fade on mouse over
 */
CleanCSS.byClass('splash-icon', 'onmouseover', function() {
	Effect.Fade(this, { to: 0.1, duration: 0.2, queue: { scope: this.id, limit: 1 } } );
	clearTimeout(this.timeout);
	this.timeout = setTimeout("Effect.Appear('" + this.id + "', { duration: 0.2, queue: { scope: '" + this.id + "', limit: 1 } } )", 1000);
});

/*
 * keep stuff faded while moving mouse over and continuously create a new appear queue
 */
CleanCSS.byClass('splash-icon', 'onmousemove', function() {
	clearTimeout(this.timeout);
	this.timeout = setTimeout("Effect.Appear('" + this.id + "', { duration: 0.2, queue: { scope: '" + this.id + "', limit: 1 } } )", 1000);
});

/*
 * on mouse out gets skipped sometimes, but when it doesn't, appear instantly
 */
CleanCSS.byClass('splash-icon', 'onmouseout', function() {
	if(Element.getOpacity(this) < 0.99) {
		Effect.Appear(this, { from: 0.1, duration: 0.2, queue: { scope: this.id, limit: 1 } } );
	}
});

CleanCSS.byClass('splash-icon', 'onclick', function() {
	clearTimeout(this.timeout);
	Effect.Appear(this, { duration: 0.3 });
});

if($('splash-area')) {
	Rico.Corner.round( 'splash-area', { corners: "top" } );
}
if($('header')) {
	Rico.Corner.round( 'header', { corners: "top" } );
}
if($('footer')) {
	Rico.Corner.round( 'footer', { corners: "bottom" } );
}