﻿var delicious = { src: '/Assets/delicious.swf' };
sIFR.activate(delicious);

var Site = new Class(
{
	initialize : function()
	{

	},

	load : function()
	{
		ui.load();

		ui.onAfterRequest = function()
		{
			site.ensureTypo();
		}

		window.onresize = function()
		{
			site.ensureTypo();
		}

		$(document.body).getElements('div.association').addEvents({
			'mouseenter' : function()
			{
				var contentDiv = this.getElement(".associationContent");
				contentDiv.setStyle("color", "#888888");
			},

			'mouseleave' : function()
			{
				var contentDiv = this.getElement(".associationContent");
				contentDiv.setStyle("color", "#222222");
			}
		});

		this.ensureTypo();
	},

	ensureTypo : function()
	{
		sIFR.replace(delicious,
			{
				selector   : 'h1',
				forceSingleLine : true,
				fitExactly : true,
				css        : { '.sIFR-root' : { 'color': '#405A61', 'font-weight' : 'bold'  } },
				selectable : false,
				wmode      : 'transparent'
			}
		);

		sIFR.replace(delicious,
			{
				selector   : 'h2',
				css        : { '.sIFR-root' : { 'color' : '#5e5e5e', 'font-weight' : 'normal' } },
				selectable : false,
				wmode      : 'transparent'
			}
		);

		sIFR.replace(delicious,
			{
				selector   : 'h3',
				forceSingleLine : true,
				tuneWidth  : 1,
				css        : { '.sIFR-root' : { 'color' : '#358297', 'font-weight' : 'bold', 'cursor' : 'pointer' } },
				selectable : false,
				wmode      : 'transparent',

				onRollOver : function(callbackInfo)
				{
					callbackInfo.changeCSS( { '.sIFR-root' : { 'color': '#41A0BA', 'font-weight' : 'bold', 'cursor' : 'pointer' } } );
				},

				onRollOut : function(callbackInfo)
				{
					callbackInfo.changeCSS( { '.sIFR-root' : { 'color': '#358297', 'font-weight' : 'bold', 'cursor' : 'pointer' } } );
				},
				
				onRelease : function(callbackInfo)
				{
					var parentDiv = $(callbackInfo.getAlternate()).getParent();
					var ieRouteFunc = parentDiv.click;

					if (ieRouteFunc)
					{
						ieRouteFunc();
					}
				}
			}
		);
	}
});

var site = new Site();

window.addEvent('domready', function()
{
	site.load();
});