/****************************************
| ** General Mooing **
|
| Created by:	 James Hicks
| Date Created:	 2007-09-14
| Copyright 2007 Lightmaker Manchester
|
****************************************/

window.addEvent('domready', function() {


//
//  Menu
//

	var menuItems = $$('#menu a');
	menuItems.each(function(item) {
		item.$tmp.fx = new Fx.Styles(item, {
			wait: false,
	        duration: 200,
	        transition: Fx.Transitions.sineOut
		});	
				
		if(window.ie){
			item.$tmp.fx.set({'background-position-y': '37'});
		} else {			    
			item.$tmp.fx.set({'background-position': '0, 37'});
		}
				
		item.addEvent('mouseenter', function(event) {
			event = new Event(event).stop();
			this.$tmp.fx.stop();
			if(window.ie){
				this.$tmp.fx.start({'background-position-y': '29'});
			} else {			    
				this.$tmp.fx.start({'background-position': '0, 29'});
			}
		});
		
		item.addEvent('mouseleave', function(event) {
			event = new Event(event).stop();
			this.$tmp.fx.stop();
			if(window.ie){
				this.$tmp.fx.start({'background-position-y': '37'});
			} else {			    
				this.$tmp.fx.start({'background-position': '0, 37'});
			}	
		});
	});

	
//
//  Product Blocks
//

	var products = $$('a.productColumn,a.productColumnExtended');
	products.each(function(product) {
		
		product.$tmp.fx = new Fx.Styles(product, {
			wait: false,
	        duration: 200,
	        transition: Fx.Transitions.quadOut
		});	
		
		if(window.ie){
			product.$tmp.fx.start({'background-position-y': '-5'});
		} else {			    
			product.$tmp.fx.start({'background-position': '0, -5'});
		}
				
		product.addEvent('mouseenter', function(event) {
			event = new Event(event).stop();
			this.$tmp.fx.stop();
			if(window.ie){
				this.$tmp.fx.start({'background-position-y': '0'});
			} else {			    
				this.$tmp.fx.start({'background-position': '0, 0'});
			}	
		});
		
		product.addEvent('mouseleave', function(event) {
			event = new Event(event).stop();
			this.$tmp.fx.stop();
			if(window.ie){
				this.$tmp.fx.start({'background-position-y': '-5'});
			} else {			    
				this.$tmp.fx.start({'background-position': '0, -5'});
			}
		});
	});
	
//
//  Feature Blocks
//
	var features = $$('.feature .image a');
	features.each(function(feature) {
		
		feature.$tmp.fx = new Fx.Styles(feature, {
			wait: false,
	        duration: 200,
	        transition: Fx.Transitions.quadOut
		});	
		
		if(window.ie){	
			feature.$tmp.fx.start({'background-position-y': '112'});
		} else {			    
			feature.$tmp.fx.start({'background-position': '0, 112'});
		}	
		
		feature.addEvent('mouseenter', function(event) {
			event = new Event(event).stop();
			this.$tmp.fx.stop();
			if(window.ie){
				this.$tmp.fx.start({'background-position-y': '107'});
			} else {			    
				this.$tmp.fx.start({'background-position': '0, 107'});
			}
		});
		feature.addEvent('mouseleave', function(event) {
			event = new Event(event).stop();
			this.$tmp.fx.stop();
			if(window.ie){
				this.$tmp.fx.start({'background-position-y': '112'});
			} else {			    
				this.$tmp.fx.start({'background-position': '0, 112'});
			}	
		});
		
	});
	
	
   
//
//	Textbox example value remover
//

	/*var inputBoxes = $ES("input");

	inputBoxes.each(function(box) {
			// If its there hide it
			box.addEvent('focus', function(event) {
				event = new Event(event).stop();
				if(this.value == this.defaultValue){
					this.value = "";		
				}
			});
			// If its blank then show it
			box.addEvent('blur', function(event) {
				event = new Event(event).stop();
				if(this.value == ""){
					this.value = this.defaultValue;
				}
			});
	});*/

			
});