/**
* Assign the view handler
*/

viewHandler = OurVodkas;

/**
* Creates a new object with methods used by the Our Vodkas page
*
* @author				Matt Gifford
* @copyright			2009 Timeshifting Interactive Limited
*/
function OurVodkas()
	{
	// 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);

		// Set up the interactive bottles
		this.initInteractiveFeatures();
		}
	


	/**
	* Setups the animation of the definition items
	*/
	this.initInteractiveFeatures = function()
		{
		var products = [document.getElementById('product1info'), document.getElementById('product2info'), document.getElementById('product3info')];
		for (var x = 0; x < products.length; x++)
			{
			// Set the initial opacity on the definition
			YAHOO.util.Dom.setStyle(products[x], 'opacity', 0);
			YAHOO.util.Dom.setStyle(products[x], 'visibility', 'visible');

			// Add the same unique reference id to both the elements
			products[x].setAttribute('animationId', 'id' + this.animationReferences.count++);

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

				// Animate the definition
				xhtml.animationReferences[this.getAttribute('animationId')] = new YAHOO.util.Anim(this, {opacity: { to: 1 }}, 0.1, YAHOO.util.Easing.easeBoth );
				xhtml.animationReferences[this.getAttribute('animationId')].animate();
				}

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

				// Animate the definition
				xhtml.animationReferences[this.getAttribute('animationId')] = new YAHOO.util.Anim(this,  {opacity: { to: 0 }}, 1.6, YAHOO.util.Easing.easeBoth );
				xhtml.animationReferences[this.getAttribute('animationId')].animate();
				}
			}
		}
	}
