/**
* Assign the view handler
*/

viewHandler = Contact;

/**
* Creates a new object with methods used by the Contact page
*
* @author				Matt Gifford
* @copyright			2008 Timeshifting Interactive Limited
*/
function Contact()
	{
	// Step 1. Define Properties

	var _instance = this;
	this.animationReferences = { count: 1 };



	// Step 2. Define Public Methods

	/**
	* Sets up the initial page state and event handlers
	*/
	this.init = function()
		{
		// Call generic page init method
		this.base.init.call(this);

		// Add animation to page elements
		this.initLinkAnimation();
		}


	/**
	* Adds the event handlers to change the colour of links
	*/
	this.initLinkAnimation = function()
		{
		var links = document.getElementById('contactContent').getElementsByTagName('a');
		for (var x = links.length-1; 0 <= x; x--)
			{
			// Check if this is an animated link
			if (links[x].className.indexOf('animate') != -1)
				{
				// Add an unique reference id to the element
				links[x].setAttribute('animationId', 'id' + this.animationReferences.count++);

				// Add event handler for mouse over
				links[x].onmouseover = function()
					{
					// Try to stop any existing animation on this object
					try { xhtml.animationReferences[this.getAttribute('animationId')].stop(false); } catch (err) {}

					// Animate the link
					xhtml.animationReferences[this.getAttribute('animationId')] = new YAHOO.util.ColorAnim(this, {color: { to: '#FFFFFF' }}, 0.3, YAHOO.util.Easing.easeBoth );
					xhtml.animationReferences[this.getAttribute('animationId')].animate();
					}

				// Add event handler for mouse out
				links[x].onmouseout = function()
					{
					// Try to stop any existing animation on this object
					try { xhtml.animationReferences[this.getAttribute('animationId')].stop(false); } catch (err) {}

					// Animate the link
					xhtml.animationReferences[this.getAttribute('animationId')] = new YAHOO.util.ColorAnim(this, {color: { to: '#CC6633' }}, 0.9, YAHOO.util.Easing.easeBoth );
					xhtml.animationReferences[this.getAttribute('animationId')].animate();
					}
				}
			}
		}
	}
